Commit 6961d1c2b756d254a10fcc440de4e442ce40eda3
Committed by
Sergio Oliveira
1 parent
aa04c3ec
Attributes Wiki according to Haystack.
Signed-off-by: Carolina Ramalho <carol15022@hotmail.com>
Showing
2 changed files
with
11 additions
and
5 deletions
Show diff stats
colab/proxy/trac/data_api.py
@@ -84,7 +84,8 @@ class TracDataAPI(ProxyDataAPI): | @@ -84,7 +84,8 @@ class TracDataAPI(ProxyDataAPI): | ||
84 | collaborators = [] | 84 | collaborators = [] |
85 | 85 | ||
86 | for line in wiki_dict: | 86 | for line in wiki_dict: |
87 | - wiki.name = line['name'] | 87 | + wiki.update_user(line['author']) |
88 | + wiki.title = line['name'] | ||
88 | wiki.text = line['text'] | 89 | wiki.text = line['text'] |
89 | wiki.author = line['author'] | 90 | wiki.author = line['author'] |
90 | if line['author'] not in collaborators: | 91 | if line['author'] not in collaborators: |
@@ -94,7 +95,6 @@ class TracDataAPI(ProxyDataAPI): | @@ -94,7 +95,6 @@ class TracDataAPI(ProxyDataAPI): | ||
94 | wiki.created = time.strftime('%Y-%m-%d %H:%M:%S', | 95 | wiki.created = time.strftime('%Y-%m-%d %H:%M:%S', |
95 | time.localtime(local_time)) | 96 | time.localtime(local_time)) |
96 | wiki.modified = str(timezone.now()) | 97 | wiki.modified = str(timezone.now()) |
97 | - wiki.modified_by = wiki.author | ||
98 | wiki.save() | 98 | wiki.save() |
99 | 99 | ||
100 | def dictfetchall(self, cursor): | 100 | def dictfetchall(self, cursor): |
colab/proxy/trac/models.py
@@ -7,6 +7,7 @@ from django.conf import settings | @@ -7,6 +7,7 @@ from django.conf import settings | ||
7 | 7 | ||
8 | from hitcounter.models import HitCounterModelMixin | 8 | from hitcounter.models import HitCounterModelMixin |
9 | 9 | ||
10 | +from colab.proxy.utils.models import Collaboration | ||
10 | from colab.accounts.models import User | 11 | from colab.accounts.models import User |
11 | from django.utils.translation import ugettext_lazy as _ | 12 | from django.utils.translation import ugettext_lazy as _ |
12 | 13 | ||
@@ -105,14 +106,19 @@ class Ticket(models.Model, HitCounterModelMixin): | @@ -105,14 +106,19 @@ class Ticket(models.Model, HitCounterModelMixin): | ||
105 | return None | 106 | return None |
106 | 107 | ||
107 | 108 | ||
108 | -class Wiki(models.Model, HitCounterModelMixin): | ||
109 | - name = models.TextField(primary_key=True) | 109 | +class Wiki(Collaboration, HitCounterModelMixin): |
110 | + type = "wiki" | ||
111 | + icon_name = "book" | ||
112 | + title = models.TextField(primary_key=True) | ||
110 | wiki_text = models.TextField(blank=True) | 113 | wiki_text = models.TextField(blank=True) |
111 | author = models.TextField(blank=True) | 114 | author = models.TextField(blank=True) |
112 | collaborators = models.TextField(blank=True) | 115 | collaborators = models.TextField(blank=True) |
113 | created = models.DateTimeField(blank=True, null=True) | 116 | created = models.DateTimeField(blank=True, null=True) |
114 | modified = models.DateTimeField(blank=True, null=True) | 117 | modified = models.DateTimeField(blank=True, null=True) |
115 | - modified_by = models.TextField(blank=True) | 118 | + |
119 | + @property | ||
120 | + def description(self): | ||
121 | + return u'{}\n{}'.format(self.wiki_text, self.collaborators) | ||
116 | 122 | ||
117 | class Meta: | 123 | class Meta: |
118 | verbose_name = _('Attachment') | 124 | verbose_name = _('Attachment') |