mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 03:13:12 +00:00
Add an unlogged view for registration view
This commit is contained in:
parent
a0612728ee
commit
dceaf9d60f
3 changed files with 10 additions and 5 deletions
|
@ -173,7 +173,7 @@ def handler404(request):
|
||||||
return render(request, "errors/404.html", status=404)
|
return render(request, "errors/404.html", status=404)
|
||||||
|
|
||||||
|
|
||||||
class AutocompleteViewMixin(LoginRequiredMixin, autocomplete.Select2QuerySetView):
|
class AutocompleteUnloggedViewMixin(autocomplete.Select2QuerySetView):
|
||||||
obj_type = None # This MUST be overridden by child class
|
obj_type = None # This MUST be overridden by child class
|
||||||
query_set = None
|
query_set = None
|
||||||
query_filter = "name__icontains" # Override this if necessary
|
query_filter = "name__icontains" # Override this if necessary
|
||||||
|
@ -193,3 +193,8 @@ class AutocompleteViewMixin(LoginRequiredMixin, autocomplete.Select2QuerySetView
|
||||||
self.query_set = self.query_set.filter(**{self.query_filter: self.q})
|
self.query_set = self.query_set.filter(**{self.query_filter: self.q})
|
||||||
|
|
||||||
return self.query_set
|
return self.query_set
|
||||||
|
|
||||||
|
|
||||||
|
class AutocompleteViewMixin(LoginRequiredMixin, AutocompleteUnloggedViewMixin):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
|
@ -36,10 +36,10 @@ from django.db.models.functions import Concat
|
||||||
|
|
||||||
from .models import Room, Dormitory, Building, Switch, PortProfile, Port, SwitchBay
|
from .models import Room, Dormitory, Building, Switch, PortProfile, Port, SwitchBay
|
||||||
|
|
||||||
from re2o.views import AutocompleteViewMixin
|
from re2o.views import AutocompleteViewMixin, AutocompleteUnloggedViewMixin
|
||||||
|
|
||||||
|
|
||||||
class RoomAutocomplete(AutocompleteViewMixin):
|
class RoomAutocomplete(AutocompleteUnloggedViewMixin):
|
||||||
obj_type = Room
|
obj_type = Room
|
||||||
|
|
||||||
# Precision on search to add annotations so search behaves more like users expect it to
|
# Precision on search to add annotations so search behaves more like users expect it to
|
||||||
|
|
|
@ -33,13 +33,13 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
from .models import User, School, Adherent, Club, ListShell
|
from .models import User, School, Adherent, Club, ListShell
|
||||||
|
|
||||||
from re2o.views import AutocompleteViewMixin
|
from re2o.views import AutocompleteViewMixin, AutocompleteUnloggedViewMixin
|
||||||
|
|
||||||
from django.db.models import Q, Value, CharField
|
from django.db.models import Q, Value, CharField
|
||||||
from django.db.models.functions import Concat
|
from django.db.models.functions import Concat
|
||||||
|
|
||||||
|
|
||||||
class SchoolAutocomplete(AutocompleteViewMixin):
|
class SchoolAutocomplete(AutocompleteUnloggedViewMixin):
|
||||||
obj_type = School
|
obj_type = School
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue