Chemical-Curation / chemcurator_django

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

Record Identifier Model #203

Closed scaduto closed 4 years ago

scaduto commented 4 years ago

Closes #177

Renamed SourceSubstanceIdentifier Model to RecordIdentifier Model and attribute source_substance to record for clarity

debboutr commented 4 years ago

the identifier and identifier_label fields need to be required in this model, the blank and null args are confusing to model fields but for me after about the 47th time reading them it finally sank in.

In [47]: RecordIdentifier.objects.create(record=r, identifier_type=it)                                                                          
Out[47]: <RecordIdentifier: RecordIdentifier object (1)>

the above will be rejected in the serializer's validation process! and will result in an error

{
            "detail": "This field is required.",
            "status": "400",
            "source": {
                "pointer": "/data/attributes/identifier"
            },
            "code": "required"
        }