diff --git a/sanctions/apps/core/migrations/0003_user_full_name.py b/sanctions/apps/core/migrations/0003_user_full_name.py new file mode 100644 index 0000000..d63c9ad --- /dev/null +++ b/sanctions/apps/core/migrations/0003_user_full_name.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.22 on 2023-11-15 21:13 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0002_auto_20231018_1919'), + ] + + operations = [ + migrations.AddField( + model_name='user', + name='full_name', + field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Full Name'), + ), + ] diff --git a/sanctions/apps/core/models.py b/sanctions/apps/core/models.py index 39b8c27..928689e 100644 --- a/sanctions/apps/core/models.py +++ b/sanctions/apps/core/models.py @@ -14,6 +14,7 @@ class User(AbstractUser): .. pii_retirement: local_api """ + full_name = models.CharField(_('Full Name'), max_length=255, blank=True, null=True) lms_user_id = models.IntegerField(null=True, db_index=True) username = models.CharField(max_length=255, blank=True, db_index=True) @@ -31,6 +32,9 @@ def access_token(self): class Meta: get_latest_by = 'date_joined' + def get_full_name(self): + return self.full_name or super().get_full_name() + def get_username(self): return self.username or super().get_username()