示例#1
0
 def get_queryset(self):
     queryset = super(FrontpageView, self).get_queryset()
     self.form = SearchForm(self.request.GET)
     if self.form.is_valid():
         filters = User.get_queryset(self.form.cleaned_data)
         if len(filters):
             queryset = User.objects.filter(filters)
     return queryset
示例#2
0
文件: views.py 项目: hadalin/muzicar
 def get_queryset(self):
     queryset = super(FrontpageView, self).get_queryset()
     self.form = SearchForm(self.request.GET)
     if self.form.is_valid():
         filters = User.get_queryset(self.form.cleaned_data)
         if len(filters):
             queryset = User.objects.filter(filters)
     return queryset
示例#3
0
文件: views.py 项目: hadalin/muzicar
class FrontpageView(FormMixin, ListView):
    model = User
    template_name = "frontpage.html"
    form_class = SearchForm

    def get_queryset(self):
        queryset = super(FrontpageView, self).get_queryset()
        self.form = SearchForm(self.request.GET)
        if self.form.is_valid():
            filters = User.get_queryset(self.form.cleaned_data)
            if len(filters):
                queryset = User.objects.filter(filters)
        return queryset

    def get_context_data(self, **kwargs):
        context = super(FrontpageView, self).get_context_data(**kwargs)
        context["form"] = self.form
        return context
示例#4
0
class FrontpageView(FormMixin, ListView):
    model = User
    template_name = "frontpage.html"
    form_class = SearchForm

    def get_queryset(self):
        queryset = super(FrontpageView, self).get_queryset()
        self.form = SearchForm(self.request.GET)
        if self.form.is_valid():
            filters = User.get_queryset(self.form.cleaned_data)
            if len(filters):
                queryset = User.objects.filter(filters)
        return queryset

    def get_context_data(self, **kwargs):
        context = super(FrontpageView, self).get_context_data(**kwargs)
        context['form'] = self.form
        return context