Ultron/ultron/location/forms.py

55 lines
1.6 KiB
Python
Raw Normal View History

2021-12-09 16:53:44 +01:00
from django import forms
2022-01-07 18:08:39 +01:00
2021-12-09 16:53:44 +01:00
from .models import Place
class PlaceForm(forms.ModelForm):
class Meta:
model = Place
fields = (
"name",
"address",
"postal",
"city",
"country",
# "nbkm",
# "timing",
"is_active",
2021-12-09 16:53:44 +01:00
)
widgets = {
"name": forms.TextInput(
attrs={"class": "form-control", "placeholder": "Place's name"}
),
"address": forms.TextInput(
attrs={"class": "form-control", "placeholder": "Address"}
),
"postal": forms.TextInput(
2022-01-06 17:59:21 +01:00
attrs={"class": "form-control", "placeholder": "ZIP"}
2021-12-09 16:53:44 +01:00
),
"city": forms.TextInput(
attrs={"class": "form-control", "placeholder": "City"}
),
"country": forms.HiddenInput(),
# "nbkm": forms.TextInput(
# attrs={"class": "form-control", "placeholder": "Distance"}
# ),
# "timing": forms.TextInput(
# attrs={"class": "form-control", "placeholder": "Travel time"}
# ),
"is_active": forms.CheckboxInput(
2022-01-08 07:13:24 +01:00
attrs={"class": "form-control form-check-input ml-0 mt-0"}
2021-12-09 16:53:44 +01:00
),
}
country_related = forms.CharField(
2022-02-06 17:39:26 +01:00
required=False,
2021-12-09 16:53:44 +01:00
widget=forms.TextInput(
attrs={
"class": "form-control",
"placeholder": "Searching…",
"data-ref": "#id_country",
}
)
)