mirror of
https://github.com/etnguyen03/tjdests.git
synced 2025-04-21 02:00:16 -04:00
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:
parent
69fb6f8ca8
commit
1c70273a1c
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -8,7 +8,7 @@ class User(AbstractUser):
|
||||||
accepted_terms = models.BooleanField(default=False)
|
accepted_terms = models.BooleanField(default=False)
|
||||||
graduation_year = models.PositiveSmallIntegerField(null=True)
|
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_senior = models.BooleanField(default=False)
|
||||||
is_student = models.BooleanField(default=False)
|
is_student = models.BooleanField(default=False)
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
{% for senior in object_list %}
|
{% for senior in object_list %}
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<td class="col-1">{{ senior }}</td>
|
<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">
|
<td class="col-3">
|
||||||
{# Test scores #}
|
{# Test scores #}
|
||||||
<table class="table table-sm">
|
<table class="table table-sm">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user