Commit 93bcfb77da429ccd0e7c1e8a3483bc0a623266f9

Authored by Sergio Oliveira
2 parents b5bd9509 7f97cab3

Merge branch 'master' of github.com:TracyWebTech/colab

fabfile.py
... ... @@ -81,6 +81,7 @@ def deploy(update=False):
81 81 if update:
82 82 update_requirements()
83 83  
  84 + load_badges()
84 85 with cd('~/colab/src/'), prefix(WORKON_COLAB):
85 86 run('python manage.py syncdb')
86 87 run('python manage.py migrate')
... ...
src/super_archives/search_indexes.py
... ... @@ -12,12 +12,12 @@ class ThreadIndex(BaseIndex, indexes.Indexable):
12 12 title = indexes.CharField(model_attr='latest_message__subject_clean')
13 13 description = indexes.CharField(use_template=True)
14 14 latest_description = indexes.CharField(
15   - model_attr='latest_message__body',
  15 + model_attr='latest_message__description',
16 16 indexed=False,
17 17 )
18 18 created = indexes.DateTimeField()
19 19 modified = indexes.DateTimeField(
20   - model_attr='latest_message__received_time'
  20 + model_attr='latest_message__modified'
21 21 )
22 22 tag = indexes.CharField(model_attr='mailinglist__name')
23 23 collaborators = indexes.CharField(use_template=True, stored=False)
... ... @@ -33,12 +33,6 @@ class ThreadIndex(BaseIndex, indexes.Indexable):
33 33 def get_updated_field(self):
34 34 return 'latest_message__received_time'
35 35  
36   - def prepare_author(self, obj):
37   - from_address = obj.message_set.first().from_address
38   - if from_address.user:
39   - return from_address.user.username
40   - return None
41   -
42 36 def prepare_fullname(self, obj):
43 37 return obj.message_set.first().from_address.get_full_name()
44 38  
... ... @@ -52,6 +46,9 @@ class ThreadIndex(BaseIndex, indexes.Indexable):
52 46 from_address.user.username,
53 47 )
54 48  
  49 + def prepare_author(self, obj):
  50 + return obj.latest_message.author
  51 +
55 52 def prepare_author_url(self, obj):
56 53 first_message = obj.message_set.first()
57 54 if first_message.from_address.user:
... ...
src/super_archives/templates/message-preview.html
... ... @@ -11,7 +11,7 @@
11 11 {% endif %}
12 12  
13 13 {% if result.title %}
14   - <a href="{{ result.url }}" {% if result.description %}title="{{ result.description|escape|truncatechars:200 }}"{% endif %}>
  14 + <a href="{{ result.url }}" {% if result.latest_description %}title="{{ result.latest_description|escape|truncatechars:150 }}"{% elif result.description %}title="{{ result.description|escape|truncatechars:150 }}"{% endif %}>
15 15 <span class="subject">
16 16 <!-- a striptags filter was raising an error here because using with highlight -->
17 17 {% if query %}
... ... @@ -25,7 +25,16 @@
25 25  
26 26 {% if result.description %}
27 27 <!-- a striptags filter was raising an error here because using with highlight -->
28   - <span class="quiet">- {% if query %}{% highlight result.description with query max_length "150" %}{% else %}{{ result.description|truncatechars:150 }}{% endif %}</span>
  28 + <span class="quiet">- {% if query %}
  29 + {% highlight result.description with query max_length "150" %}
  30 + {% else %}
  31 + {% if result.latest_description %}
  32 + {{ result.latest_description|escape|truncatechars:150 }}
  33 + {% elif result.description %}
  34 + {{ result.description|escape|truncatechars:150 }}
  35 + {% endif %}
  36 + {% endif %}
  37 + </span>
29 38 {% endif %}
30 39  
31 40 {% if result.fullname or result.modified %}
... ...