djangosnippets.org: Latest snippets tagged with 'multi'https://djangosnippets.org/tags/multi/2015-09-11T03:57:46.837022-05:00Mutiple forms on Form wizard
2015-09-11T03:57:46.837022-05:00LaraChicharohttps://djangosnippets.org/snippets/10528/<p>Wraps many Form subclases in order to get a form wizard to treat them as one.</p>
<p>Many Forms will use one step.</p>
<p><strong>Example:</strong></p>
<p><code>class LanguageVerifiedHumanForm(MultipleForms):
base_forms = [
('language_form', LanguageForm), ('verified_human_form', VerifiedHumanForm)
]</code></p>
<p><code>class NewGuideWizard(SessionWizardView):
form_list = [
('guide_form', GuideForm),
('multi_form', LanguageVerifiedHumanForm),
]</code></p>
Freely redistributableChain multiple querysets into one
2008-10-01T17:10:18.657351-05:00mattdwhttps://djangosnippets.org/snippets/1103/<p>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:</p>
<pre><code>>>> qs1 = Event.objects.filter(## title matches ##)
>>> qs2 = Event.objects.filter(## matches in other fields …</code></pre>
Freely redistributable