djangosnippets.org: Latest snippets tagged with 'Authorization'https://djangosnippets.org/tags/authorization_1/2011-02-16T04:48:38.100782-06:00IP Authorization Decorator with IP list
2011-02-16T04:48:38.100782-06:00janstahttps://djangosnippets.org/snippets/2358/<p>Improved version of http://djangosnippets.org/snippets/2205/
</p>
<p>Example simple code:
`
from django.http import HttpResponse
IP_LIST = ['192.168.101.100', '192.168.101.220', '127.0.0.1', '127.0.1.1']
</p>
<p>@ip_auth(IP_LIST)
def get_parameter(request,name):
parameter = get_object_or_404(Parameter,short_name=short_name)
return HttpResponse(parameter.value)
</p>
<p>`
</p>
Freely redistributable