Site retrait de la verification de la validite des urls
authorAli Jetha <ali@U-AJ.(none)>
Thu, 7 Oct 2010 15:26:11 +0000 (11:26 -0400)
committerAli Jetha <ali@U-AJ.(none)>
Thu, 7 Oct 2010 15:26:11 +0000 (11:26 -0400)
auf_savoirs_en_partage/chercheurs/forms.py
auf_savoirs_en_partage/chercheurs/views.py
auf_savoirs_en_partage/sitotheque/models.py
auf_savoirs_en_partage/templates/chercheurs/edit.html
auf_savoirs_en_partage/templates/chercheurs/inscription.html

index 4bedb80..fd9eab8 100644 (file)
@@ -19,6 +19,14 @@ class PublicationForm(forms.ModelForm):
     class Meta:
         model = Publication
         fields = ('titre', 'annee', 'revue', 'editeur', 'lieu_edition', 'nb_pages', 'url')
+        
+class TheseForm(PublicationForm):
+    titre = forms.CharField(required=True, label="Titre")  
+    #def clean_titre(self):
+    #    data = self.cleaned_data['titre']
+    #    if not data:
+    #        raise forms.ValidationError("Vous devez renseigner une thèse")
+    #    return data
 
 class EtablissementForm(forms.ModelForm):
     class Meta:
index ff95ee3..2d23376 100644 (file)
@@ -59,7 +59,8 @@ def inscription(request):
         publication1_form = PublicationForm (request.POST, prefix="publication1")
         publication2_form = PublicationForm (request.POST, prefix="publication2") 
         publication3_form = PublicationForm (request.POST, prefix="publication3") 
-        publication4_form = PublicationForm (request.POST, prefix="publication4") 
+        publication4_form = PublicationForm (request.POST, prefix="publication4")
+        these_form = TheseForm(request.POST, prefix="these")
         
         if personne_form.is_valid():
             if chercheur_form.is_valid():
@@ -68,7 +69,7 @@ def inscription(request):
                 etablissement_form = EtablissementForm (request.POST, prefix="etablissement", instance=c)
                 discipline_form = DisciplineForm (request.POST, prefix="discipline", instance=c)
                 
-                if etablissement_form.is_valid() and discipline_form.is_valid():       
+                if etablissement_form.is_valid() and discipline_form.is_valid() and these_form.is_valid():       
                     if publication1_form.is_valid() and publication1_form.cleaned_data['titre']:
                        pub = publication1_form.save()
                        c.publication1 = pub
@@ -81,6 +82,8 @@ def inscription(request):
                     if publication4_form.is_valid() and publication4_form.cleaned_data['titre']:
                        pub = publication4_form.save()
                        c.publication4 = pub    
+                    these = these_form.save()
+                    c.these = these 
                     etablissement_form.save(commit=False)
                     etablissement_autre_form.save(commit=False)
                     discipline_form.save(commit=False)
@@ -90,7 +93,7 @@ def inscription(request):
                     p = personne_form.save()
                     c.personne = p
                     c.save()
-                    return HttpResponseRedirect(reverse('chercheurs.views.retrieve', args=(p.id,)))
+                    return HttpResponseRedirect(reverse('chercheurs.views.retrieve', args=(c.id,)))
     else:
         personne_form = PersonneForm(prefix="personne")
         chercheur_form = ChercheurForm(prefix="chercheur")
@@ -100,7 +103,8 @@ def inscription(request):
         publication1_form = PublicationForm(prefix="publication1")
         publication2_form = PublicationForm(prefix="publication2") 
         publication3_form = PublicationForm(prefix="publication3") 
