Source

django-autocomplete / autocomplete / views.py

Diff from to

File autocomplete/views.py

     def __init__(self):
         self.settings = dict()
 
+    def allowed(self, request, ac_name, auth):
+        if auth and not request.user.is_authenticated():
+            return False
+        else:
+            return True
+
     def __call__(self, request, ac_name, query_param='q'):
         if not ac_name in self.settings:
             return self.not_found(request, ac_name)
 
         qs, fields, limit, key, label, auth = self.settings[ac_name]
-        if auth and not request.user.is_authenticated():
+        if not self.allowed(request, ac_name, auth):
             return self.forbidden(request, ac_name)
         query = request.GET.get(query_param, '')