i have an image filed in my model and i want to write SQL create table queries myself
my model filed is this:
pic = models.ImageField(u"initial_picture",blank=True,upload_to="/face")
and i wanna use command CREATE TABLE SOME_TABLE_NAME to create my table
but i don’t know what should i use for the field type
i’v read here that i can use something like this:
Photo varbinary(max) not null
but i don’t know if it’s compatible for django and if it’s appropriate for my model
i also have used pic IMAGE DEFAULT NULL like what i saw here and the result was a varchar(100) field in the database structure
any help will be appriciated
😉
i’v tried both Photo varbinary(max) not null and Photo varchar(max) not null
the field is showing but when i press save, i get the following error:
Attempted access to '\face\sample.gif' denied.
Why don’t you keep the images in the file system, as plain files? This would be the corresponding SQL
for your pic field.
In the database, the
picfield would only contain the path for the actual image file.