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.
 
 
 
 
 

18 lines
657 B

# -*- coding: utf-8 -*-
from abonapp.models import Abon
from django.shortcuts import get_object_or_404
def context_processor_client_ipaddress(request):
ip = request.META.get('REMOTE_ADDR', '') or request.META.get('HTTP_X_FORWARDED_FOR', '')
return {
'client_ipaddress': ip
}
# От сюда можно получать на клиентской стороне профиль абонента
def context_processor_additional_profile(request):
if request.user.is_staff or request.user.is_anonymous():
return {'subscriber': request.user}
else:
return {'subscriber': get_object_or_404(Abon, id=request.user.id)}