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 {
|
||||
float:left;
|
||||
color:#fff;
|
||||
margin:20px;
|
||||
}
|
||||
|
||||
header h1 a {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<p><a href="{% url 'monstage:index' %}">Retour</a></p>
|
||||
<h1>Rechercher des stages</h1>
|
||||
<div id="searchbox">
|
||||
<form action="{% url 'monstage:search' %}" method="get">
|
||||
|
@ -47,11 +46,11 @@
|
|||
}
|
||||
|
||||
</script>
|
||||
<input type="submit" action="submit" />
|
||||
<input type="submit" action="submit" value="Rechercher" />
|
||||
</form>
|
||||
</div>
|
||||
{% if resultats %}
|
||||
<p>{{ resultats|length }} stage(s) trouvé(s)</p>
|
||||
{% if resultats != None %}
|
||||
<p><a name="resultats"></a>{{ resultats|length }} stage(s) trouvé(s)</p>
|
||||
{% for stage in resultats %}
|
||||
<div class="stagefound">
|
||||
<h3><a href="{% url 'monstage:stage' stage.id %}">{{ stage.sujet }}</a></h3>
|
||||
|
|
|
@ -76,6 +76,13 @@ class StageForm(forms.ModelForm):
|
|||
model = Stage
|
||||
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
|
||||
def stage_add(request):
|
||||
if request.POST:
|
||||
|
@ -271,13 +278,13 @@ def detail(request, question_id):
|
|||
from django.db.models import Q
|
||||
|
||||
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)
|
||||
|
||||
latitude = 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)
|
||||
tolerance = forms.DecimalField(label='Dans un rayon de (en km) :', initial=100, required=False)
|
||||
|
||||
@login_required
|
||||
def search(request):
|
||||
|
@ -297,7 +304,7 @@ def search(request):
|
|||
stages = stages.filter(lieux__in=lieux)
|
||||
matiere = form.cleaned_data['matiere']
|
||||
if matiere:
|
||||
stages = stages.filter(matieres__pk=matiere)
|
||||
stages = stages.filter(matieres=matiere)
|
||||
thematiques = form.cleaned_data['thematiques'].split(',')
|
||||
if thematiques:
|
||||
q = Q()
|
||||
|
|
Loading…
Reference in a new issue