Changes between Version 6 and Version 7 of CookBookIPAccessMiddleware
- Timestamp:
- Dec 21, 2006, 6:04:57 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CookBookIPAccessMiddleware
v6 v7 9 9 You must define a model that permits defining a tuple (ip addr, user): ip from browser that connect, and users that authenticated. 10 10 11 This is the model proposed (it would be in a file like ''my app/models.py''):11 This is the model proposed (it would be in a file like ''myproj/myapp/models.py''): 12 12 13 13 {{{ … … 36 36 Middleware mission is authenticate automatically with an user defined in models, '''only if''' the remote ip address exists in ''IPAccess'' table. 37 37 38 This is the code (in file ''my app/middleware.py''):38 This is the code (in file ''myproj/myapp/middleware.py''): 39 39 40 40 {{{ 41 41 42 42 from django.contrib.auth.models import AnonymousUser 43 from my app.models import IPAccess43 from myproj.myapp.models import IPAccess 44 44 45 45 class IPAccessMiddleware(object):