Skip to content

Commit

Permalink
Merge pull request #190 from zediious/register-nopresave
Browse files Browse the repository at this point in the history
Do not attempt to update user slug if user does not exist
  • Loading branch information
zediious authored Jun 16, 2024
2 parents c496f2c + 165dad0 commit 46125d7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions raptorWeb/authprofiles/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,11 @@ def pre_save_raptor_user(sender, instance, *args, **kwargs):
If a Raptoruser's Username is changed, update their User Slug to a slufigied
version of the new username
"""
if instance.username != RaptorUser.objects.get(pk=instance.pk).username:
instance.user_slug = slugify(instance.username)


try:
changed_user = RaptorUser.objects.get(pk=instance.pk)
if instance.username != changed_user.username:
instance.user_slug = slugify(instance.username)

except RaptorUser.DoesNotExist:
pass

0 comments on commit 46125d7

Please sign in to comment.