d'inscription.
Demande #573
from savoirs.forms import SEPDateField
class PersonneForm(forms.ModelForm):
- password = forms.CharField(widget=forms.PasswordInput(), label="Mot de passe")
genre = forms.ChoiceField(widget=forms.RadioSelect(), choices=GENRE_CHOICES)
+
class Meta:
model = Utilisateur
+ fields = ('nom', 'prenom', 'courriel', 'genre')
+
+class PersonneInscriptionForm(PersonneForm):
+ password = forms.CharField(widget=forms.PasswordInput(), label="Mot de passe")
+
+ class Meta(PersonneForm.Meta):
fields = ('nom', 'prenom', 'courriel', 'password', 'genre')
def clean_password(self):
"""Encrypter le mot de passe avant de le mettre dans la BD."""
return hashlib.md5(self.cleaned_data['password']).hexdigest()
-class PersonneEditForm(PersonneForm):
- class Meta(PersonneForm.Meta):
- exclude = ('password',)
-
class ChercheurForm(forms.ModelForm):
"""Formulaire d'édition d'un chercheur."""
OUI_NON_CHOICES = ((1, 'Oui'), (0, 'Non'))
class GroupesForm(forms.Form):
"""Formulaire qui associe des groupes à un chercheur."""
- groupes = forms.ModelMultipleChoiceField(queryset=Groupe.objects.all(), required=False)
+ groupes = forms.ModelMultipleChoiceField(
+ queryset=Groupe.objects.all(),
+ label='Domaines de recherche', required=False,
+ help_text="Maintenez appuyé « Ctrl », ou « Commande (touche pomme) » sur un Mac, pour en sélectionner plusieurs."
+ )
def __init__(self, data=None, prefix=None, chercheur=None):
self.chercheur = chercheur
d'un chercheur."""
def __init__(self, data=None, chercheur=None):
- personne_form_class = PersonneForm if chercheur is None else PersonneEditForm
+ personne_form_class = PersonneInscriptionForm if chercheur is None else PersonneForm
self.chercheur = ChercheurForm(data=data, prefix='chercheur', instance=chercheur)
self.groupes = GroupesForm(data=data, prefix='chercheur', chercheur=chercheur)
self.personne = personne_form_class(data=data, prefix='personne', instance=chercheur and chercheur.personne)
help_text=u"Vous pouvez indiquer ici l'adresse de votre page personnelle dans votre réseau social préféré (e.g. Facebook, LinkedIn, Twitter, Identica, ...)"
)
- groupes = models.ManyToManyField('Groupe', through='ChercheurGroupe', blank=True, verbose_name = 'Domaines de recherche')
+ groupes = models.ManyToManyField('Groupe', through='ChercheurGroupe', blank=True, verbose_name='Domaines de recherche')
#Refactoring, mettre les publications comme etant des many2many;
publication1 = models.ForeignKey('Publication', db_column='publication1', null=True, blank=True, related_name='publication1', verbose_name = 'Publication 1')
return s[1]
return "-"
+ @property
+ def etablissement_display(self):
+ if self.etablissement:
+ return self.etablissement.nom + ', ' + self.etablissement.pays.nom
+ else:
+ return self.etablissement_autre_nom + ', ' + self.etablissement_autre_pays
+
class Publication(models.Model):
id = models.AutoField(primary_key=True, db_column='id')
titre = models.CharField(max_length=255, db_column='titre', null=True, blank=True, verbose_name = 'Titre')
modification = request.GET.get('modification')
if not chercheur:
return HttpResponseRedirect(url('chercheurs.views.chercheur_login'))
- variables = { 'chercheur': chercheur,
- 'modification': modification,
- }
- return render_to_response ("chercheurs/perso.html", \
- Context (variables),
- context_instance = RequestContext(request))
+ return render_to_response("chercheurs/perso.html",
+ dict(chercheur=chercheur, modification=modification),
+ context_instance=RequestContext(request))
def retrieve(request, id):
"""Fiche du chercheur"""
chercheur = get_object_or_404(Chercheur, id=id)
- variables = { 'chercheur': chercheur }
- return render_to_response ("chercheurs/retrieve.html", \
- Context (variables),
- context_instance = RequestContext(request))
+ return render_to_response("chercheurs/retrieve.html",
+ dict(chercheur=chercheur),
+ context_instance = RequestContext(request))
def conversion(request):
return render_to_response ("chercheurs/conversion.html", \
dd{margin:0.25em 0 0.5em 2.5em;}
sup{font-size: smaller; vertical-align: 0.5em; line-height: 1px;}
+td ul { margin: 0 }
+
form td { vertical-align: top }
form th { width: 20em; text-align: left; font-weight: bold }
form table { width: 100% }
</fieldset>
<fieldset>
+ <legend>Expertise</legend>
+ <div>
+ {% with forms.expertise as form %}
+ {% include "table_form.html" %}
+ {% endwith %}
+ </div>
+ </fieldset>
+
+ <fieldset>
<legend>Thèse ou mémoire</legend>
<div>
<div class="publication">
<div style="clear:both"></div>
</div>
</fieldset>
-
- <fieldset>
- <legend>Expertise</legend>
- <div>
- {% with forms.expertise as form %}
- {% include "table_form.html" %}
- {% endwith %}
- </div>
- </fieldset>
--- /dev/null
+<div id="fiche_chercheur">
+
+ <div><a href="mailto:{{ chercheur.personne.courriel }}">{{ chercheur.personne.courriel }}</a></div>
+ <div>{{ chercheur.etablissement_display }}</div>
+
+ <h5>Informations académiques</h5>
+ <table>
+ <tr>
+ <td class="label">Statut:</td>
+ <td>{{ chercheur.statut_display }}</td>
+ </tr>
+ <tr>
+ <td class="label">Diplôme:</td>
+ <td>{{ chercheur.diplome }}</td>
+ </tr>
+ <tr>
+ <td class="label">Domaine{{ chercheur.groupes.all|pluralize }} de recherche:</td>
+ <td>
+ <ul>
+ {% for g in chercheur.groupes.all %}
+ <li>{{ g.nom }}</li>
+ {% endfor %}
+ </ul>
+ </td>
+ </tr>
+ </table>
+
+ <h5>Champ disciplinaire, thèmes de recherche</h5>
+ <table>
+ <tr>
+ <td class="label">Discipline:</td>
+ <td>{{ chercheur.discipline }}</td>
+ </tr>
+ {% if chercheur.theme_recherche %}
+ <tr>
+ <td class="label">Thèmes de recherche:</td>
+ <td>{{ chercheur.theme_recherche }}</td>
+ </tr>
+ {% endif %}
+ <tr>
+ <td class="label">Mots-clés:</td>
+ <td>{{ chercheur.mots_cles }}</td>
+ </tr>
+ {% if chercheur.url_site_web %}
+ <tr>
+ <td class="label">Url site web:</td>
+ <td><a href="{{ chercheur.url_site_web }}">{{ chercheur.url_site_web }}</a></td>
+ </tr>
+ {% endif %}
+ {% if chercheur.url_blog %}
+ <tr>
+ <td class="label">Blog:</td>
+ <td><a href="{{ chercheur.url_blog }}">{{ chercheur.url_blog }}</a></td>
+ </tr>
+ {% endif %}
+ {% if chercheur.url_reseau_social %}
+ <tr>
+ <td class="label">Réseau social:</td>
+ <td><a href="{{ chercheur.url_reseau_social }}">{{ chercheur.url_reseau_social }}</a></td>
+ </tr>
+ {% endif %}
+ </table>
+
+ {% if chercheur.membre_instance_auf or chercheur.expert_oif or chercheur.membre_fipf %}
+ <h5>Activités en Francophonie</h5>
+ <table>
+ {% if chercheur.membre_instance_auf %}
+ <tr>
+ <td class="label">Membre d'une instance de l'AUF</td>
+ <td>{{ chercheur.membre_instance_auf_dates }}</td>
+ </tr>
+ {% endif %}
+ {% if chercheur.expert_oif %}
+ <tr>
+ <td class="label">Expert de l'OIF</td>
+ <td></td>
+ </tr>
+ {% endif %}
+ {% if chercheur.membre_fipf %}
+ <tr>
+ <td class="label">Membre de la FIPF</td>
+ <td>Nom de l'association: {{ chercheur.membre_fipf_association }}</td>
+ </tr>
+ {% endif %}
+ </table>
+ {% endif %}
+
+ {% if chercheur.expertise %}
+ <h5>Expertise</h5>
+ <table>
+ <tr>
+ <td class="label">Titre de l'expertise:</td>
+ <td>{{ chercheur.expertise.nom }}</td>
+ </tr>
+ {% if chercheur.expertise.date %}
+ <tr>
+ <td class="label">Date:</td>
+ <td>{{ chercheur.expertise.date }}</td>
+ </tr>
+ {% endif %}
+ {% if chercheur.expertise.organisme_demandeur and chercheur.expertise.organisme_demandeur_visible %}
+ <tr>
+ <td class="label">Organisme demandeur:</td>
+ <td>{{ chercheur.expertise.organisme_demandeur }}</td>
+ </tr>
+ {% endif %}
+ </table>
+ {% endif %}
+
+ <h5>Publications</h5>
+ <table id="publications">
+ <tr class="souligne">
+ <td class="label">Thèse ou mémoire:</td>
+ {% with chercheur.these as publication %}{% include "chercheurs/publication_display.html" %}{% endwith %}
+ </tr>
+ {% if chercheur.publication1 or chercheur.publication2 or chercheur.publication3 or chercheur.publication4 %}
+ <tr>
+ <td class="label">Publications:</td>
+ {% with chercheur.publication1 as publication %}{% include "chercheurs/publication_display.html" %}{% endwith %}
+ </tr>
+ <tr>
+ <td class="label"></td>
+ {% with chercheur.publication2 as publication %}{% include "chercheurs/publication_display.html" %}{% endwith %}
+ </tr>
+ <tr>
+ <td class="label"></td>
+ {% with chercheur.publication3 as publication %}{% include "chercheurs/publication_display.html" %}{% endwith %}
+ </tr>
+ <tr>
+ <td class="label"></td>
+ {% with chercheur.publication4 as publication %}{% include "chercheurs/publication_display.html" %}{% endwith %}
+ </tr>
+ {% endif %}
+ </table>
+</div>
{% endif %}
<h4>{{ chercheur }}</h4>
+<ul class="actions">
+ <li><a href="{% url chercheurs.views.edit %}">Éditer votre fiche</a></li>
+ <li><a href="{% url chercheurs.views.change_password %}">Modifier votre mot de passe</a></li>
+</ul>
<div class="contenu-wrapper">
- <div style="float:right; margin-right:40px;font-size:12px"><img src="/media/img/edit.png"> <a href="{% url chercheurs.views.edit %}">Éditer</a></div>
- <div id="fiche_chercheur">
- <p>{{chercheur.personne.courriel}}</p>
- <p>{% firstof chercheur.etablissement.nom chercheur.etablissement_autre_nom "-" %}, {% firstof chercheur.etablissement.pays chercheur.etablissement_autre_pays "-" %}</p>
-
- <table>
- {% if chercheur.nationalite %}
- <tr>
- <td class="label">Nationalité:</td>
- <td>{{chercheur.nationalite.nom|default:"-"}}</td>
- </tr>
- {% endif %}
- <tr>
- <td class="label">Statut:</td>
- <td>{{chercheur.statut_display|default:"-"}}</td>
- </tr>
- <tr>
- <td class="label">Diplôme:</td>
- <td>{{chercheur.diplome|default:"-"}}</td>
- </tr>
- </table>
-
- </div>
- <p><a href="{% url chercheurs.views.change_password %}">Modifier mot de passe</a></p>
+ {% include "chercheurs/fiche.html" %}
</div>
{% endblock %}
{% extends "container_base.html" %}
{% block contenu %}
-
-<h4>Chercheurs</h4>
-
<h4>{{ chercheur }}</h4>
-
<div class="contenu-wrapper">
- <div id="fiche_chercheur">
- <p>{{chercheur.personne.courriel}}</p>
- {% if chercheur.etablissement.nom or chercheur.etablissement_autre_nom %}
- <p>{% firstof chercheur.etablissement.nom chercheur.etablissement_autre_nom "-" %}, {% firstof chercheur.etablissement.pays chercheur.etablissement_autre_pays "-" %}</p>
- {% endif %}
-
- <table>
- {% if chercheur.nationalite %}
- <tr>
- <td class="label">Nationalité:</td>
- <td>{{chercheur.nationalite.nom|default:"-"}}</td>
- </tr>
- {% endif %}
- <tr>
- <td class="label">Statut:</td>
- <td>{{chercheur.statut_display|default:"-"}}</td>
- </tr>
- <tr>
- <td class="label">Diplôme:</td>
- <td>{{chercheur.diplome|default:"-"}}</td>
- </tr>
- </table>
- <table>
- {% if chercheur.url_site_web %}
- <tr>
- <td class="label">Url site web:</td>
- <td><a href="{{chercheur.url_site_web}}">{{chercheur.url_site_web}}</a></td>
- </tr>
- {% endif %}
- {% if chercheur.url_blog %}
- <tr>
- <td class="label">Blog:</td>
- <td><a href="{{chercheur.url_blog}}">{{chercheur.url_blog}}</a></td>
- </tr>
- {% endif %}
- {% if chercheur.url_reseau_social %}
- <tr>
- <td class="label">Réseau social:</td>
- <td><a href="{{chercheur.url_reseau_social}}">{{chercheur.url_reseau_social }}</a></td>
- </tr>
- {% endif %}
- </table>
-
- {% if chercheur.expertise %}
- <h5>Expertise</h5>
- <table>
- <tr>
- <td class="label">Titre de l'expertise:</td>
- <td>{{chercheur.expertise.nom}}</td>
- </tr>
- {% if chercheur.expertise.date %}
- <tr>
- <td class="label">Date:</td>
- <td>{{chercheur.expertise.date}}</td>
- </tr>
- {% endif %}
- {% if chercheur.expertise.organisme_demandeur and chercheur.expertise.organisme_demandeur_visible %}
- <tr>
- <td class="label">Organisme demandeur:</td>
- <td>{{chercheur.expertise.organisme_demandeur}}</td>
- </tr>
- {% endif %}
- </table>
- {% endif %}
-
- <h5>Thèmes de recherche et publications</h5>
- <table id="publications">
- {% if chercheur.theme_recherche %}
- <tr class="souligne">
- <td class="label">Thèmes de recherche:</td>
- <td>{{chercheur.theme_recherche}}</td>
- </tr>
- {% endif %}
- {% if chercheur.these %}
- <tr class="souligne">
- <td class="label">Thèse:</td>
- {% with chercheur.these as publication %}{% include "chercheurs/publication_display.html" %}{% endwith %}
- </tr>
- {% endif %}
- <tr>
- <td class="label">Publications:</td>
- {% with chercheur.publication1 as publication %}{% include "chercheurs/publication_display.html" %}{% endwith %}
- </tr>
- <tr>
- <td class="label"></td>
- {% with chercheur.publication2 as publication %}{% include "chercheurs/publication_display.html" %}{% endwith %}
- </tr>
- <tr>
- <td class="label"></td>
- {% with chercheur.publication3 as publication %}{% include "chercheurs/publication_display.html" %}{% endwith %}
- </tr>
- <tr>
- <td class="label"></td>
- {% with chercheur.publication4 as publication %}{% include "chercheurs/publication_display.html" %}{% endwith %}
- </tr>
- </table>
-
- <h5>Domaines de recherche</h5>
- <table>
- <tr>
- <td class="label">Adhésion(s) active(s):</td>
- <td>
- {% for g in chercheur.chercheurgroupe_set.all %}
- {{g.groupe.nom}}<br />
- {% endfor %}
- </td>
- </tr>
- </table>
-
- {% if chercheur.discipline %}
- <h5>Discipline</h5>
- <table>
- <tr>
- <td class="label">Discipline:</td>
- <td>{{chercheur.discipline}}</td>
- </tr>
- </table>
- {% endif %}
- </div>
-
+ {% include "chercheurs/fiche.html" %}
</div>
-
{% endblock %}