Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit a verification request #508

Merged
merged 30 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bdc0dc6
Use ModelForms and ModelFormSets to support bidning form with model i…
tortila Aug 20, 2023
8bf3621
Add wizard view on /requests/{id}/edit
tortila Aug 20, 2023
02cbb61
Use instances dictionary for editing form
tortila Aug 20, 2023
64c59c7
Fix tests after renaming wizard view
tortila Aug 20, 2023
632ee41
Handle updating existing objects when saving ModelForms
tortila Aug 23, 2023
288c922
Fix Network footprint form: loading initial data, finding duplicate e…
tortila Aug 23, 2023
1da4c13
Display initial values for bulk import and services
tortila Aug 23, 2023
ec6536b
Fix bugs found by tests
tortila Aug 24, 2023
158ca4d
Render 404 when accessing /{request_id}/edit unauthorized or for non-…
tortila Aug 24, 2023
062aa93
Add missing dev dependency
tortila Aug 30, 2023
803d7a6
Only allow to edit open verification requests
tortila Aug 30, 2023
5a7d49a
Fix setting services from slugs
tortila Aug 30, 2023
57c01ae
Add admin action: request additional changes in a submitted verificat…
tortila Aug 30, 2023
cb73efc
Explicitly set status to pending review on submitted/resubmitted veri…
tortila Aug 30, 2023
66faf0a
Add TODO + link to relevant docs to fix the preview step later
tortila Sep 6, 2023
962e86b
Reorganize tests & add a basic test case for accessing edit view
tortila Sep 6, 2023
2089c01
Replace ProviderRequestConsent with extending ProviderRequest object …
tortila Sep 6, 2023
555a9ba
Add tests for accessing the edit view of a verification request
tortila Sep 6, 2023
1c63a67
WIP: add end-to-end test for updating PR using wizard form
tortila Sep 6, 2023
bfba705
Add an uber end-to-end test for updating PR using the wizard form
tortila Sep 6, 2023
484ccf1
Rename ProviderRequest status open -> more info required
tortila Sep 6, 2023
440a24a
Graceful handling of the edit view when subresources of a ProviderReq…
tortila Sep 6, 2023
91bafb4
Build instance_dict for ProviderRequestWizardView once and inject it …
tortila Sep 7, 2023
b2ea0fe
🙏 Fix the preview rendering for ModelFormSets
tortila Sep 7, 2023
396f397
Fix deleting forms
tortila Sep 20, 2023
ac184f9
Fix preview: correct number of forms in a formset
tortila Sep 21, 2023
f20edf0
Deduplicate code for processing formsets
tortila Sep 21, 2023
f14318f
Fix test for overriding modelformset data
tortila Sep 21, 2023
926b589
Update Pipfile.lock to keep the build green
tortila Sep 21, 2023
45860e8
Add merge migration
tortila Sep 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ sphinxcontrib-mermaid = "*"
furo = "==2022.4.7"
myst-parser = "==0.18.0"
ansible-lint = "*"
django-browser-reload = "*"

[packages]
django = { extras = ["bcrypt"], version = "~=3.2" }
Expand Down Expand Up @@ -85,10 +86,10 @@ python-dateutil = "*"
geoip2 = "*"
iso3166 = "*"
django-logentry-admin = "*"
pandas = "*"
pandas = "~=2.0.3"
rich = "*"
duckdb = "*"
numpy = "*"
numpy = "~=1.24.4"
dateutils = "*"
freezegun = "*"
django-filter = "*"
Expand Down
11 changes: 9 additions & 2 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 21 additions & 13 deletions apps/accounts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
ProviderRequestIPRange,
ProviderRequestLocation,
ProviderRequestEvidence,
ProviderRequestConsent,
ProviderRequestStatus,
Service,
)
Expand Down Expand Up @@ -1314,16 +1313,6 @@ class ProviderRequestLocationInline(AdminOnlyTabularInline):
extra = 0


class ProviderRequestConsentInline(AdminOnlyTabularInline):
model = ProviderRequestConsent
extra = 0
max_num = 1
readonly_fields = (
"data_processing_opt_in",
"newsletter_opt_in",
)


class ActionInChangeFormMixin(object):
"""
Adds custom admin actions
Expand Down Expand Up @@ -1367,7 +1356,6 @@ class ProviderRequest(ActionInChangeFormMixin, admin.ModelAdmin):
ProviderRequestEvidenceInline,
ProviderRequestIPRangeInline,
ProviderRequestASNInline,
ProviderRequestConsentInline,
]
formfield_overrides = {TaggableManager: {"widget": LabelWidget(model=Service)}}
empty_value_display = "(empty)"
Expand All @@ -1380,8 +1368,10 @@ class ProviderRequest(ActionInChangeFormMixin, admin.ModelAdmin):
"location_import_required",
"network_import_required",
"missing_network_explanation",
"newsletter_opt_in",
"data_processing_opt_in",
)
actions = ["mark_approved", "mark_rejected", "mark_removed"]
actions = ["mark_approved", "mark_open", "mark_rejected", "mark_removed"]
change_form_template = "admin/provider_request/change_form.html"

def send_approval_email(self, provider_request, request):
Expand Down Expand Up @@ -1484,3 +1474,21 @@ def mark_removed(self, request, queryset):
"""
)
self.message_user(request, message=message, level=messages.SUCCESS)

@admin.action(description="Request changes", permissions=["change"])
def mark_open(self, request, queryset):
for provider_request in queryset:
provider_request.status = ProviderRequestStatus.OPEN.value
provider_request.save()

message = mark_safe(
f"""
Request id <em>{provider_request.id}</em> for provider: \
<em>{provider_request.name}</em> has changed the status to OPEN,
making it available for editing and re-submitting.

They creator of this request has <em>not</em> been contacted yet -
you will need to contact them if appropriate.
"""
)
self.message_user(request, message=message, level=messages.SUCCESS)
Loading
Loading