I have a small Django application with a view that I want to restrict to certain users. Anyone from a specific network should be able to see that view without any further au
def login_by_id(request): ip = request.META['REMOTE_ADDR'] try: UserProfile.objects.get(allow_ip=ip) except UserProfile.DoesNotExist: return HttpResponseRedirect('././') else: # auth here
You need allow_ip in you UserProfile model, which save on registration or changes on edit user page
allow_ip