mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-12-18 14:32:19 +00:00
More form layout chnages for Django v5
This commit is contained in:
parent
cfc7a4b9f6
commit
1d3b8d44b4
@ -64,7 +64,7 @@ class CaveForm(ModelForm):
|
|||||||
# widget=forms.TextInput(attrs={"placeholder": "see example below"})
|
# widget=forms.TextInput(attrs={"placeholder": "see example below"})
|
||||||
# )
|
# )
|
||||||
kataster_code = forms.CharField(required=False,
|
kataster_code = forms.CharField(required=False,
|
||||||
label = "Kataster code, see below",
|
label = "Kataster code, see bottom of page",
|
||||||
widget=forms.TextInput(attrs={"placeholder": "see example below"})
|
widget=forms.TextInput(attrs={"placeholder": "see example below"})
|
||||||
)
|
)
|
||||||
# underground_centre_line = forms.CharField(
|
# underground_centre_line = forms.CharField(
|
||||||
@ -87,7 +87,7 @@ class CaveForm(ModelForm):
|
|||||||
length = forms.CharField(required=False, label="Length (m)", widget=forms.TextInput(attrs={"placeholder": "usually blank"}))
|
length = forms.CharField(required=False, label="Length (m)", widget=forms.TextInput(attrs={"placeholder": "usually blank"}))
|
||||||
depth = forms.CharField(required=False, label="Depth (m)", widget=forms.TextInput(attrs={"placeholder": "usually blank"}))
|
depth = forms.CharField(required=False, label="Depth (m)", widget=forms.TextInput(attrs={"placeholder": "usually blank"}))
|
||||||
extent = forms.CharField(required=False, label="Extent (m)", widget=forms.TextInput(attrs={"placeholder": "usually blank"}))
|
extent = forms.CharField(required=False, label="Extent (m)", widget=forms.TextInput(attrs={"placeholder": "usually blank"}))
|
||||||
subarea = forms.CharField(required=False, label="Subarea", widget=forms.TextInput(attrs={"placeholder": "usually blank, archaic"}))
|
subarea = forms.CharField(required=False, label="Subarea (do not use for new caves)", widget=forms.TextInput(attrs={"placeholder": "usually blank, archaic"}))
|
||||||
|
|
||||||
#cave_slug = forms.CharField()
|
#cave_slug = forms.CharField()
|
||||||
|
|
||||||
|
@ -521,14 +521,13 @@ def edit_cave(request, path="", slug=None):
|
|||||||
form = CaveForm(instance=cave, initial={'cave_slug': cave.slug()})
|
form = CaveForm(instance=cave, initial={'cave_slug': cave.slug()})
|
||||||
else:
|
else:
|
||||||
form = CaveForm()
|
form = CaveForm()
|
||||||
# The way formsets are rendered chnaged between Django 4 and Django 5
|
|
||||||
|
# The way formsets are rendered changed between Django 4 and Django 5
|
||||||
major, _, _, _, _ = django.VERSION
|
major, _, _, _, _ = django.VERSION
|
||||||
if major < 5:
|
if major < 5:
|
||||||
tabletype = "table"
|
tabletype = "table"
|
||||||
else:
|
else:
|
||||||
tabletype = "div"
|
tabletype = "div"
|
||||||
print(f"edit_cave(): returning render() with tabletype={tabletype} {django.VERSION} ")
|
|
||||||
|
|
||||||
|
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
|
@ -54,14 +54,19 @@ and these same fields appear in the alternative file upload process as described
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% include 'html_editor_pop_ups.html' %}
|
{% include 'html_editor_pop_ups.html' %}
|
||||||
|
|
||||||
<!-- If you are looking for the furniture that creates the fields on this form, you need to look
|
<h2><!-- file saving error message if any -->{{message}}</h2>
|
||||||
at troggle/core/forms.py ass this uses a Django magic form creation thinggy. -->
|
|
||||||
<h2>{{message}}</h2>
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
# In Django v5 forms are rendered as <div> not as a table. The layout is different.
|
||||||
|
div > label {
|
||||||
|
display:block;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: 5px; }
|
||||||
|
</style>
|
||||||
<form action="" method="post">{% csrf_token %}
|
<form action="" method="post">{% csrf_token %}
|
||||||
{% if tabletype == 'table' %}<table>{% else %}<div>{% endif %}
|
{% if tabletype == 'table' %}<table>{% endif %}
|
||||||
{{ form }}
|
{{ form }}
|
||||||
{% if tabletype == 'table' %}</table>{% else %}</div>{% endif %}
|
{% if tabletype == 'table' %}</table>{% endif %}
|
||||||
<p><input style="font-weight: bold; font-size: 200%; font-variant-caps: small-caps; margin-left: 40%;" type="submit" value="Submit" /></p>
|
<p><input style="font-weight: bold; font-size: 200%; font-variant-caps: small-caps; margin-left: 40%;" type="submit" value="Submit" /></p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
@ -32,7 +32,10 @@
|
|||||||
z-index: 20;
|
z-index: 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
.HTMLarea { width:100%;}
|
.HTMLarea {
|
||||||
|
width:100%; # width:130%;
|
||||||
|
# margin-left: -235px
|
||||||
|
}
|
||||||
|
|
||||||
.popup-overlay.active {
|
.popup-overlay.active {
|
||||||
/*displays pop-up when "active" class is present*/
|
/*displays pop-up when "active" class is present*/
|
||||||
|
Loading…
Reference in New Issue
Block a user