Show More
@@ -0,0 +1,17 b'' | |||||
|
1 | # Generated by Django 2.0 on 2017-12-14 06:33 | |||
|
2 | ||||
|
3 | from django.db import migrations | |||
|
4 | ||||
|
5 | ||||
|
6 | class Migration(migrations.Migration): | |||
|
7 | ||||
|
8 | dependencies = [ | |||
|
9 | ('boards', '0067_threadsource'), | |||
|
10 | ] | |||
|
11 | ||||
|
12 | operations = [ | |||
|
13 | migrations.AlterUniqueTogether( | |||
|
14 | name='tagalias', | |||
|
15 | unique_together={('name', 'locale')}, | |||
|
16 | ), | |||
|
17 | ] |
@@ -33,6 +33,7 b' class TagAlias(models.Model, Viewable):' | |||||
33 | class Meta: |
|
33 | class Meta: | |
34 | app_label = 'boards' |
|
34 | app_label = 'boards' | |
35 | ordering = ('name',) |
|
35 | ordering = ('name',) | |
|
36 | unique_together = ('name', 'locale') | |||
36 |
|
37 | |||
37 | objects = TagAliasManager() |
|
38 | objects = TagAliasManager() | |
38 |
|
39 | |||
@@ -42,6 +43,9 b' class TagAlias(models.Model, Viewable):' | |||||
42 | parent = models.ForeignKey('Tag', on_delete=models.CASCADE, null=True, |
|
43 | parent = models.ForeignKey('Tag', on_delete=models.CASCADE, null=True, | |
43 | blank=True, related_name='aliases') |
|
44 | blank=True, related_name='aliases') | |
44 |
|
45 | |||
|
46 | def __str__(self): | |||
|
47 | return self.name | |||
|
48 | ||||
45 |
|
49 | |||
46 | class TagManager(models.Manager): |
|
50 | class TagManager(models.Manager): | |
47 | def get_tag_url_list(self, tags: list) -> str: |
|
51 | def get_tag_url_list(self, tags: list) -> str: | |
@@ -53,7 +57,7 b' class TagManager(models.Manager):' | |||||
53 |
|
57 | |||
54 | def get_by_alias(self, alias): |
|
58 | def get_by_alias(self, alias): | |
55 | try: |
|
59 | try: | |
56 |
return self. |
|
60 | return self.filter(aliases__name__in=[alias]).first() | |
57 | except Tag.DoesNotExist: |
|
61 | except Tag.DoesNotExist: | |
58 | pass |
|
62 | pass | |
59 |
|
63 |
@@ -24,6 +24,9 b'' | |||||
24 | {% if post.tripcode %} |
|
24 | {% if post.tripcode %} | |
25 | / |
|
25 | / | |
26 | {% with tripcode=post.get_tripcode %} |
|
26 | {% with tripcode=post.get_tripcode %} | |
|
27 | {% comment %} | |||
|
28 | Move this to tripcode.get_url() and cache. | |||
|
29 | {% endcomment %} | |||
27 | <a href="{% url 'feed' %}?tripcode={{ tripcode.get_full_text }}" |
|
30 | <a href="{% url 'feed' %}?tripcode={{ tripcode.get_full_text }}" | |
28 | class="tripcode" title="{{ tripcode.get_full_text }}" |
|
31 | class="tripcode" title="{{ tripcode.get_full_text }}" | |
29 | style="border: solid 2px #{{ tripcode.get_color }}; border-left: solid 1ex #{{ tripcode.get_color }};">{{ tripcode.get_short_text }}</a> |
|
32 | style="border: solid 2px #{{ tripcode.get_color }}; border-left: solid 1ex #{{ tripcode.get_color }};">{{ tripcode.get_short_text }}</a> |
@@ -1,4 +1,4 b'' | |||||
1 | from django.shortcuts import get_object_or_404, redirect |
|
1 | from django.shortcuts import get_object_or_404, redirect, get_list_or_404 | |
2 | from django.urls import reverse |
|
2 | from django.urls import reverse | |
3 |
|
3 | |||
4 | from boards.abstracts.settingsmanager import get_settings_manager, \ |
|
4 | from boards.abstracts.settingsmanager import get_settings_manager, \ | |
@@ -42,7 +42,7 b' class TagView(AllThreadsView, Dispatcher' | |||||
42 |
|
42 | |||
43 | settings_manager = get_settings_manager(kwargs['request']) |
|
43 | settings_manager = get_settings_manager(kwargs['request']) | |
44 |
|
44 | |||
45 |
tag_alias = get_ |
|
45 | tag_alias = get_list_or_404(TagAlias, name=self.tag_name)[0] | |
46 | tag = tag_alias.parent |
|
46 | tag = tag_alias.parent | |
47 | params[PARAM_TAG] = tag |
|
47 | params[PARAM_TAG] = tag | |
48 |
|
48 |
General Comments 0
You need to be logged in to leave comments.
Login now