From 09c343170959aab8f0465cde40308a7deb370b60 Mon Sep 17 00:00:00 2001 From: Jonas Lehmann Date: Mon, 6 May 2024 16:07:05 +0200 Subject: [PATCH] feat(category): add the sort property on the category model --- .../core/migrations/0017_category_sort.py | 18 ++++++++++++++++++ alexandria/core/models.py | 1 + alexandria/core/serializers.py | 1 + 3 files changed, 20 insertions(+) create mode 100644 alexandria/core/migrations/0017_category_sort.py diff --git a/alexandria/core/migrations/0017_category_sort.py b/alexandria/core/migrations/0017_category_sort.py new file mode 100644 index 00000000..ed25241c --- /dev/null +++ b/alexandria/core/migrations/0017_category_sort.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.25 on 2024-05-06 13:44 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('alexandria_core', '0016_category_allowed_mime_types'), + ] + + operations = [ + migrations.AddField( + model_name='category', + name='sort', + field=models.IntegerField(blank=True, null=True), + ), + ] diff --git a/alexandria/core/models.py b/alexandria/core/models.py index a867083c..a7261e27 100644 --- a/alexandria/core/models.py +++ b/alexandria/core/models.py @@ -117,6 +117,7 @@ class Category(SlugModel): null=True, related_name="children", ) + sort = models.IntegerField(blank=True, null=True) class TagSynonymGroup(BaseModel): diff --git a/alexandria/core/serializers.py b/alexandria/core/serializers.py index 7abccc7a..03d7168b 100644 --- a/alexandria/core/serializers.py +++ b/alexandria/core/serializers.py @@ -118,6 +118,7 @@ class Meta: "color", "parent", "children", + "sort", )