mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-19 19:09:22 +02:00
updated documentation and code comments
This commit is contained in:
parent
5673889a55
commit
645c85e147
3 changed files with 18 additions and 3 deletions
|
@ -60,4 +60,7 @@ order:
|
|||
* Websites
|
||||
* DomainRequest
|
||||
* DomainInformation
|
||||
* UserDomainRole
|
||||
* UserDomainRole
|
||||
|
||||
Optional step:
|
||||
* Run fixtures to load fixture users back in
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue