Chemical-Curation / chemcurator_django

Backend services for chemical curation
https://api.chemreg.epa.gov
MIT License
1 stars 0 forks source link

#198 add UniqueConstraint on model and UniqueTogether constraint on s… #227

Closed debboutr closed 3 years ago

debboutr commented 3 years ago

closes #198

I've added a constraint on the model and on the serializer for records. This led to migrations that needed to get the

base_manage_name = "objects"

out of the CommonInfo model, which is what sparks the migrations in all of the apps.

We will likely also want to remove the

ordering = ["pk"]

out of CommonInfo as well, but for the moment we will get warnings in tests without it.

chemreg/substance/tests/test_views.py::test_substance_list
  /home/rick/anaconda3/envs/reg/lib/python3.8/site-packages/rest_framework/pagination.py:200: UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list: <class 'chemreg.substance.models.Substance'> QuerySet.

This will have to be removed if there is need to order models differently later.

! Also, I updated requirements.txt cause I was having problems linting with the new flake8 package