mirror of https://github.com/interlegis/sigi.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
472 B
22 lines
472 B
from django.core.exceptions import ObjectDoesNotExist
|
|
|
|
from sigi.apps.usuarios.models import Usuario
|
|
|
|
|
|
def recupera_usuario(request):
|
|
|
|
pk = request.user.pk
|
|
if pk:
|
|
try:
|
|
usuario = Usuario.objects.get(user_id=pk)
|
|
except ObjectDoesNotExist:
|
|
return 0
|
|
else:
|
|
return usuario.pk
|
|
else:
|
|
return 0
|
|
|
|
|
|
def usuario_context(request):
|
|
context = {'usuario_pk': recupera_usuario(request)}
|
|
return context
|
|
|