diff --git a/docs/operations/import_export.md b/docs/operations/import_export.md index e04a79cd2..7c3ee1159 100644 --- a/docs/operations/import_export.md +++ b/docs/operations/import_export.md @@ -60,4 +60,7 @@ order: * Websites * DomainRequest * DomainInformation -* UserDomainRole \ No newline at end of file +* UserDomainRole + +Optional step: +* Run fixtures to load fixture users back in \ No newline at end of file diff --git a/src/registrar/admin.py b/src/registrar/admin.py index ae6e02c28..49574496d 100644 --- a/src/registrar/admin.py +++ b/src/registrar/admin.py @@ -80,6 +80,7 @@ class FsmModelResource(resources.ModelResource): class UserResource(resources.ModelResource): + """defines how each field in the referenced model should be mapped to the corresponding fields in the import/export file""" class Meta: model = models.User @@ -758,6 +759,7 @@ class HostIPInline(admin.StackedInline): class HostResource(resources.ModelResource): + """defines how each field in the referenced model should be mapped to the corresponding fields in the import/export file""" class Meta: model = models.Host @@ -774,6 +776,7 @@ class MyHostAdmin(AuditedAdmin, ImportExportModelAdmin): class HostIpResource(resources.ModelResource): + """defines how each field in the referenced model should be mapped to the corresponding fields in the import/export file""" class Meta: model = models.HostIP @@ -787,6 +790,7 @@ class HostIpAdmin(AuditedAdmin, ImportExportModelAdmin): class ContactResource(resources.ModelResource): + """defines how each field in the referenced model should be mapped to the corresponding fields in the import/export file""" class Meta: model = models.Contact @@ -918,6 +922,7 @@ class ContactAdmin(ListHeaderAdmin, ImportExportModelAdmin): class WebsiteResource(resources.ModelResource): + """defines how each field in the referenced model should be mapped to the corresponding fields in the import/export file""" class Meta: model = models.Website @@ -976,6 +981,7 @@ class WebsiteAdmin(ListHeaderAdmin, ImportExportModelAdmin): class UserDomainRoleResource(resources.ModelResource): + """defines how each field in the referenced model should be mapped to the corresponding fields in the import/export file""" class Meta: model = models.UserDomainRole @@ -1067,6 +1073,7 @@ class DomainInvitationAdmin(ListHeaderAdmin): class DomainInformationResource(resources.ModelResource): + """defines how each field in the referenced model should be mapped to the corresponding fields in the import/export file""" class Meta: model = models.DomainInformation @@ -1208,6 +1215,7 @@ class DomainInformationAdmin(ListHeaderAdmin, ImportExportModelAdmin): class DomainRequestResource(FsmModelResource): + """defines how each field in the referenced model should be mapped to the corresponding fields in the import/export file""" class Meta: model = models.DomainRequest @@ -1761,6 +1769,7 @@ class DomainInformationInline(admin.StackedInline): class DomainResource(FsmModelResource): + """defines how each field in the referenced model should be mapped to the corresponding fields in the import/export file""" class Meta: model = models.Domain @@ -2166,6 +2175,7 @@ class DomainAdmin(ListHeaderAdmin, ImportExportModelAdmin): class DraftDomainResource(resources.ModelResource): + """defines how each field in the referenced model should be mapped to the corresponding fields in the import/export file""" class Meta: model = models.DraftDomain diff --git a/src/registrar/models/utility/generic_helper.py b/src/registrar/models/utility/generic_helper.py index 7d3586770..0befd6627 100644 --- a/src/registrar/models/utility/generic_helper.py +++ b/src/registrar/models/utility/generic_helper.py @@ -100,7 +100,7 @@ class CreateOrUpdateOrganizationTypeHelper: # Update the field self._update_fields(organization_type_needs_update, generic_org_type_needs_update) - def _handle_existing_instance(self, force_update_when_no_are_changes_found=False): + def _handle_existing_instance(self, force_update_when_no_changes_are_found=False): # == Init variables == # try: # Instance is already in the database, fetch its current state @@ -119,7 +119,7 @@ class CreateOrUpdateOrganizationTypeHelper: raise ValueError("Cannot update organization_type and generic_org_type simultaneously.") elif not organization_type_changed and (not generic_org_type_changed and not is_election_board_changed): # No changes found - if force_update_when_no_are_changes_found: + if force_update_when_no_changes_are_found: # If we want to force an update anyway, we can treat this record like # its a new one in that we check for "None" values rather than changes. self._handle_new_instance() @@ -132,6 +132,8 @@ class CreateOrUpdateOrganizationTypeHelper: # Update the field self._update_fields(organization_type_needs_update, generic_org_type_needs_update) except self.sender.DoesNotExist: + # this exception should only be raised when import_export utility attempts to import + # a new row and already has an id pass def _update_fields(self, organization_type_needs_update, generic_org_type_needs_update):