The OP is running 1.6 based on the output he provided, so migrations don't apply.
You'll need to log into the database directly and interrogate the table to see what columns actually exist. The error message is coming directly from the database when the query is executed, not sourced from Django (Django is just passing it along). You should also try running syncdb again. It should be an idempotent operation, assuming that you haven't made any other changes to your model code, so you can run it as many times as you want. -James On Jan 12, 2015 11:40 AM, "Vijay Khemlani" <vkhem...@gmail.com> wrote: > sqlall only prints the commands that would be executed to create the > database from scratch, it does not output your current database schema > > if you are using django 1.7, then you need to create a migratino and apply > it > > python manage.py makemigrations > python manage.py migrate > > On Mon, Jan 12, 2015 at 4:31 PM, dennis breland <denb...@bellsouth.net> > wrote: > >> >> On Monday, January 12, 2015 at 1:16:17 PM UTC-5, dennis breland wrote: >>> >>> All works fine before making this change. >>> >>> I added new data named "photo" in models.py and admin.py >>> When I bring up the web page, I get this: >>> >>> ProgrammingError at /admin/recipe/dish/ >>> >>> column recipe_dish.photo does not exist >>> LINE 1: ...ipe_dish"."dish_category", "recipe_dish"."style", >>> "recipe_di... >>> ^ >>> >>> Request Method: GET >>> Request URL: http://104.236.74.80/admin/recipe/dish/ >>> Django Version: 1.6.1 >>> Exception Type: ProgrammingError >>> Exception Value: >>> >>> column recipe_dish.photo does not exist >>> LINE 1: ...ipe_dish"."dish_category", "recipe_dish"."style", >>> "recipe_di... >>> ^ >>> >>> Exception Location: /usr/lib/python2.7/dist- >>> packages/django/db/backends/util.py in execute, line 53 >>> Python Executable: /usr/bin/python >>> Python Version: 2.7.6 >>> Python Path: >>> >>> ['/home/django/django_project', >>> '/home/django', >>> '/usr/bin', >>> '/usr/lib/python2.7', >>> '/usr/lib/python2.7/plat-x86_64-linux-gnu', >>> '/usr/lib/python2.7/lib-tk', >>> '/usr/lib/python2.7/lib-old', >>> '/usr/lib/python2.7/lib-dynload', >>> '/usr/local/lib/python2.7/dist-packages', >>> '/usr/lib/python2.7/dist-packages'] >>> >>> >>> >>> >>> Here's all the data - >>> >>> models.py: >>> >>> . >>> >>> . >>> >>> >>> class Dish(models.Model): >>> dish_name = models.CharField(max_length=200) >>> steps = models.TextField(default='1. Mix some stuff') >>> def __str__(self): # Do this for every class. >>> return self.dish_name # No matter which object is called, >>> the name field is returned. >>> >>> >>> description = models.TextField(default='Does this dish have a >>> story?') >>> ingredients = models.TextField(default='1. Sugar ') >>> utensils = models.TextField(default='1. Bowl') >>> cook_time = models.CharField(max_length=20, default='1 hour, 20 >>> minutes') >>> prep_time = models.CharField(max_length=20, default='20 minutes') >>> dish_category = models.CharField(max_length=20, >>> choices=FOOD_CATEGORIES) >>> style = models.CharField(max_length=20, choices=FOOD_STYLE) >>> >>> photo = models.CharField(max_length=20, default='photodefault') >>> >>> >>> . >>> >>> . >>> >>> >>> >>> admin.py: >>> . >>> . >>> >>> class DishAdmin(admin.ModelAdmin): >>> # fields = ['dish_name', 'style', 'dish_category','steps',' >>> ingredients','utensils','cook_time','prep_time','description'] >>> >>> # list_display is optional. When not used, the str() of each object >>> is displayed. >>> # This list contains the columns that are displayed on the Dish list >>> page. >>> # These items are the field names in the class Dish (with >>> underscores replaced with spaces) that is defined in models.py >>> # Not every field in the class is required to be here, only those >>> desired. >>> list_display = ('dish_name', 'style', 'dish_category') >>> >>> search_fields = ['dish_name'] >>> >>> fieldsets = [ >>> ('None', {'fields': ['dish_name', 'style', >>> 'dish_category', 'photo', 'steps', 'ingredients', 'utensils']}), >>> ('Times', {'fields': ['cook_time','prep_time'],'classes': >>> ['collapse']}), >>> ('Description', {'fields': ['description'],'classes': >>> ['collapse']}), >>> ] >>> >>> . >>> . >>> >>> >>> I ran these after making the changes: >>> python manage.py sqlall recipe >>> python manage.py syncdb >>> >>> >>> >>> >>> python manage.py sqlall recipe >>> BEGIN; >>> CREATE TABLE "recipe_site" ( >>> "id" serial NOT NULL PRIMARY KEY, >>> "locations" varchar(200) NOT NULL >>> ) >>> ; >>> CREATE TABLE "recipe_dish" ( >>> "id" serial NOT NULL PRIMARY KEY, >>> "dish_name" varchar(200) NOT NULL, >>> "steps" text NOT NULL, >>> "description" text NOT NULL, >>> "ingredients" text NOT NULL, >>> "utensils" text NOT NULL, >>> "cook_time" varchar(20) NOT NULL, >>> "prep_time" varchar(20) NOT NULL, >>> "dish_category" varchar(20) NOT NULL, >>> "style" varchar(20) NOT NULL, >>> "photo" varchar(20) NOT NULL >>> ) >>> >>> >>> >> I believe this confirms the column exists: >> python manage.py sqlall recipe >> BEGIN; >> CREATE TABLE "recipe_site" ( >> "id" serial NOT NULL PRIMARY KEY, >> "locations" varchar(200) NOT NULL >> ) >> ; >> CREATE TABLE "recipe_dish" ( >> "id" serial NOT NULL PRIMARY KEY, >> "dish_name" varchar(200) NOT NULL, >> "steps" text NOT NULL, >> "description" text NOT NULL, >> "ingredients" text NOT NULL, >> "utensils" text NOT NULL, >> "cook_time" varchar(20) NOT NULL, >> "prep_time" varchar(20) NOT NULL, >> "dish_category" varchar(20) NOT NULL, >> "style" varchar(20) NOT NULL, >> "photo" varchar(20) NOT NULL >> ) >> >>> >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To post to this group, send email to django-users@googlegroups.com. >> Visit this group at http://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/76cfe659-f170-4c6d-a168-8386887ac77f%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/76cfe659-f170-4c6d-a168-8386887ac77f%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CALn3ei2sb%2B01mG4FehXKe%3DsSvDc--6buHHeY16RL39BSzgDX1A%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CALn3ei2sb%2B01mG4FehXKe%3DsSvDc--6buHHeY16RL39BSzgDX1A%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciV2FRgnHrHrSwQRUOWMY%3DFTmm_7RkC-_DHYkJCvymu1ww%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.