Opened 10 years ago

Closed 10 years ago

#9458 closed (invalid)

Mising step after adding __unicode__ methods to models; syncdb needs to be re-run.

Reported by: Brendan_Munnelly Owned by: nobody
Component: Uncategorized Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Hi Django-ers,

Greetings from Dublin, Ireland.

After adding the unicode() method to the Poll and Choice definitions in, I called the Poll.objects.all() method again in the interpreter.

But to no effect :-(

So I:

Exited the interpreter.
Ran python syncdb
Ran python shell to restart the interpreter
Re-imported mysite.polls.models import Poll, Choice
And re-ran Poll.objects.all()

And it worked! I got the string representation and not the object.

Wey hey!

You might want to insert in your docs that syscdb needs to be re-run in order for the unicode() method to take effect.


Brendan Munnelly

Change History (1)

comment:1 Changed 10 years ago by Karen Tracey

Resolution: invalid
Status: newclosed

You don't need to run syncdb again. Syncdb is just for creating tables. You do need to restart the interpreter to get the changed model definition loaded. But that is already mentioned:

"Let's jump back into the Python interactive shell by running python shell again:"

right before the example of making sure the __unicode__ method definition worked.

Note: See TracTickets for help on using tickets.
Back to Top