Login

Tag "multi"

Snippet List

Mutiple forms on Form wizard

Wraps many Form subclases in order to get a form wizard to treat them as one. Many Forms will use one step. **Example:** `class LanguageVerifiedHumanForm(MultipleForms): base_forms = [ ('language_form', LanguageForm), ('verified_human_form', VerifiedHumanForm) ]` `class NewGuideWizard(SessionWizardView): form_list = [ ('guide_form', GuideForm), ('multi_form', LanguageVerifiedHumanForm), ]`

  • multiple
  • forms
  • wizard
  • multi
  • form-wizard
Read More

Chain multiple querysets into one

This class acts as a wrapper around multiple querysets. Use it if you want to chain multiple QSs together without combining them with | or &. eg., to put title matches ahead of body matches: >>> qs1 = Event.objects.filter(## title matches ##) >>> qs2 = Event.objects.filter(## matches in other fields ##) >>> qs = MultiQuerySet(qs1, qs2) >>> len(qs) >>> paginator = Paginator(qs) >>> first_ten = qs[:10] It effectively acts as an immutable, sliceable QuerySet (with only a very limited subset of the QuerySet api)

  • queryset
  • chain
  • multi
Read More

2 snippets posted so far.