Is there any Django function which will let me get an object form the database, or None if nothing matches?
Right now I\'m using something like:
foo
In Django 1.6 you can use the first() Queryset method. It returns the first object matched by the queryset, or None if there is no matching object.
first()
Usage:
p = Article.objects.order_by('title', 'pub_date').first()