#7 New forms
* introduces bootstrap class form-control for proper html form input rendering * fixes bug where missing shared users for an entry resulted in a None exception * adds GenerateInput with template in generate-content-input.html, which provides a generate button for fetching server-side content * adds/updates translations
This commit is contained in:
@@ -46,6 +46,11 @@ class NewPaymentForm(BaseModalForm):
|
||||
label=_con("money", "Amount"), # contextual translation
|
||||
label_suffix=_(""),
|
||||
help_text=_("in Euro"),
|
||||
widget=forms.NumberInput(
|
||||
attrs={
|
||||
"class": "form-control"
|
||||
}
|
||||
)
|
||||
)
|
||||
due = forms.DateField(
|
||||
label=_("Due on"),
|
||||
@@ -56,6 +61,7 @@ class NewPaymentForm(BaseModalForm):
|
||||
attrs={
|
||||
"type": "date",
|
||||
"data-provide": "datepicker",
|
||||
"class": "form-control",
|
||||
},
|
||||
format="%d.%m.%Y"
|
||||
)
|
||||
@@ -69,14 +75,11 @@ class NewPaymentForm(BaseModalForm):
|
||||
widget=forms.Textarea(
|
||||
attrs={
|
||||
"rows": 5,
|
||||
"class": "w-100"
|
||||
"class": "form-control"
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
# Define w-100 for all form fields
|
||||
full_width_fields = True
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.intervention = self.instance
|
||||
@@ -155,7 +158,12 @@ class NewStateModalForm(BaseModalForm):
|
||||
label=_("Surface"),
|
||||
label_suffix="",
|
||||
required=True,
|
||||
help_text=_("in m²")
|
||||
help_text=_("in m²"),
|
||||
widget=forms.NumberInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -243,7 +251,7 @@ class NewDeadlineModalForm(BaseModalForm):
|
||||
choices=DeadlineType.choices,
|
||||
widget=forms.Select(
|
||||
attrs={
|
||||
"class": "custom-select"
|
||||
"class": "form-control"
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -256,6 +264,7 @@ class NewDeadlineModalForm(BaseModalForm):
|
||||
attrs={
|
||||
"type": "date",
|
||||
"data-provide": "datepicker",
|
||||
"class": "form-control",
|
||||
},
|
||||
format="%d.%m.%Y"
|
||||
)
|
||||
@@ -270,6 +279,7 @@ class NewDeadlineModalForm(BaseModalForm):
|
||||
attrs={
|
||||
"cols": 30,
|
||||
"rows": 5,
|
||||
"class": "form-control",
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -329,7 +339,7 @@ class NewActionModalForm(BaseModalForm):
|
||||
choices=UnitChoices.choices,
|
||||
widget=forms.Select(
|
||||
attrs={
|
||||
"class": "custom-select"
|
||||
"class": "form-control"
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -340,6 +350,11 @@ class NewActionModalForm(BaseModalForm):
|
||||
help_text=_("Insert the amount"),
|
||||
decimal_places=2,
|
||||
min_value=0.00,
|
||||
widget=forms.NumberInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
}
|
||||
)
|
||||
)
|
||||
comment = forms.CharField(
|
||||
required=False,
|
||||
@@ -350,7 +365,7 @@ class NewActionModalForm(BaseModalForm):
|
||||
widget=forms.Textarea(
|
||||
attrs={
|
||||
"rows": 5,
|
||||
"class": "w-100"
|
||||
"class": "form-control",
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -5,6 +5,7 @@ Contact: michel.peltriaux@sgdnord.rlp.de
|
||||
Created on: 01.12.20
|
||||
|
||||
"""
|
||||
from django.contrib.auth.models import User
|
||||
from django.http import HttpRequest
|
||||
from django.template.loader import render_to_string
|
||||
from django.urls import reverse
|
||||
@@ -148,6 +149,8 @@ class CompensationTable(BaseTable):
|
||||
|
||||
"""
|
||||
html = ""
|
||||
if value is None:
|
||||
value = User.objects.none()
|
||||
has_access = value.filter(
|
||||
username=self.user.username
|
||||
).exists()
|
||||
|
||||
Reference in New Issue
Block a user