Friday, January 18, 2013

Getting a no such column error when adding data and syncdb is not syncing

This is my first django project outside of the tutorials and it's frustrating to stumble over something so simple.

I'm getting this error when I try to add a product:

DatabaseError at /admin/products/product/add/

table products_product has no column named pub_date

This is what my models.py file looks like:
from django.db import models

class Product(models.Model):
    name = models.CharField(max_length = 200)
    desc = models.TextField()
    pub_date = models.DateTimeField()

    def __unicode__(self):
        self.name

./manage.py sqlall products returns:
BEGIN;
CREATE TABLE "products_product" (
    "id" integer NOT NULL PRIMARY KEY,
    "name" varchar(200) NOT NULL,
    "desc" text NOT NULL,
    "pub_date" datetime NOT NULL
)
;
COMMIT;

It's all very simple and nothing is special about what I have done. Sorry in advance if you guys have dealt with noob questions like this a hundred times.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/DL0x4CNUWCAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate