Compare commits
No commits in common. "81a4473c5b7aa51a9632445e5156d074aad92eca" and "c79dbc7cfac6806f468b7c010b51b9985e850b6e" have entirely different histories.
81a4473c5b
...
c79dbc7cfa
|
@ -20,7 +20,7 @@
|
||||||
<ul class="actions">
|
<ul class="actions">
|
||||||
{% block form_actions %}
|
{% block form_actions %}
|
||||||
{% if not is_popup %}
|
{% if not is_popup %}
|
||||||
<li><a href="{{ view.get_cancel_url }}">{% trans "Cancel" %}</a></li>
|
<li><a href="{{ view.get_success_url }}">{% trans "Cancel" %}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<li><button type="submit">{% trans "Save" %}</button>
|
<li><button type="submit">{% trans "Save" %}</button>
|
||||||
|
|
|
@ -19,9 +19,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<form method="post" action=".">{% csrf_token %}
|
<form method="post" action=".">{% csrf_token %}
|
||||||
{% block form_actions %}
|
<button type="submit">{% trans 'Delete' %}</button>
|
||||||
<button type="submit">{% trans 'Delete' %}</button>
|
<a href="{{ cancel_url }}">{% trans 'Cancel' %}</a>
|
||||||
<a href="{{ cancel_url }}">{% trans 'Cancel' %}</a>
|
|
||||||
{% endblock %}
|
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
11
gas/views.py
11
gas/views.py
|
@ -6,6 +6,7 @@ from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.db import router
|
from django.db import router
|
||||||
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseBadRequest
|
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseBadRequest
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from django.utils.encoding import force_text
|
||||||
from django.utils.html import escape, escapejs
|
from django.utils.html import escape, escapejs
|
||||||
from django.utils.text import capfirst
|
from django.utils.text import capfirst
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
@ -106,18 +107,10 @@ class GASMixin:
|
||||||
def get_success_message(self):
|
def get_success_message(self):
|
||||||
return self.success_message
|
return self.success_message
|
||||||
|
|
||||||
def get_cancel_url(self):
|
|
||||||
if self.cancel_url:
|
|
||||||
# Forcing possible reverse_lazy evaluation
|
|
||||||
url = str(self.cancel_url)
|
|
||||||
return url
|
|
||||||
else:
|
|
||||||
return self.get_success_url()
|
|
||||||
|
|
||||||
def get_continue_url(self):
|
def get_continue_url(self):
|
||||||
if self.continue_url:
|
if self.continue_url:
|
||||||
# Forcing possible reverse_lazy evaluation
|
# Forcing possible reverse_lazy evaluation
|
||||||
url = str(self.continue_url)
|
url = force_text(self.continue_url)
|
||||||
return url
|
return url
|
||||||
else:
|
else:
|
||||||
raise ImproperlyConfigured("No URL to redirect to. Provide a continue_url.")
|
raise ImproperlyConfigured("No URL to redirect to. Provide a continue_url.")
|
||||||
|
|
Loading…
Reference in New Issue