Here are the steps I would use to add a field to an existing model
without having to write your own SQL and without the risk of getting
your model code out of sync with your database table.  This code uses
the same objects in the Tutorial on 
http://www.djangoproject.com/documentation/0.96/tutorial01/.
Open up a Command Prompt window and change the drive/directory to your
project.  Then do something similar to the following:

> python manage.py dumpdata polls > polls.json
> python manage.py sqlclear polls > polls_drop.sql
> mysql -u root -p pypoll < polls_drop.sql
enter your password for the root user (change for your specific
username)

edit mysite/polls/models.py and add the field to the Poll model

> python manage.py syncdb
> python manage.py loaddata polls.json

Hope this helps.



On Sep 25, 2:41 pm, Xan <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I use django 0.96. I have a simple model and I just want to add one
> field to my existing model. How can I do that? I think that I can't do
> that without SQL code. But unfortunely I don't know it.
>
> Anyone could give me a example of SQL code for adding one field to one
> model?
>
> If I only have the solution to upgrade to django-cvs, how can I pass
> all my data from django 0.96 models to svn django models?
>
> Thanks in advance,
> Xan.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to