mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 11:16:07 +02:00
Delete functionality
This commit is contained in:
parent
5ebae382ed
commit
403bfb6433
5 changed files with 51 additions and 27 deletions
|
@ -138,6 +138,11 @@ urlpatterns = [
|
|||
views.DomainInvitationDeleteView.as_view(http_method_names=["post"]),
|
||||
name="invitation-delete",
|
||||
),
|
||||
path(
|
||||
"application/<int:pk>/delete",
|
||||
views.DomainApplicationDeleteView.as_view(http_method_names=["post"]),
|
||||
name="application-delete",
|
||||
),
|
||||
]
|
||||
|
||||
# we normally would guard these with `if settings.DEBUG` but tests run with
|
||||
|
|
|
@ -141,10 +141,6 @@
|
|||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'application-status' application.pk %}">
|
||||
|
||||
Delete
|
||||
</a>
|
||||
<a
|
||||
id="button-toggle-delete-domain-alert-{{ forloop.counter }}"
|
||||
href="#toggle-delete-domain-alert-{{ forloop.counter }}"
|
||||
|
@ -165,9 +161,9 @@
|
|||
aria-describedby="User will be removed"
|
||||
data-force-action
|
||||
>
|
||||
<form method="POST" action="{% url "domain-user-delete" pk=domain.id user_pk=permission.user.id %}">
|
||||
{% with heading="Are you sure you want to remove <"|add:permission.user.email|add:">?" %}
|
||||
{% include 'includes/modal.html' with modal_heading=heading modal_description="<"|add:permission.user.email|add:"> will no longer be able to manage the domain "|add:domain.name|add:"." modal_button=modal_button|safe %}
|
||||
<form method="POST" action="{% url "application-delete" pk=application.id %}">
|
||||
{% with heading="Are you sure you want to delete "|add:application.requested_domain.name|add:"?" %}
|
||||
{% include 'includes/modal.html' with modal_heading=heading modal_description="This will remove the domain request from the .gov registrar. This action cannot be undone." modal_button=modal_button|safe %}
|
||||
{% endwith %}
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -12,6 +12,7 @@ from registrar.forms import application_wizard as forms
|
|||
from registrar.models import DomainApplication
|
||||
from registrar.utility import StrEnum
|
||||
from registrar.views.utility import StepsHelper
|
||||
from registrar.views.utility.permission_views import DomainApplicationPermissionDeleteView
|
||||
|
||||
from .utility import (
|
||||
DomainApplicationPermissionView,
|
||||
|
@ -572,3 +573,10 @@ class ApplicationWithdrawn(DomainApplicationPermissionWithdrawView):
|
|||
application.withdraw()
|
||||
application.save()
|
||||
return HttpResponseRedirect(reverse("home"))
|
||||
|
||||
|
||||
class DomainApplicationDeleteView(DomainApplicationPermissionDeleteView):
|
||||
object: DomainApplication # workaround for type mismatch in DeleteView
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse("home")
|
|
@ -18,4 +18,11 @@ def index(request):
|
|||
domains = Domain.objects.filter(id__in=domain_ids)
|
||||
|
||||
context["domains"] = domains
|
||||
modal_button = (
|
||||
'<button type="submit" '
|
||||
'class="usa-button usa-button--secondary" '
|
||||
'name="delete-application">Yes, delete request</button>'
|
||||
)
|
||||
|
||||
context["modal_button"] = modal_button
|
||||
return render(request, "home.html", context)
|
||||
|
|
|
@ -122,3 +122,11 @@ class DomainInvitationPermissionDeleteView(DomainInvitationPermission, DeleteVie
|
|||
|
||||
model = DomainInvitation
|
||||
object: DomainInvitation # workaround for type mismatch in DeleteView
|
||||
|
||||
|
||||
class DomainApplicationPermissionDeleteView(DomainApplicationPermission, DeleteView, abc.ABC):
|
||||
|
||||
"""Abstract view for deleting a DomainApplication."""
|
||||
|
||||
model = DomainApplication
|
||||
object: DomainApplication
|
Loading…
Add table
Add a link
Reference in a new issue