import clients.models
def index(request):
from django.contrib.auth import get_user
user = get_user(request)
numbers = clients.models.Number.objects.all()
if user.is_authenticated:
return HttpResponse(numbers)
else:
return HttpResponseRedirect('/login')