Skip to content

Instantly share code, notes, and snippets.

View badescunicu's full-sized avatar

Nicu Badescu badescunicu

View GitHub Profile
@permission_required('config.change_setting')
def qpool_tag_questions(request):
class TagForm(forms.Form):
questions = forms.MultipleChoiceField(choices=[(q.pk, q.text) for q in Question.objects.all()])
tag = forms.ChoiceField(choices=[(t.pk, t.name) for t in Tag.objects.all().exclude(name__in=['qotd', 'quest', 'challenge'])])
if request.method == 'POST':
form = TagForm(request.POST)
if form.is_valid():
q_pks = form.cleaned_data['questions']