From: Ali Jetha Date: Thu, 30 Sep 2010 21:02:24 +0000 (-0400) Subject: Version plus ou moins stable de chercheurs X-Git-Url: http://git.auf.org/?p=auf_savoirs_en_partage_django.git;a=commitdiff_plain;h=5ecd9e43b0dbd5dc9b5c9556dd998abcba79dd1a Version plus ou moins stable de chercheurs --- diff --git a/auf_savoirs_en_partage/authentification.py b/auf_savoirs_en_partage/authentification.py index 97ee14b..546413f 100644 --- a/auf_savoirs_en_partage/authentification.py +++ b/auf_savoirs_en_partage/authentification.py @@ -18,7 +18,7 @@ class CascadeBackend(ModelBackend): remoteUser = localUser = None try: if settings.AUTH_PASSWORD_REQUIRED: - remoteUser = RemoteUser.objects.get (courriel=email, password=password) + remoteUser = RemoteUser.objects.get (courriel=email, password=md5pass) else: remoteUser = RemoteUser.objects.get (courriel=email) except: diff --git a/auf_savoirs_en_partage/chercheurs/forms.py b/auf_savoirs_en_partage/chercheurs/forms.py index 9eab15c..e8126b4 100644 --- a/auf_savoirs_en_partage/chercheurs/forms.py +++ b/auf_savoirs_en_partage/chercheurs/forms.py @@ -4,9 +4,11 @@ from models import * class PersonneForm(forms.ModelForm): + password = forms.CharField(widget=forms.PasswordInput(), label="Mot de passe") class Meta: model = Utilisateur fields = ('nom', 'prenom', 'courriel', 'password', 'genre') + class ChercheurForm(forms.ModelForm): class Meta: @@ -30,7 +32,7 @@ class EtablissementAutreForm(forms.ModelForm): class DisciplineForm(forms.ModelForm): class Meta: model = Chercheur - fields = ('discipline', 'expertise', 'mots_cles', 'url') + fields = ('discipline', 'expertise', 'mots_cles', 'url_site_web', 'url_blog', 'url_facebook', 'url_linkedin') class PersonneEditForm(forms.ModelForm): class Meta: diff --git a/auf_savoirs_en_partage/chercheurs/models.py b/auf_savoirs_en_partage/chercheurs/models.py index 46d0dc5..8d02f94 100644 --- a/auf_savoirs_en_partage/chercheurs/models.py +++ b/auf_savoirs_en_partage/chercheurs/models.py @@ -64,7 +64,6 @@ class Chercheur(models.Model): verbose_name='Linkedin') groupes = models.ManyToManyField('Groupe', through='ChercheurGroupe', blank=True, verbose_name = 'Domaines de recherche') - actif = models.BooleanField(editable = False) #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') @@ -73,6 +72,7 @@ class Chercheur(models.Model): publication4 = models.ForeignKey('Publication', db_column='publication4', null=True, blank=True, related_name='publication4', verbose_name = 'Publication 4') these = models.ForeignKey('Publication', db_column='these', null=True, blank=True, related_name='These') + #communication_annee #communication_titre #communication_nom_manifestation_scientifique @@ -85,6 +85,7 @@ class Chercheur(models.Model): #laboratoire_url= #meta + actif = models.BooleanField(editable = False) date_creation = models.DateField(auto_now_add=True, db_column='date_creation') date_modification = models.DateField(auto_now=True, db_column='date_modification') @@ -100,6 +101,7 @@ class Publication(models.Model): lieu_edition = models.CharField(max_length=255, db_column='lieu_edition', null=True, blank=True, verbose_name = 'Lieu d\'édition') nb_pages = models.CharField(max_length=255, db_column='nb_pages', null=True, blank=True, verbose_name = 'Nombre de pages') url = models.CharField(max_length=255, db_column='url', null=True, blank=True, verbose_name = 'Lien vers la publication') + actif = models.BooleanField(editable = False, db_column='actif') class Groupe(models.Model): id = models.AutoField(primary_key=True, db_column='id') @@ -121,3 +123,4 @@ class ChercheurGroupe(models.Model): groupe = models.ForeignKey('Groupe', db_column='groupe') date_inscription = models.DateField(auto_now_add=True) date_modification = models.DateField(auto_now=True) + actif = models.BooleanField(editable = False, db_column='actif') diff --git a/auf_savoirs_en_partage/chercheurs/views.py b/auf_savoirs_en_partage/chercheurs/views.py index 15a06dd..3392461 100644 --- a/auf_savoirs_en_partage/chercheurs/views.py +++ b/auf_savoirs_en_partage/chercheurs/views.py @@ -1,6 +1,9 @@ # -*- encoding: utf-8 -*- +import hashlib from django.shortcuts import render_to_response +from django.http import HttpResponseRedirect from django.template import Context, RequestContext +from django.core.urlresolvers import reverse from forms import * from auf_references_client.models import Discipline, TypeImplantation @@ -81,9 +84,13 @@ def inscription(request): etablissement_form.save(commit=False) etablissement_autre_form.save(commit=False) discipline_form.save(commit=False) + #encodage du mot de passe de l'utilisateur (refactorer car c'est pas clean + #et c'est pas la bonne place pour faire ca - AJ + personne_form.cleaned_data['password'] = hashlib.md5(personne_form.cleaned_data['password']).hexdigest() p = personne_form.save() c.personne = p c.save() + return HttpResponseRedirect(reverse('chercheurs.views.retrieve', args=(p.id,))) else: personne_form = PersonneForm(prefix="personne") chercheur_form = ChercheurForm(prefix="chercheur")