From 0d7c95a80692f15c36b36152034e3bbe54e3c37c Mon Sep 17 00:00:00 2001 From: Leon Sandøy Date: Wed, 29 Jul 2020 13:55:46 +0200 Subject: Handle unique validator in DRF, not Django. I was handling this in a Django vanilla kind of way, which was causing the constraint to return a 500 instead of a 400. This changes the approach to use the DRF way, and makes it return 400. It doesn't actually change the way anything behaves, other than returning the right status code. --- pydis_site/apps/api/migrations/0057_create_new_filterlist_model.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'pydis_site/apps/api/migrations') diff --git a/pydis_site/apps/api/migrations/0057_create_new_filterlist_model.py b/pydis_site/apps/api/migrations/0057_create_new_filterlist_model.py index 44025ee8..b5398568 100644 --- a/pydis_site/apps/api/migrations/0057_create_new_filterlist_model.py +++ b/pydis_site/apps/api/migrations/0057_create_new_filterlist_model.py @@ -25,9 +25,5 @@ class Migration(migrations.Migration): ('comment', models.TextField(help_text="Optional comment on this entry.", null=True)), ], bases=(pydis_site.apps.api.models.mixins.ModelReprMixin, models.Model), - ), - migrations.AddConstraint( - model_name='filterlist', - constraint=models.UniqueConstraint(fields=('content', 'type'), name='unique_filter_list'), ) ] -- cgit v1.2.3