Allow setting form id or class on base_form.html
This commit is contained in:
parent
6e238b2f52
commit
68b7c5c8ae
|
@ -4,7 +4,10 @@
|
||||||
{% load form_tags %}
|
{% load form_tags %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form action="." method="POST" enctype="multipart/form-data">{% csrf_token %}
|
<form {% if form_id %} id="{{ form_id }}" {% endif %}
|
||||||
|
{% if form_class %} class="{{ form_class }}" {% endif %}
|
||||||
|
action="." method="POST"
|
||||||
|
enctype="multipart/form-data">{% csrf_token %}
|
||||||
{% if is_popup %}
|
{% if is_popup %}
|
||||||
<input type="hidden" name="_popup" value="1">
|
<input type="hidden" name="_popup" value="1">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -201,6 +201,7 @@ class GASCreateView(GASMixin, CreateView):
|
||||||
is_popup = "_popup" in self.request.GET
|
is_popup = "_popup" in self.request.GET
|
||||||
ctx.update({
|
ctx.update({
|
||||||
'is_popup': is_popup,
|
'is_popup': is_popup,
|
||||||
|
'form_id': 'main-form',
|
||||||
})
|
})
|
||||||
return ctx
|
return ctx
|
||||||
|
|
||||||
|
@ -220,6 +221,13 @@ class GASUpdateView(GASMixin, UpdateView):
|
||||||
""" Same as Django's UpdateView, defined only for completeness. """
|
""" Same as Django's UpdateView, defined only for completeness. """
|
||||||
template_name = 'gas/base_form.html'
|
template_name = 'gas/base_form.html'
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
ctx = super().get_context_data(**kwargs)
|
||||||
|
ctx.update({
|
||||||
|
'form_id': 'main-form',
|
||||||
|
})
|
||||||
|
return ctx
|
||||||
|
|
||||||
|
|
||||||
class GASDeleteView(GASMixin, DeleteView):
|
class GASDeleteView(GASMixin, DeleteView):
|
||||||
template_name = "gas/delete_confirmation.html"
|
template_name = "gas/delete_confirmation.html"
|
||||||
|
|
Loading…
Reference in New Issue