HackTJ / live

A massively scalable application for realtime hackathon judging and mentoring.
MIT License
5 stars 2 forks source link

Switch `Project.tags` to django-taggit #94

Open taein6765 opened 2 years ago

taein6765 commented 2 years ago

This commit closes https://github.com/HackTJ/live/issues/64.

sumanthratna commented 2 years ago

TLDR: let's come back to this later


to merge this, we need to remove the tag field from all fixtures, which I don't want to do yet.

TaggableManager isn't deserialized, I think because of this line: https://github.com/jazzband/django-taggit/blob/9d9ca4b36a09ec7b4cb0c823be9f90ff2089701e/taggit/managers.py#L441

proof that `tags` isn't deserialized in fixtures
output of: ```python poetry run python manage.py shell --command "from judge.models import Project; mod = Project.objects.create(name='apple', location='tree', description='desc', tags=['fruit', 'red']); from django.core import serializers; print(serializers.serialize('json', (mod,)))" ``` is: ``` [{"model": "judge.project", "pk": 1, "fields": {"name": "apple", "location": "tree", "description": "desc", "link": "", "overall_mean": 0.0, "overall_variance": 1.0, "innovation_mean": 0.0, "innovation_variance": 1.0, "functionality_mean": 0.0, "functionality_variance": 1.0, "design_mean": 0.0, "design_variance": 1.0, "complexity_mean": 0.0, "complexity_variance": 1.0, "numberOfVotes": 0, "timesSeen": 0, "timesSkipped": 0, "prioritize": false, "active": true}}] ```
We can still keep tag data in fixtures, but will take more work: 1. `poetry run python manage.py loaddata 'fixture.json' --ignorenonexistent` 2. `poetry run python manage.py assigntags 'fixture.json'` # we need to create this script