Ergonomie
This commit is contained in:
parent
3962d0ad4c
commit
0792b29c70
3 changed files with 14 additions and 7 deletions
|
@ -42,6 +42,7 @@ header li {
|
||||||
header h1 {
|
header h1 {
|
||||||
float:left;
|
float:left;
|
||||||
color:#fff;
|
color:#fff;
|
||||||
|
margin:20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
header h1 a {
|
header h1 a {
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<p><a href="{% url 'monstage:index' %}">Retour</a></p>
|
|
||||||
<h1>Rechercher des stages</h1>
|
<h1>Rechercher des stages</h1>
|
||||||
<div id="searchbox">
|
<div id="searchbox">
|
||||||
<form action="{% url 'monstage:search' %}" method="get">
|
<form action="{% url 'monstage:search' %}" method="get">
|
||||||
|
@ -47,11 +46,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<input type="submit" action="submit" />
|
<input type="submit" action="submit" value="Rechercher" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% if resultats %}
|
{% if resultats != None %}
|
||||||
<p>{{ resultats|length }} stage(s) trouvé(s)</p>
|
<p><a name="resultats"></a>{{ resultats|length }} stage(s) trouvé(s)</p>
|
||||||
{% for stage in resultats %}
|
{% for stage in resultats %}
|
||||||
<div class="stagefound">
|
<div class="stagefound">
|
||||||
<h3><a href="{% url 'monstage:stage' stage.id %}">{{ stage.sujet }}</a></h3>
|
<h3><a href="{% url 'monstage:stage' stage.id %}">{{ stage.sujet }}</a></h3>
|
||||||
|
|
|
@ -76,6 +76,13 @@ class StageForm(forms.ModelForm):
|
||||||
model = Stage
|
model = Stage
|
||||||
fields = ("type_stage", "start_date", "end_date", "matieres", "sujet", "thematiques", "encadrants")
|
fields = ("type_stage", "start_date", "end_date", "matieres", "sujet", "thematiques", "encadrants")
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(StageForm, self).__init__(*args, **kwargs)
|
||||||
|
self.fields['matieres'].label = "Matières"
|
||||||
|
self.fields['thematiques'].help_text = "Une liste de tags séparés par des virgules (ou des espaces)"
|
||||||
|
self.fields['start_date'].widget.attrs['placeholder'] = "JJ/MM/AAAA"
|
||||||
|
self.fields['end_date'].widget.attrs['placeholder'] = "JJ/MM/AAAA"
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def stage_add(request):
|
def stage_add(request):
|
||||||
if request.POST:
|
if request.POST:
|
||||||
|
@ -271,13 +278,13 @@ def detail(request, question_id):
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
class SearchForm(forms.Form):
|
class SearchForm(forms.Form):
|
||||||
matiere = forms.ChoiceField(label='Matière :', required=False, choices=tuple([('','Toute matière')] + [(mat.id, mat.name) for mat in StageMatiere.objects.all()]))
|
matiere = forms.ModelChoiceField(label='Matière :', required=False, queryset = StageMatiere.objects.all(), empty_label="Toute matière")
|
||||||
thematiques = forms.CharField(label='Thématiques :', required=False)
|
thematiques = forms.CharField(label='Thématiques :', required=False)
|
||||||
|
|
||||||
latitude = forms.DecimalField(widget=HiddenInput(), required=False)
|
latitude = forms.DecimalField(widget=HiddenInput(), required=False)
|
||||||
longitude = forms.DecimalField(widget=HiddenInput(), required=False)
|
longitude = forms.DecimalField(widget=HiddenInput(), required=False)
|
||||||
tolerance = forms.DecimalField(label='Dans un rayon de (en km) :', initial=100, required=False)
|
|
||||||
lieu = forms.CharField(label=u'A proximité de :', required=False)
|
lieu = forms.CharField(label=u'A proximité de :', required=False)
|
||||||
|
tolerance = forms.DecimalField(label='Dans un rayon de (en km) :', initial=100, required=False)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def search(request):
|
def search(request):
|
||||||
|
@ -297,7 +304,7 @@ def search(request):
|
||||||
stages = stages.filter(lieux__in=lieux)
|
stages = stages.filter(lieux__in=lieux)
|
||||||
matiere = form.cleaned_data['matiere']
|
matiere = form.cleaned_data['matiere']
|
||||||
if matiere:
|
if matiere:
|
||||||
stages = stages.filter(matieres__pk=matiere)
|
stages = stages.filter(matieres=matiere)
|
||||||
thematiques = form.cleaned_data['thematiques'].split(',')
|
thematiques = form.cleaned_data['thematiques'].split(',')
|
||||||
if thematiques:
|
if thematiques:
|
||||||
q = Q()
|
q = Q()
|
||||||
|
|
Loading…
Reference in a new issue