> from django.core.exceptions import ObjectDoesNotExist txbut... >sigh< I was hoping to head that off - Python's condescending attitude is in fact the core of the problem.
Even if you wrap all your try: except: up in a method, so it's at least DRY, is you must consign that method to use .get(). So to squeeze my attempt into one line, we get foo = (list(Foo.objects.filter(name='bar')) + [Foo()])[0], which is way too much typing. Doesn't anyone in Django-land have experience with the platforms that make this problem incredibly easy? -- Phlip -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.