First model or QuerySet ObjectΒΆ

To get the first object from QuerySet, use the first method:

p = Article.objects.order_by('title', 'pub_date').first()

In case the QuerySet contains only a single object, you could use directly:

p = Article.first()