Refactor Tagstore models to be more django-ish [LX-227]
🚧 WIP 🚧
Python API Changes
The Tagstore python API was a bit messy because I designed it with a pluggable backend, but then we reduced it to one backend and build an API and Admin interface that assume the django backend.
This PR makes the code much easier to follow and understand by removing the backend abstraction and assuming the django implementation.
In addition, the various confusing `Tag`, `TagId`, and `TagModel`, `Entity`, `EntityId`, and `EntityModel`, `Taxonomy`, `TaxonomyModel`, `TaxonomyId` are simplified to something almost sensible:
`Entity` is the django model and `EntityId` is a [natural key](https://docs.djangoproject.com/en/2.1/topics/serialization/#natural-keys) for it.
`Tag` is the django model and `TagId` is a natural key for it.
`Taxonomy` is the django model and `TaxonomyId` is a type-safe alias for its primary key type.
Although the python API has changed significantly, there are no significant changes to any important implementation details and the relatively unmodified test suite passes as before.
REST API Changes
Changed schema generation to use [drf-yasg](https://github.com/axnsan12/drf-yasg) (recommended by DRF and maintained) instead of django-rest-swagger (unmaintained)
Removed trailing slash from URLs for consistency with Blockstore API
Added `/taxonomies` REST API for CRUD of Taxonomies and Tags
Changed Entity API to return results whether or not an Entity exists (because if an entity exists in an external system, but has no tags yet in tagstore, this allows a consistent way to get its tags)
Removed the Freeform taxonomy (we'll need to keep the LabXchange freeform tags separate from edX ones, so it's better to let the client applications manage their taxonomy.)
Expanded test suite
Run the tests, play with the API in the django admin, make sure you can use an existing database+tags with this branch without and changes to the database.
To check the REST API, run the test suite which covers it quite well, and/or explore the API yourself at http://localhost:18250/tagstore/api/v1
[x] Update the django admin
[x] Update the REST API
[ ] Update the README
[x] Rename `tagstore_rest` to `api`
[x] Fully remove FREEFORM taxonomy
[x] Add working API spec file
[ ] Set limits on all API list methods
How will we identify taxonomies when importing/exporting tag data from an Open edX instance (e.g. when exporting a course from Blockstore?) Currently Taxonomies are keyed by integer primary key only.