0

I added a model to an application, and now I get this error:

Unknown field(s) (date) specified for appname

I have tried python manage.py migrate appname and it says there are no migrations to make. I've even tried deleting my database and using migrate and/or syncdb to recreate it with a clean slate. (there's currently no data in there). All to no avail.

My problem seems similar to: Django 1.7 remove field. Unknown field(s) (field) specified for Model

Community
  • 1
  • 1
ericwerfel
  • 29
  • 7
  • 1
    did you run `makemigrations` before running `migrate` ? – karthikr Feb 22 '15 at 22:00
  • yes, i did.it says no changes. – ericwerfel Feb 22 '15 at 22:10
  • at this point, i've tried so many things, and i've lost track of them. is deleting the db a good way to start w a clean slate? if so, what is the correct way to rebuild it. it seems `migrate` and `syncdb` both work. altho only syncdb prompts me to recreate the admin superuser – ericwerfel Feb 22 '15 at 22:16
  • i failed to mention i'm using django-cms 3.0. i'm beginning to believe the problem is not in the migration of my custom app, but in the migrate of cms. does this make any sense? but, again, 'no changes detected' – ericwerfel Feb 22 '15 at 22:19
  • add your app in `settings.py => INSTALLED_APPS`. Then run `python manage.py makemigrations`, then `python manage.py migrate` – itzMEonTV Feb 22 '15 at 22:25
  • try remove `migration` folder which created first and try – itzMEonTV Feb 22 '15 at 22:26
  • maybe this is a hint... if i delete the db. rebuild using syncdb. then run `makemigrations appname` it correctly lists the models to build. but if i then run `migrate appname` it prints 'Applying appname.0001_initial... FAKED'. why is it faking the migrate? – ericwerfel Feb 22 '15 at 22:28
  • @latheef. tried that, too. – ericwerfel Feb 22 '15 at 22:29

3 Answers3

1

i figured it out. the problem was with a model form importing a date field with auto_now=True.

ericwerfel
  • 29
  • 7
0

I had the same issue, following wasn't working throwing same error as above -

publication_date = models.DateTimeField(auto_now=True, null=True, blank=True)

Where as following worked fine -

publication_date = models.DateTimeField(null=True, blank=True)

Strange issue with using auto_now=True. Is this limited to version 1.7 only?

user6399774
  • 116
  • 6
-2

You should try modifying auto_now and auto_now_add with default = 'xxx'

liu
  • 37
  • 5