Open lucemia opened 3 years ago
@lucemia here I guess you're suggesting that we just use a straightforward mapping of tag text to do a lookup? Seems pretty doable (with the usual caveats for custom tag types)
We have added natural keys support to the custom Tag model in the Django taggit library. This allows you to identify objects by human-readable identifiers rather than by their database ID.
python manage.py dumpdata taggit.Tag --natural-foreign --natural-primary > tags.json
python manage.py loaddata tags.json
By default tags use the name field as the natural key.
You can customize this in your own custom tag model by setting the natural_key_fields
property on your model the required fields.
Looks like
taggit
doesn't yet support loaddata / dumpdata with natural keys. https://docs.djangoproject.com/en/3.1/topics/serialization/#natural-keysIt will be great if django-taggit can add this feature.