Improve form widgets
This commit is contained in:
parent
0f9252173c
commit
5b439d88b0
@ -298,3 +298,7 @@ article#filters {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.helptext {
|
||||||
|
font-size: 80%;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
@ -2,12 +2,21 @@
|
|||||||
|
|
||||||
{% block title %}Proposer un événement{% endblock %}
|
{% block title %}Proposer un événement{% endblock %}
|
||||||
|
|
||||||
|
{% block entete_header %}
|
||||||
|
<script src="/static/admin/js/vendor/jquery/jquery.js"></script>
|
||||||
|
<script src="/static/admin/js/jquery.init.js"></script>
|
||||||
|
<link href="/static/css/django_better_admin_arrayfield.min.css" type="text/css" media="all" rel="stylesheet">
|
||||||
|
<script src="/static/js/django_better_admin_arrayfield.min.js"></script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h1>Proposer un événement</h1>
|
<h1>Proposer un événement</h1>
|
||||||
|
|
||||||
<form method="post">{% csrf_token %}
|
<form method="post">{% csrf_token %}
|
||||||
{{ form.as_p }}
|
{{ form.as_p }}
|
||||||
<input type="submit" value="Enregistrer">
|
<input type="submit" value="Enregistrer">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -2,9 +2,16 @@
|
|||||||
|
|
||||||
{% block title %}Éditer {{ object.title }}{% endblock %}
|
{% block title %}Éditer {{ object.title }}{% endblock %}
|
||||||
|
|
||||||
|
{% block entete_header %}
|
||||||
|
<script src="/static/admin/js/vendor/jquery/jquery.js"></script>
|
||||||
|
<script src="/static/admin/js/jquery.init.js"></script>
|
||||||
|
<link href="/static/css/django_better_admin_arrayfield.min.css" type="text/css" media="all" rel="stylesheet">
|
||||||
|
<script src="/static/js/django_better_admin_arrayfield.min.js"></script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h1>Édition de l'événement {{ object.title }} ({{ object.start_day }})</h1>
|
<h1>Édition de l'événement {{ object.title }} ({{ object.start_day }})</h1>
|
||||||
|
|
||||||
<form method="post">{% csrf_token %}
|
<form method="post">{% csrf_token %}
|
||||||
|
@ -285,16 +285,29 @@ def tag_list(request):
|
|||||||
return render(request, 'agenda_culturel/tags.html', context)
|
return render(request, 'agenda_culturel/tags.html', context)
|
||||||
|
|
||||||
|
|
||||||
|
class EventForm(forms.ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Event
|
||||||
|
fields = '__all__'
|
||||||
|
widgets = {
|
||||||
|
'start_day': forms.TextInput(attrs={'type': 'date'}),
|
||||||
|
'start_time': forms.TextInput(attrs={'type': 'time'}),
|
||||||
|
'end_day': forms.TextInput(attrs={'type': 'date'}),
|
||||||
|
'end_time': forms.TextInput(attrs={'type': 'time'}),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class EventCreateView(CreateView):
|
class EventCreateView(CreateView):
|
||||||
model = Event
|
model = Event
|
||||||
fields = '__all__'
|
|
||||||
|
|
||||||
template_name_suffix = "_create_form"
|
form_class = EventForm
|
||||||
|
template_name_suffix = "_form"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class EventUpdateView(LoginRequiredMixin, UpdateView):
|
class EventUpdateView(LoginRequiredMixin, UpdateView):
|
||||||
model = Event
|
model = Event
|
||||||
fields = '__all__'
|
form_class = EventForm
|
||||||
|
|
||||||
|
|
||||||
class EventDeleteView(LoginRequiredMixin, DeleteView):
|
class EventDeleteView(LoginRequiredMixin, DeleteView):
|
||||||
|
Loading…
Reference in New Issue
Block a user