diff --git a/smash/web/forms.py b/smash/web/forms.py index 0740fd9bc48810ee9b52b17d2a569e4ab01b09e3..18f662b955b6fed1a4b19b35ffe3a63d0bd2b0b3 100644 --- a/smash/web/forms.py +++ b/smash/web/forms.py @@ -84,7 +84,7 @@ class SubjectAddForm(ModelForm): def get_prefix_screening_number(self): default_location = self.cleaned_data.get('default_location', None) screening_number_prefix = None - if default_location is not None and default_location.prefix is not None: + if default_location is not None and default_location.prefix: screening_number_prefix = default_location.prefix else: subject_type = self.cleaned_data.get('type', None) diff --git a/smash/web/migrations/0035_screening_number.py b/smash/web/migrations/0035_screening_number.py index 406772337549cb70cef84e75deb7bcde19eff850..3bf1a4e18c22356fc3a472716073dd1e28f72480 100644 --- a/smash/web/migrations/0035_screening_number.py +++ b/smash/web/migrations/0035_screening_number.py @@ -32,7 +32,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='location', name='prefix', - field=models.CharField(max_length=1, null=True), + field=models.CharField(max_length=1, blank=True), ), migrations.RunPython(add_prefixes, reverse_code=lambda x, y: None), diff --git a/smash/web/models/location.py b/smash/web/models/location.py index 1ff5bbbfc8073cbb9244cbc34c0311fae64f03a3..5720f26897115e0148138e130988a8b2cbfd9181 100644 --- a/smash/web/models/location.py +++ b/smash/web/models/location.py @@ -13,7 +13,7 @@ class Location(models.Model): blank=True, default="") - prefix = models.CharField(max_length=1, null=True) + prefix = models.CharField(max_length=1, blank=True) def __str__(self): return "%s" % self.name