Ejemplo n.º 1
0
        def indiv2foy(varname, quifoy):
            '''
            Yields the field of the foy corresponding to the varname 
            '''
            convert = foy2of_dict()

            value = None
            for field in convert.keys():
                if field2quifoy(field) == quifoy:
                    if convert[field] == varname:
                        value = field
            return value
Ejemplo n.º 2
0
 def indiv2foy(varname, quifoy):
     '''
     Yields the field of the foy corresponding to the varname 
     '''
     convert = foy2of_dict()
     
     value = None
     for field in convert.keys():
         if field2quifoy(field) == quifoy:    
             if convert[field] == varname:
                 value = field
     return value
Ejemplo n.º 3
0
    def get_declar3(self, form=None, idfoy=0):
        '''
        Gets declar values in compo.scenario from Declar3Form
        '''
        declar = self.scenario.declar[idfoy]

        # Build a dict of individulas present on the declar
        cleaned_indiv = extract_foy_indiv(self.scenario, idfoy=idfoy)

        convert = foy2of_dict()

        data = form.cleaned_data

        for field, value in data.iteritems():
            if field in convert.keys():
                quifoy = field2quifoy(field)
                varname = convert[field]
                for person in cleaned_indiv.itervalues():
                    if person['quifoy'] == quifoy:
                        person[varname] = value
            else:
                declar[field] = value
Ejemplo n.º 4
0
    def get_declar3(self, form = None, idfoy = 0):
        '''
        Gets declar values in compo.scenario from Declar3Form
        '''
        declar = self.scenario.declar[idfoy]

        # Build a dict of individulas present on the declar
        cleaned_indiv = extract_foy_indiv(self.scenario, idfoy= idfoy)

        convert = foy2of_dict()
                        
        data = form.cleaned_data
        
        for field, value in data.iteritems(): 
            if field in convert.keys():
                quifoy  = field2quifoy(field)
                varname = convert[field]
                for person in cleaned_indiv.itervalues():
                    if person['quifoy'] == quifoy:
                        person[varname] = value
            else:
                declar[field] = value