Commit eb2147d94c2b2fc2da81a401cf2686288d0a3837
1 parent
eb296c52
Exists in
master
and in
39 other branches
only perform query if tags are available
Showing
1 changed file
with
5 additions
and
2 deletions
Show diff stats
src/super_archives/models.py
@@ -160,8 +160,11 @@ class Thread(models.Model): | @@ -160,8 +160,11 @@ class Thread(models.Model): | ||
160 | 160 | ||
161 | def get_related(self): | 161 | def get_related(self): |
162 | query_string = u' '.join(self.tags.names()) | 162 | query_string = u' '.join(self.tags.names()) |
163 | - query_set = SearchQuerySet().exclude(django_id=self.pk) | ||
164 | - return query_set.filter(content=query_string, type='thread') | 163 | + if query_string: |
164 | + query_set = SearchQuerySet().exclude(django_id=self.pk) | ||
165 | + return query_set.filter(content=query_string, type='thread') | ||
166 | + | ||
167 | + return tuple() | ||
165 | 168 | ||
166 | def save(self, *args, **kwargs): | 169 | def save(self, *args, **kwargs): |
167 | super(Thread, self).save(*args, **kwargs) | 170 | super(Thread, self).save(*args, **kwargs) |