Show More
@@ -188,20 +188,24 b' class Tag(models.Model):' | |||||
188 |
|
188 | |||
189 | return reply_count |
|
189 | return reply_count | |
190 |
|
190 | |||
191 |
def get_linked_tags(self |
|
191 | def get_linked_tags(self): | |
|
192 | tag_list = [] | |||
|
193 | self.get_linked_tags_list(tag_list) | |||
|
194 | ||||
|
195 | return tag_list | |||
|
196 | ||||
|
197 | def get_linked_tags_list(self, tag_list=[]): | |||
192 | """ |
|
198 | """ | |
193 | Returns the list of tags linked to current. The list can be got |
|
199 | Returns the list of tags linked to current. The list can be got | |
194 | through returned value or tag_list parameter |
|
200 | through returned value or tag_list parameter | |
195 | """ |
|
201 | """ | |
196 |
|
202 | |||
197 | linked_tag = self.linked |
|
203 | linked_tag = self.linked | |
198 |
|
204 | |||
199 | if linked_tag and not (linked_tag in tag_list): |
|
205 | if linked_tag and not (linked_tag in tag_list): | |
200 | tag_list.append(linked_tag) |
|
206 | tag_list.append(linked_tag) | |
201 |
|
207 | |||
202 | linked_tag.get_linked_tags(tag_list) |
|
208 | linked_tag.get_linked_tags_list(tag_list) | |
203 |
|
||||
204 | return tag_list |
|
|||
205 |
|
209 | |||
206 |
|
210 | |||
207 | class Post(models.Model): |
|
211 | class Post(models.Model): |
@@ -89,7 +89,7 b' def _new_post(request, form, thread_id=b' | |||||
89 | tag, created = Tag.objects.get_or_create(name=tag_name) |
|
89 | tag, created = Tag.objects.get_or_create(name=tag_name) | |
90 | tags.append(tag) |
|
90 | tags.append(tag) | |
91 |
|
91 | |||
92 |
|
|
92 | linked_tags = tag.get_linked_tags() | |
93 | if len(linked_tags) > 0: |
|
93 | if len(linked_tags) > 0: | |
94 | tags.extend(linked_tags) |
|
94 | tags.extend(linked_tags) | |
95 |
|
95 |
General Comments 0
You need to be logged in to leave comments.
Login now