Merge branch 'hotfix/employe_anterieur_fix_form_val_fix' into dev
[auf_rh_dae.git] / project / dae / forms.py
index 841025e..3b432a7 100644 (file)
@@ -6,6 +6,7 @@ from dateutil.relativedelta import relativedelta
 from django import forms
 from django.core.urlresolvers import reverse
 from django.core.exceptions import MultipleObjectsReturned
+from django.forms.formsets import TOTAL_FORM_COUNT
 from django.forms.models import BaseInlineFormSet
 from django.forms.models import (
     inlineformset_factory,
@@ -360,6 +361,15 @@ class ReadOnlyRemunForm(FlexibleRemunForm):
 
 class GroupedInlineFormset(BaseInlineFormSet):
 
+    def total_form_count(self):
+        """Returns the total number of forms in this FormSet."""
+        if self.is_bound:
+            return self.management_form.cleaned_data[TOTAL_FORM_COUNT]
+        else:
+            return len(self.forms)
+        print total_forms
+        return total_forms
+
     def set_groups(self,
                    groups,
                    group_accessor,
@@ -774,6 +784,7 @@ class DossierForm(
         ),
     forms.ModelForm):
     """ Formulaire des dossiers. """
+
     class Meta:
         exclude = ('etat', 'employe', 'poste', 'date_debut',)
         model = dae.Dossier