Hi guys, I'm loooking for a way to update only one field when changing a model. I started from:
object = get_object_or_404(SomeModel) object.hits += 1 object.save() I using django1.1. I saw there is a ticket talking about this: http://code.djangoproject.com/ticket/4102 And a snippet too: http://www.djangosnippets.org/snippets/479/ But I want to know if there is a better way. I'm trying: object = get_object_or_404(SomeModel) SomeModel.objects.filter(id=object.id).update(hits=object.hits+1) object.save() This way I do what I want but, is this the better approach? Do I need to worry about performance at this point or an update method over all fields of a model aren't so bad? Best regards, --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---