コード例 #1
0
ファイル: models.py プロジェクト: uniurbit/PEO
 def get_allegati_path(self):
     l = []
     allegati = get_allegati(self)
     for allegato in allegati:
         fpath = get_path_allegato(self.domanda_bando.dipendente.matricola,
                                   self.domanda_bando.bando.slug, self.pk)
         fname = '/'.join((fpath, allegato[1]))
         l.append(fname)
     return l
コード例 #2
0
ファイル: models.py プロジェクト: enricouniurb/PEO
 def allegati_validi(self):
     """
     controlla che gli allegati del modulo siano presenti se required
     """
     # allegati = dict(self.get_allegati())
     allegati = dict(get_allegati(self))
     form = self.descrizione_indicatore.get_form()
     for field in form.fields:
         f = form.fields[field]
         if (f.required and isinstance(f, forms.FileField)):
             if not allegati:
                 return False
             if not field in allegati.keys():
                 return False
     # any fields returns as False
     return True
コード例 #3
0
    def get_modulo_anteprima(self, obj):
        json_dict = json.loads(obj.modulo_compilato)
        data = get_as_dict(json_dict, allegati=False)
        allegati = get_allegati(obj)
        form = SavedFormContent.compiled_form_readonly(obj.compiled_form())

        table_tmpl = '<table margin-left: 15px;">{}</table>'
        allegati_html = ''

        for k, v in allegati:
            allegato_url = reverse(
                'domande_peo:download_allegato',
                args=[obj.domanda_bando.bando.pk, obj.pk, k])
            allegati_html += '<tr><td>{}</td><td><a href="{}">{}</a><td></tr>'.format(
                k, allegato_url, v)

        value = form.as_table()
        v = table_tmpl.format(value)
        return mark_safe(v + table_tmpl.format(allegati_html))
コード例 #4
0
ファイル: domande_peo_tags.py プロジェクト: uniurbit/PEO
def get_allegati_modulo(mdb):
    return get_allegati(mdb)