feat(authentications): make GPA a DecimalField

this allows us to set the decimal places in the field instead of in a string format, eliminating confusion when some writes e.g. 4.500 in their profile but profile says 4.5 after save
This commit is contained in:
Shreyas Mayya 2022-02-17 10:04:13 -05:00
parent 69fb6f8ca8
commit 1c70273a1c
No known key found for this signature in database
GPG Key ID: 42522E3641BA2E31
3 changed files with 20 additions and 2 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.12 on 2022-02-17 15:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('authentication', '0012_user_preferred_name'),
]
operations = [
migrations.AlterField(
model_name='user',
name='GPA',
field=models.DecimalField(blank=True, decimal_places=3, help_text='Weighted GPA', max_digits=4, null=True),
),
]

View File

@ -8,7 +8,7 @@ class User(AbstractUser):
accepted_terms = models.BooleanField(default=False)
graduation_year = models.PositiveSmallIntegerField(null=True)
GPA = models.FloatField(null=True, blank=True, name="GPA", help_text="Weighted GPA")
GPA = models.DecimalField(null=True, blank=True, name="GPA", help_text="Weighted GPA", max_digits=4, decimal_places=3)
is_senior = models.BooleanField(default=False)
is_student = models.BooleanField(default=False)

View File

@ -49,7 +49,7 @@
{% for senior in object_list %}
<tr class="d-flex">
<td class="col-1">{{ senior }}</td>
<td class="col-1">{{ senior.GPA|stringformat:".3f" }}</td>
<td class="col-1">{{ senior.GPA }}</td>
<td class="col-3">
{# Test scores #}
<table class="table table-sm">