fix(profile): use isinstance instead of type

This commit is contained in:
Ethan Nguyen 2021-11-18 14:30:41 -06:00
parent 23cda5d64d
commit 5d4613b44f
No known key found for this signature in database
GPG Key ID: B4CA5339AF911920

View File

@ -28,7 +28,7 @@ class ProfilePublishForm(forms.ModelForm):
# Check the GPA: 0.0 <= GPA <= 5.0 # Check the GPA: 0.0 <= GPA <= 5.0
if cleaned_data.get("GPA"): if cleaned_data.get("GPA"):
gpa = cleaned_data.get("GPA") gpa = cleaned_data.get("GPA")
assert type(gpa) is float assert isinstance(gpa, float)
if not 0.0 <= gpa <= 5.0: if not 0.0 <= gpa <= 5.0:
self.add_error("GPA", "This is not a valid GPA") self.add_error("GPA", "This is not a valid GPA")