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:
parent
3bc9dd7347
commit
f7facf826d
18
apps/tag/migrations/0003_tag_priority.py
Normal file
18
apps/tag/migrations/0003_tag_priority.py
Normal 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),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -14,6 +14,8 @@ class Tag(TranslatedFieldsMixin, models.Model):
|
||||||
category = models.ForeignKey('TagCategory', on_delete=models.PROTECT,
|
category = models.ForeignKey('TagCategory', on_delete=models.PROTECT,
|
||||||
null=True, related_name='tags',
|
null=True, related_name='tags',
|
||||||
verbose_name=_('Category'))
|
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:
|
class Meta:
|
||||||
"""Meta class."""
|
"""Meta class."""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user