what field in the django models class should be used if the type of data (text/images/html) is unknown? i'm looking for开发者_如何学编程 a field that can handle copy and pasted html code, images, text, etc.
Any textual info: TextField
Any binary info (except jpg, gif, png): FileField
Any image: ImageField
The data of FileField an ImageField is stored as files on the hard disk, leaving just the path to the file including the filename in a database field. (This is a performance feature!)
I would not use one field in your table for all three types of data, but let a) the user specify whether that's an image or some text, or b) decide yourself by checking the file using tools like unix's file
command.
精彩评论