Show More
@@ -0,0 +1,20 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | # Generated by Django 1.10.5 on 2017-02-27 15:38 | |||
|
3 | from __future__ import unicode_literals | |||
|
4 | ||||
|
5 | from django.db import migrations, models | |||
|
6 | ||||
|
7 | ||||
|
8 | class Migration(migrations.Migration): | |||
|
9 | ||||
|
10 | dependencies = [ | |||
|
11 | ('boards', '0059_auto_20170227_1156'), | |||
|
12 | ] | |||
|
13 | ||||
|
14 | operations = [ | |||
|
15 | migrations.AlterField( | |||
|
16 | model_name='tag', | |||
|
17 | name='name', | |||
|
18 | field=models.CharField(db_index=True, max_length=100), | |||
|
19 | ), | |||
|
20 | ] |
@@ -0,0 +1,25 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | # Generated by Django 1.10.5 on 2017-02-27 15:39 | |||
|
3 | from __future__ import unicode_literals | |||
|
4 | ||||
|
5 | from django.db import migrations, models | |||
|
6 | ||||
|
7 | ||||
|
8 | class Migration(migrations.Migration): | |||
|
9 | ||||
|
10 | dependencies = [ | |||
|
11 | ('boards', '0060_auto_20170227_1738'), | |||
|
12 | ] | |||
|
13 | ||||
|
14 | operations = [ | |||
|
15 | migrations.AlterField( | |||
|
16 | model_name='tag', | |||
|
17 | name='name', | |||
|
18 | field=models.CharField(db_index=True, max_length=100, unique=True), | |||
|
19 | ), | |||
|
20 | migrations.AlterField( | |||
|
21 | model_name='tagalias', | |||
|
22 | name='name', | |||
|
23 | field=models.CharField(db_index=True, max_length=100), | |||
|
24 | ), | |||
|
25 | ] |
@@ -25,7 +25,7 b' class TagAlias(models.Model, Viewable):' | |||||
25 | app_label = 'boards' |
|
25 | app_label = 'boards' | |
26 | ordering = ('name',) |
|
26 | ordering = ('name',) | |
27 |
|
27 | |||
28 |
name = models.CharField(max_length=100, db_index=True |
|
28 | name = models.CharField(max_length=100, db_index=True) | |
29 | locale = models.CharField(max_length=10, db_index=True) |
|
29 | locale = models.CharField(max_length=10, db_index=True) | |
30 |
|
30 | |||
31 | parent = models.ForeignKey('Tag', null=True, blank=True, |
|
31 | parent = models.ForeignKey('Tag', null=True, blank=True, | |
@@ -50,10 +50,10 b' class TagManager(models.Manager):' | |||||
50 |
|
50 | |||
51 | def get_by_alias(self, alias): |
|
51 | def get_by_alias(self, alias): | |
52 | tag = None |
|
52 | tag = None | |
53 | try: |
|
53 | aliases = TagAlias.objects.filter(name=alias).all() | |
54 | tag = TagAlias.objects.get(name=alias).parent |
|
54 | if aliases: | |
55 | except TagAlias.DoesNotExist: |
|
55 | tag = aliases[0].parent | |
56 | pass |
|
56 | ||
57 | return tag |
|
57 | return tag | |
58 |
|
58 | |||
59 |
|
59 |
General Comments 0
You need to be logged in to leave comments.
Login now