Source

dvd-collection / collection / managers.py

Full commit
1
2
3
4
5
6
7
8
9
from django.db import models

class MovieManager(models.Manager):
    use_for_related_fields = True
    def highest_rated(self):
        try:
            return self.get_query_set().filter(rating__gt=8).order_by('-rating')[0]
        except:
            return None