Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch Project.tags to django-taggit #94

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Switch Project.tags to django-taggit #94

wants to merge 4 commits into from

Conversation

taein6765
Copy link
Collaborator

@taein6765 taein6765 commented Dec 18, 2021

This commit closes #64.

@sumanthratna
Copy link
Member

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:
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[judge] Use django-taggit for tags field of Project model
2 participants