On Wed, 2009-08-12 at 04:55 -0700, Evgeny wrote: > Hi, > I have some fields in a model which are filled in by before_insert > trigger. > Is there any right way to autorefresh them after the object is > inserted, besides requesting a new instance of the object by > model.objects.get() method?
You have one perfectly good method and you want another one instead? :-) Seriously, use get(pk=my_obj.pk). It's designed to retrieve single instances from the database. You could do filter(id=my_obj.pk).values("field_1", "field_2", ...) but it's not going to be significantly faster unless your model has massive fields (leading to other problems) and it reads a bit less comprehensibly in the code. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---