Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Crispify account delete form

Roland19d00a4b296e
diff --git a/wger/core/forms.py b/wger/core/forms.py
index 96eee3d86..962fe00ed 100644
--- a/wger/core/forms.py
+++ b/wger/core/forms.py
@@ -189,6 +189,11 @@ class PasswordConfirmationForm(Form):
def __init__(self, user, data=None):
self.user = user
super(PasswordConfirmationForm, self).__init__(data=data)
+ self.helper = FormHelper()
+ self.helper.layout = Layout(
+ 'password',
+ ButtonHolder(Submit('submit', _("Delete"), css_class='btn-danger btn-block'))
+ )
def clean_password(self):
'''
@@ -200,6 +205,7 @@ class PasswordConfirmationForm(Form):
return self.cleaned_data.get("password")
+
class RegistrationForm(UserCreationForm, UserEmailForm):
'''
Registration form
diff --git a/wger/core/templates/user/delete_account.html b/wger/core/templates/user/delete_account.html
index bd311e737..9285fac6c 100644
--- a/wger/core/templates/user/delete_account.html
+++ b/wger/core/templates/user/delete_account.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-{% load i18n static wger_extras %}
+{% load i18n static wger_extras crispy_forms_tags %}
{% block title %}{% trans "Delete account" %}{% endblock %}
@@ -9,26 +9,23 @@
{% block content %}
-<form action="{{form_action}}"
- method="post"
- class="wger-form"
- role="form">
- <div class="panel panel-danger">
- <div class="panel-heading">
- <h4 class="panel-title">{% trans "Are you sure?" %}</h4>
+<div class="wger-form">
+ <div class="card bg-light">
+ <div class="card-header">
+ <h4 class="card-title">
+ <span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
+ {% trans "Are you sure?" %}
+ </h4>
</div>
- <div class="panel-body">
+ <div class="card-body">
{% with username=user_delete|format_username %}
- <p>{% blocktrans %}This action will delete the user account "{{username}}".
+ <p class="card-text">{% blocktrans %}This action will delete the user account "{{username}}".
It will also irrevocably remove all the data associated with it (workouts, logs, etc.)
and can't be undone. {% endblocktrans %}{% endwith %}</p>
-
- {% render_form_fields form 'tmp' False %}
- {% render_form_submit 'Delete' 'danger' %}
</div>
</div>
-</form>
-
+ {% crispy form %}
+</div>
{% endblock %}
diff --git a/wger/core/urls.py b/wger/core/urls.py
index 79a52166f..fc3797cb7 100644
--- a/wger/core/urls.py
+++ b/wger/core/urls.py
@@ -21,7 +21,6 @@ from django.conf.urls import (
url
)
from django.contrib.auth import views
-from django.urls import reverse_lazy
from django.views.generic import TemplateView
# wger