Adrian Holovaty wrote: >Time and time again I have the following Django code: > > try: > obj = Person.objects.get(first_name='John', last_name='Lennon') > except Person.DoesNotExist: > obj = Person(first_name='John', last_name='Lennon', >birthday=date(1940, 10, 9)) > obj.save() > > "Me to!" :-)
So +1 on the proposal. >* I needed to get both the new object *and* a boolean specifying >whether a new object was created, so get_or_create() returns a tuple >of (new_object_created, object). > My first reaction is that it should be reversed: the "primary" returned value is an object itself and a flag is often not important so it feels like "secondary" value. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers -~----------~----~----~----~------~----~------~--~---
