> How can i best program a view that both adds and updates certain
> values in a table. I know that django can tell the difference when you
> want to update and when to insert. I tried using the
> Classname.objects.create(args)...but this doesn't seem to work...it
> just inserts instead of updating a record.
> 
> Did i misunderstand the usage of Classname.objects.create(args)?

Sounds like you're interested in the objects.get_or_create()
method which you can then update as needed.  You can then just
save the resulting object.

http://www.djangoproject.com/documentation/models/get_or_create/

And just an aside to the Django Docs folks...thanks for such
great docs!  It seems that just about every answer I've given
over the last couple months contains a direct link into the help
docs where the solution is detailed.  Sure, there are still a
couple weak areas such as "fixtures for dummies", but on the
whole, the docs are nigh sublime.

-tim




--~--~---------~--~----~------------~-------~--~----~
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