Ejemplo n.º 1
0
 def get_anagrafica_csa(self):        
     cache_name = '{}_{}'.format(_get_matricola(self.matricola), 'anagrafica_csa')
     csa_cache = cache.get(cache_name)
     if csa_cache: return csa_cache
     
     csa_model = apps.get_model(app_label='csa', model_name='V_ANAGRAFICA')
     anagrafica_csa = csa_model.objects.filter(matricola=_get_matricola(self.matricola)).first()
     if not anagrafica_csa:
         raise CSAException(message=('{} non presenta alcuna '
                                     'anagrafica in CSA, è possibile '
                                     'che sia andato in pensione e '
                                     'non più disponibile in peo CSA.').format(self),
                            errors=['self.get_anagrafica_csa() non torna niente.',])
     cache.set(cache_name, anagrafica_csa)
     return anagrafica_csa
Ejemplo n.º 2
0
 def new_func(*original_args, **original_kwargs):
     request = original_args[0]
     if not getattr(request.user, 'matricola') or \
     not getattr(request.user, 'first_name') or \
     not getattr(request.user, 'last_name') or \
     not V_ANAGRAFICA.objects.filter(matricola=_get_matricola(request.user.matricola)):
         return render(request, 'utente_non_valido.html')
     return func_to_decorate(*original_args, **original_kwargs)
Ejemplo n.º 3
0
 def link_dati_csa(self, obj):
     admin_obj_url = reverse('admin:csa_v_anagrafica_change',
                             args=(_get_matricola(obj.matricola), ))
     value = '<a href="{}">Cosulta Incarichi e Carriera CSA</a>.'.format(
         admin_obj_url)
     return mark_safe(value)