Django get_prep_value giving headache

15 views
Skip to first unread message

Ankush Thakur

unread,
May 17, 2016, 1:18:14 PM5/17/16
to django...@googlegroups.com
So I'm trying to re-do my personal blog in Django, and have messed up the models and all a bit. 

Here's the model file: http://pastebin.com/sFhnLkWS

Basically what happened was that at the start I had only the Post model. Then I added the Category model and put in a ForeignKey field in Post. Then while migrating, Django complained something about adding a field to an existing model and gave me two options (1 and 2). I chose to enter a default value there, and ended up typing 'Programming', thinking that would be a nice default value for my category. Of course I was an idiot and didn't realize I was supposed to enter a value for the primary key.

Now, however, when I run my tests, I get a long traceback which ends in:

ValueError: invalid literal for int() with base 10: 'Programming'

How can I undo this sin?

Regards,
Ankush Thakur
Reply all
Reply to author
Forward
0 new messages