feat: Use crispy form tag
This commit is contained in:
parent
6d1cf9084b
commit
65a921248f
@ -1,13 +1,24 @@
|
||||
from django import forms
|
||||
from .models import AdoptionNotice, Animal, Image, Report, ModerationAction, User
|
||||
from django_registration.forms import RegistrationForm
|
||||
|
||||
from crispy_forms.helper import FormHelper
|
||||
from crispy_forms.layout import Submit
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
class DateInput(forms.DateInput):
|
||||
input_type = 'date'
|
||||
|
||||
|
||||
class AdoptionNoticeForm(forms.ModelForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.helper = FormHelper()
|
||||
self.helper.form_id = 'id-exampleForm'
|
||||
self.helper.form_class = 'card'
|
||||
self.helper.form_method = 'post'
|
||||
|
||||
self.helper.add_input(Submit('submit', _('Submit')))
|
||||
|
||||
class Meta:
|
||||
model = AdoptionNotice
|
||||
fields = ['name', "group_only", "further_information", "description", "searching_since"]
|
||||
|
@ -135,8 +135,12 @@ h1 {
|
||||
|
||||
|
||||
.btn {
|
||||
border: 2px solid #4090b6;
|
||||
background-color: #4ba3cd;
|
||||
background-color: var(--primary-light-one);
|
||||
color: var(--secondary-light-one);
|
||||
padding: 16px;
|
||||
border-radius: 8px;
|
||||
border: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.form-button, .link-button a:link, .link-button a:visited {
|
||||
|
@ -11,9 +11,5 @@
|
||||
Fotos hochzuladen.
|
||||
</p>
|
||||
{% endblocktranslate %}
|
||||
<form method="post" class="card" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ form | crispy}}
|
||||
<button type="submit">{% translate "Weiter" %}</button>
|
||||
</form>
|
||||
{% crispy form %}
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user