-        publication4_form = PublicationForm(prefix="publication4") 
+        publication4_form = PublicationForm(prefix="publication4")
+        these_form = TheseForm(prefix="these")
     
     variables = { 'personne_form': personne_form,
                   'chercheur_form': chercheur_form,
@@ -111,6 +115,7 @@ def inscription(request):
                   'publication2_form': publication2_form,
                   'publication3_form': publication3_form,
                   'publication4_form': publication4_form,
+                  'these_form': these_form,
                 }
     
     return render_to_response ("chercheurs/inscription.html", \
@@ -124,7 +129,7 @@ def edit(request):
     chercheur = context_instance['user_chercheur']    
     if request.method == 'POST':
         personne_form = PersonneEditForm(request.POST, prefix="personne", instance=chercheur.personne)
-        chercheur_form = ChercheurForm (request.POST, prefix="chercheur", instance=chercheur)
+        #chercheur_form = ChercheurForm (request.POST, prefix="chercheur", instance=chercheur)
         etablissement_form = EtablissementForm(request.POST, prefix="etablissement", instance=chercheur)
         etablissement_autre_form = EtablissementAutreForm(request.POST, prefix="etablissement_autre", instance=chercheur)
         discipline_form = DisciplineForm(request.POST, prefix="discipline", instance=chercheur)
@@ -132,31 +137,33 @@ def edit(request):
         publication2_form = PublicationForm(request.POST, prefix="publication2", instance=chercheur.publication2) 
         publication3_form = PublicationForm(request.POST, prefix="publication3", instance=chercheur.publication3) 
         publication4_form = PublicationForm(request.POST, prefix="publication4", instance=chercheur.publication4)
+        these_form = TheseForm(request.POST, prefix="these", instance=chercheur.these)
         
 
-        if( personne_form.is_valid() and discipline_form.is_valid() and publication1_form.is_valid() and publication2_form.is_valid() and publication3_form.is_valid() and publication4_form.is_valid() and chercheur_form.is_valid() ):
+        if( personne_form.is_valid() and discipline_form.is_valid() and publication1_form.is_valid() and publication2_form.is_valid() and publication3_form.is_valid() and publication4_form.is_valid() and these_form.is_valid() ):
             personne_form.save()
-            chercheur_form.save()
+            #chercheur_form.save()
             discipline_form.save()
             publication1_form.save()
             publication2_form.save()
             publication3_form.save()
             publication4_form.save()
+            these_form.save()
     else:
         personne_form = PersonneEditForm(prefix="personne", instance=chercheur.personne) 
-        chercheur_form = ChercheurForm (prefix="chercheur", instance=chercheur)
+        #chercheur_form = ChercheurForm (prefix="chercheur", instance=chercheur)
         etablissement_form = EtablissementForm(prefix="etablissement", instance=chercheur)
         etablissement_autre_form = EtablissementAutreForm(prefix="etablissement_autre", instance=chercheur)
         discipline_form = DisciplineForm(prefix="discipline", instance=chercheur)
         publication1_form = PublicationForm(prefix="publication1", instance=chercheur.publication1)
         publication2_form = PublicationForm(prefix="publication2", instance=chercheur.publication2) 
         publication3_form = PublicationForm(prefix="publication3", instance=chercheur.publication3) 
-        publication4_form = PublicationForm(prefix="publication4", instance=chercheur.publication4)    
-    #import pdb; pdb.set_trace()    
+        publication4_form = PublicationForm(prefix="publication4", instance=chercheur.publication4) 
+        these_form = TheseForm(prefix="these", instance=chercheur.these)
         
     variables = { 'chercheur': chercheur,
                   'personne_form':personne_form,
-                  'chercheur_form': chercheur_form,
+                  #'chercheur_form': chercheur_form,
                   'etablissement_form': etablissement_form,
                   'discipline_form': discipline_form,
                   'etablissement_autre_form': etablissement_autre_form,
@@ -164,6 +171,7 @@ def edit(request):
                   'publication2_form': publication2_form,
                   'publication3_form': publication3_form,
                   'publication4_form': publication4_form,
+                  'these_form': these_form,
                 }
     return render_to_response ("chercheurs/edit.html", \
             Context (variables), 
index d6e4e1b..064632f 100644 (file)
@@ -18,7 +18,7 @@ TYPE_SITE_CHOICES = (
 
 class Site(models.Model):
     """Fiche d'info d'un site web"""
-    url = models.URLField(verify_exists=True)   # dc:identifier (dc:source?)
+    url = models.URLField(verify_exists=False)   # dc:identifier (dc:source?)
     titre = models.CharField(max_length=255, verbose_name='Titre')   # dc.title
     description = models.TextField(null=True, blank=True)
     editeur = models.CharField(max_length=255, null=True, blank=True, verbose_name='Éditeur')    # dc.publisher : organisation resp
index 6f50ff6..ae766e4 100644 (file)
         {% endwith %}
     </fieldset>
     
-    <fieldset>
+    <!--<fieldset>
         <legend>Informations académiques</legend>
         {% with chercheur_form as form %}
             {% include "table_form.html" %}
         {% endwith %}
-    </fieldset>
+    </fieldset>-->
     
     <fieldset>
         <legend>Etablissement de rattachement</legend>
             {% include "table_form.html" %}
         {% endwith %}
     </fieldset>
-
+    
+    <fieldset>
+        <legend>Thèse</legend>
+        <div>
+            <div class="publication">
+              {% with these_form as form %}
+                  {% include "table_form.html" %}
+              {% endwith %}
+            </div>
+            <div style="clear:both"></div>
+        </div>
+    </fieldset>
+    
     <fieldset>
         <legend>Publications</legend>
         <div>
+            {% ifnotequal publication1_form.instance.titre None %}
             <div class="infotip">
               <strong>Renseignements préalablements enregistrés</strong>
               <p>{{publication1_form.instance.publication_affichage}}</p>
             </div>
+            {% endifnotequal %}
             <div class="publication">
               {% with publication1_form as form %}
                   {% include "table_form.html" %}
         <p id="show_publications">+ Autres publications</p>
         <div class="publications_autre">
             <h6>- Publication 2</h6>
+            {% ifnotequal publication1_form.instance.titre None %}
             <div class="infotip">
               <strong>Renseignements préalablements enregistrés</strong>
               <p>{{publication2_form.instance.publication_affichage}}</p>
             </div>
+            {% endifnotequal %}
             <div class="publication">
                 {% with publication2_form as form %}
                     {% include "table_form.html" %}
             </div>
             <div style="clear:both"></div>
             <h6>- Publication 3</h6>
+            {% ifnotequal publication3_form.instance.titre None %}
             <div class="infotip">
               <strong>Renseignements préalablements enregistrés</strong>
               <p>{{publication3_form.instance.publication_affichage}}</p>
             </div>
+            {% endifnotequal %}
             <div class="publication">
                 {% with publication3_form as form %}
                     {% include "table_form.html" %}
             </div>
             <div style="clear:both"></div>     
             <h6>- Publication 4</h6>
+            {% ifnotequal publication4_form.instance.titre None %}
             <div class="infotip">
               <strong>Renseignements préalablements enregistrés</strong>
               <p>{{publication4_form.instance.publication_affichage}}</p>
             </div>
+            {% endifnotequal %}
             <div class="publication">
                 {% with publication4_form as form %}
                     {% include "table_form.html" %}
index 58322b1..043a995 100644 (file)
     </fieldset>
 
     <fieldset>
+        <legend>Thèse</legend>
+        <div>
+            <div class="publication">
+              {% with these_form as form %}
+                  {% include "table_form.html" %}
+              {% endwith %}
+            </div>
+            <div style="clear:both"></div>
+        </div>
+    </fieldset>
+        
+    <fieldset>
         <legend>Publications</legend>
         <div>
             <div class="publication">