mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-23 04:49:23 +02:00
Merge pull request #2572 from cisagov/dk/979-org-name-address-bug
Issue #979: Organization name and mailing address changes not updating log entries
This commit is contained in:
commit
2ebeb148fb
1 changed files with 16 additions and 2 deletions
|
@ -539,8 +539,7 @@ class DomainOrgNameAddressForm(forms.ModelForm):
|
||||||
elif self.is_tribal and not self._field_unchanged("organization_name"):
|
elif self.is_tribal and not self._field_unchanged("organization_name"):
|
||||||
raise ValueError("organization_name cannot be modified when the generic_org_type is tribal")
|
raise ValueError("organization_name cannot be modified when the generic_org_type is tribal")
|
||||||
|
|
||||||
else:
|
super().save()
|
||||||
super().save()
|
|
||||||
|
|
||||||
def _field_unchanged(self, field_name) -> bool:
|
def _field_unchanged(self, field_name) -> bool:
|
||||||
"""
|
"""
|
||||||
|
@ -552,6 +551,21 @@ class DomainOrgNameAddressForm(forms.ModelForm):
|
||||||
"""
|
"""
|
||||||
old_value = self.initial.get(field_name, None)
|
old_value = self.initial.get(field_name, None)
|
||||||
new_value = self.cleaned_data.get(field_name, None)
|
new_value = self.cleaned_data.get(field_name, None)
|
||||||
|
|
||||||
|
field = self.fields[field_name]
|
||||||
|
|
||||||
|
# Check if the field has a queryset attribute before accessing it
|
||||||
|
if hasattr(field, "queryset") and isinstance(new_value, str):
|
||||||
|
try:
|
||||||
|
# Convert the string to the corresponding ID
|
||||||
|
new_value = field.queryset.get(name=new_value).id
|
||||||
|
except field.queryset.model.DoesNotExist:
|
||||||
|
pass # Handle the case where the object does not exist
|
||||||
|
|
||||||
|
elif hasattr(new_value, "id"):
|
||||||
|
# If new_value is a model instance, compare by ID.
|
||||||
|
new_value = new_value.id
|
||||||
|
|
||||||
return old_value == new_value
|
return old_value == new_value
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue