Implemented chosen tags by adding priority field: chosen tags should have non-null priority field, other tags should have null priority field.

This commit is contained in:
Semyon 2019-10-18 18:37:24 +03:00
parent 3bc9dd7347
commit f7facf826d
2 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 2.2.4 on 2019-10-18 15:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tag', '0002_auto_20191009_1408'),
]
operations = [
migrations.AddField(
model_name='tag',
name='priority',
field=models.IntegerField(default=None, null=True, unique=True),
),
]

View File

@ -14,6 +14,8 @@ class Tag(TranslatedFieldsMixin, models.Model):
category = models.ForeignKey('TagCategory', on_delete=models.PROTECT,
null=True, related_name='tags',
verbose_name=_('Category'))
# chosen tags should have non-null priority,other tags priority should be null
priority = models.IntegerField(unique=True, null=True, default=None)
class Meta:
"""Meta class."""