Commit d5d1b9be4f69e768e79a4eba526ae2d90dd77be4
1 parent
3ce23e9d
Exists in
master
and in
39 other branches
Updated django to 1.7
Set in requirements Removed 'if django version' in managers.py
Showing
2 changed files
with
4 additions
and
18 deletions
Show diff stats
requirements.txt
src/super_archives/managers.py
... | ... | @@ -7,23 +7,12 @@ class NotSpamManager(models.Manager): |
7 | 7 | """Only return objects which are not marked as spam.""" |
8 | 8 | |
9 | 9 | def get_queryset(self): |
10 | - if django.VERSION < (1, 7): | |
11 | - return super(NotSpamManager, self).get_queryset().exclude(spam=True) | |
12 | - else: | |
13 | - return super(NotSpamManager, self).get_query_set().exclude(spam=True) | |
14 | - | |
15 | - if django.VERSION < (1, 7): | |
16 | - # in 1.7+, get_query_set gets defined by the base ChangeList and complains if it's called. | |
17 | - # otherwise, we have to define it ourselves. | |
18 | - get_query_set = get_queryset | |
10 | + return super(NotSpamManager, self).get_queryset().exclude(spam=True) | |
19 | 11 | |
20 | 12 | |
21 | 13 | class HighestScore(NotSpamManager): |
22 | 14 | def get_queryset(self): |
23 | - if django.VERSION < (1, 7): | |
24 | - queryset = super(HighestScore, self).get_queryset() | |
25 | - else: | |
26 | - queryset = super(HighestScore, self).get_query_set() | |
15 | + queryset = super(HighestScore, self).get_queryset() | |
27 | 16 | return queryset.order_by('-score', '-latest_message__received_time') |
28 | 17 | |
29 | 18 | def from_haystack(self): |
... | ... | @@ -35,10 +24,7 @@ class MostVotedManager(NotSpamManager): |
35 | 24 | """Query for the most voted messages sorting by the sum of |
36 | 25 | voted and after by date.""" |
37 | 26 | |
38 | - if django.VERSION < (1, 7): | |
39 | - queryset = super(MostVotedManager, self).get_queryset() | |
40 | - else: | |
41 | - queryset = super(MostVotedManager, self).get_query_set() | |
27 | + queryset = super(MostVotedManager, self).get_queryset() | |
42 | 28 | |
43 | 29 | sql = """ |
44 | 30 | SELECT | ... | ... |