diff --git a/hacktj_live/settings.py b/hacktj_live/settings.py index 1c23973..26726e1 100644 --- a/hacktj_live/settings.py +++ b/hacktj_live/settings.py @@ -81,6 +81,7 @@ "dbbackup", # django-dbbackup "debug_toolbar", "captcha", + "taggit", "allauth", "allauth.account", "allauth.socialaccount", diff --git a/judge/migrations/0008_remove_project_tags_project_tags.py b/judge/migrations/0008_remove_project_tags_project_tags.py new file mode 100644 index 0000000..220dc07 --- /dev/null +++ b/judge/migrations/0008_remove_project_tags_project_tags.py @@ -0,0 +1,29 @@ +# Generated by Django 4.0 on 2021-12-18 19:28 + +from django.db import migrations +import taggit.managers + + +class Migration(migrations.Migration): + + dependencies = [ + ("taggit", "0003_taggeditem_add_unique_index"), + ("judge", "0007_alter_annotator_current_alter_annotator_ignore_and_more"), + ] + + operations = [ + migrations.RemoveField( + model_name="project", + name="tags", + ), + migrations.AddField( + model_name="project", + name="tags", + field=taggit.managers.TaggableManager( + help_text="A comma-separated list of tags.", + through="taggit.TaggedItem", + to="taggit.Tag", + verbose_name="Tags", + ), + ), + ] diff --git a/judge/models.py b/judge/models.py index 4acc066..0ae69ff 100644 --- a/judge/models.py +++ b/judge/models.py @@ -1,7 +1,7 @@ from datetime import datetime from django.db import models from django.conf import settings -from django.contrib.postgres.fields import ArrayField +from taggit.managers import TaggableManager from django.utils.translation import gettext_lazy num_criteria = len(settings.LIVE_JUDGE_CRITERIA) @@ -11,7 +11,7 @@ class Project(models.Model): name = models.CharField(max_length=255) location = models.CharField(max_length=255) description = models.CharField(max_length=255) - tags = ArrayField(models.CharField(max_length=255), default=list) + tags = TaggableManager() link = models.URLField(blank=True) overall_mean = models.DecimalField(default=0.0, decimal_places=8, max_digits=12) diff --git a/poetry.lock b/poetry.lock index 4aaac92..be537a1 100644 --- a/poetry.lock +++ b/poetry.lock @@ -506,6 +506,17 @@ six = ">=1.2.0" [package.extras] test = ["testfixtures"] +[[package]] +name = "django-taggit" +version = "2.0.0" +description = "django-taggit is a reusable Django application for simple tagging." +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +Django = ">=2.2" + [[package]] name = "filelock" version = "3.4.2" @@ -1243,7 +1254,7 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"] [metadata] lock-version = "1.1" python-versions = ">=3.8,<4.0" -content-hash = "adb2246b097021d8325cc72720a6ef64b2933a15cf40a6894ea07ddcb593ca40" +content-hash = "761f145025bb7202b5c054203ea305745f7f28a53d827e08c345e3554106c009" [metadata.files] aioredis = [ @@ -1539,6 +1550,10 @@ django-simple-captcha = [ {file = "django-simple-captcha-0.5.14.zip", hash = "sha256:84b5c188e6ae50e9ecec5e5d734c5bc4d2a50fbbca7f59d2c12da9a3bbee5051"}, {file = "django_simple_captcha-0.5.14-py3.7.egg", hash = "sha256:1bb2c842bde3ae0e23ce3c84b2f07f608b660c8d18201b0812571bccf38cf867"}, ] +django-taggit = [ + {file = "django-taggit-2.0.0.tar.gz", hash = "sha256:a23ca776ee2709b455c3a95625be1e4b891ddf1ffb4173153c41806de4038d72"}, + {file = "django_taggit-2.0.0-py3-none-any.whl", hash = "sha256:72d8f3b8e452e64d5c230b89e802d9aedc378882206ebb871d7ad1fbd0369c2b"}, +] filelock = [ {file = "filelock-3.4.2-py3-none-any.whl", hash = "sha256:cf0fc6a2f8d26bd900f19bf33915ca70ba4dd8c56903eeb14e1e7a2fd7590146"}, {file = "filelock-3.4.2.tar.gz", hash = "sha256:38b4f4c989f9d06d44524df1b24bd19e167d851f19b50bf3e3559952dddc5b80"}, diff --git a/pyproject.toml b/pyproject.toml index de2b132..74d5716 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,7 @@ dealer = "^2.1.0" prettytable = "^2.0.0" django-sendgrid-v5 = "^1.1.1" pymemcache = "^3.4.1" +django-taggit = "^2.0.0" [tool.poetry.dev-dependencies] black = "^21.12b0"