Skip to content

Commit

Permalink
fix: add full_name to User model to fix social auth (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
christopappas authored Nov 15, 2023
1 parent f77f333 commit d4fcf53
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions sanctions/apps/core/migrations/0003_user_full_name.py
Original file line number Diff line number Diff line change
@@ -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'),
),
]
4 changes: 4 additions & 0 deletions sanctions/apps/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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()

Expand Down

0 comments on commit d4fcf53

Please sign in to comment.