Mercurial > public > sg101
comparison comments/models.py @ 743:66d46d31d543
Django 1.6: get_query_set -> get_queryset.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 29 Dec 2013 13:45:49 -0600 |
parents | ee87ea74d46b |
children | 4619290d171d |
comparison
equal
deleted
inserted
replaced
742:b77acb1b6a8a | 743:66d46d31d543 |
---|---|
19 """Manager for the Comment model class.""" | 19 """Manager for the Comment model class.""" |
20 | 20 |
21 def for_object(self, obj, filter_public=True): | 21 def for_object(self, obj, filter_public=True): |
22 """QuerySet for all comments for a particular model instance.""" | 22 """QuerySet for all comments for a particular model instance.""" |
23 ct = ContentType.objects.get_for_model(obj) | 23 ct = ContentType.objects.get_for_model(obj) |
24 qs = self.get_query_set().filter(content_type__pk=ct.id, | 24 qs = self.get_queryset().filter(content_type__pk=ct.id, |
25 object_id=obj.id) | 25 object_id=obj.id) |
26 if filter_public: | 26 if filter_public: |
27 qs = qs.filter(is_public=True) | 27 qs = qs.filter(is_public=True) |
28 return qs | 28 return qs |
29 | 29 |