mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-01 15:34:53 +02:00
Fix signals bug
This commit is contained in:
parent
c01b4ea750
commit
4378816cdf
3 changed files with 4 additions and 4 deletions
|
@ -59,12 +59,12 @@ class Contact(TimeStampedModel):
|
|||
names = [n for n in [self.first_name, self.middle_name, self.last_name] if n]
|
||||
return " ".join(names) if names else "Unknown"
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
def save(self, enable_custom_save=True, *args, **kwargs):
|
||||
# Call the parent class's save method to perform the actual save
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
# Update the related User object's first_name and last_name
|
||||
if self.user:
|
||||
if self.user and enable_custom_save:
|
||||
self.user.first_name = self.first_name
|
||||
self.user.last_name = self.last_name
|
||||
self.user.save()
|
||||
|
|
|
@ -46,7 +46,7 @@ def handle_profile(sender, instance, **kwargs):
|
|||
|
||||
if len(contacts) >= 1 and is_new_user: # a matching contact
|
||||
contacts[0].user = instance
|
||||
contacts[0].save()
|
||||
contacts[0].save(enable_custom_save=False)
|
||||
|
||||
if len(contacts) > 1: # multiple matches
|
||||
logger.warning(
|
||||
|
|
|
@ -235,7 +235,7 @@ class AuditedAdminMockData:
|
|||
def dummy_contact(self, item_name, short_hand):
|
||||
"""Creates a dummy contact object"""
|
||||
contact = Contact.objects.get_or_create(
|
||||
first_name="{} first_name:{}".format(item_name + "fake_contact", short_hand),
|
||||
first_name="{} first_name:{}".format(item_name, short_hand),
|
||||
last_name="{} last_name:{}".format(item_name, short_hand),
|
||||
title="{} title:{}".format(item_name, short_hand),
|
||||
email="{}testy@town.com".format(item_name),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue