Show More
@@ -4,7 +4,7 b' import re' | |||||
4 | from boards.models.attachment import FILE_TYPES_IMAGE |
|
4 | from boards.models.attachment import FILE_TYPES_IMAGE | |
5 | from django.template.loader import render_to_string |
|
5 | from django.template.loader import render_to_string | |
6 | from django.db import models |
|
6 | from django.db import models | |
7 | from django.db.models import Count |
|
7 | from django.db.models import Count, Q | |
8 | from django.core.urlresolvers import reverse |
|
8 | from django.core.urlresolvers import reverse | |
9 | from django.utils.translation import get_language |
|
9 | from django.utils.translation import get_language | |
10 |
|
10 | |||
@@ -130,14 +130,19 b' class Tag(models.Model, Viewable):' | |||||
130 | def get_view(self): |
|
130 | def get_view(self): | |
131 | locale = get_language() |
|
131 | locale = get_language() | |
132 |
|
132 | |||
133 | try: |
|
133 | aliases = self.aliases.filter(Q(locale=locale) | Q(locale=DEFAULT_LOCALE)) | |
134 | localized_tag_name = self.aliases.get(locale=locale).name |
|
134 | ||
135 | except TagAlias.DoesNotExist: |
|
135 | localized_tag_name = None | |
136 |
|
|
136 | default_tag_name = None | |
137 |
|
137 | |||
138 | default_name = self.get_name() |
|
138 | for alias in aliases: | |
|
139 | if alias.locale == locale: | |||
|
140 | localized_tag_name = alias.name | |||
|
141 | elif alias.locale == DEFAULT_LOCALE: | |||
|
142 | default_tag_name = alias.name | |||
139 |
|
143 | |||
140 |
name = '{} ({})'.format(default_name, localized_tag_name) |
|
144 | name = '{} ({})'.format(default_tag_name, localized_tag_name) \ | |
|
145 | if localized_tag_name else default_tag_name | |||
141 | link = '<a class="tag" href="{}">{}</a>'.format( |
|
146 | link = '<a class="tag" href="{}">{}</a>'.format( | |
142 | self.get_absolute_url(), name) |
|
147 | self.get_absolute_url(), name) | |
143 | if self.is_required(): |
|
148 | if self.is_required(): |
General Comments 0
You need to be logged in to leave comments.
Login now