def spell_index(request): if is_admin(request): f = SpellFilterAdmin(request.GET, queryset=Spell.objects.select_related( 'rulebook', 'rulebook__dnd_edition', 'school', 'verified_author').distinct()) else: f = SpellFilter(request.GET, queryset=Spell.objects.select_related( 'rulebook', 'rulebook__dnd_edition', 'school').distinct()) paginator = DndPaginator(f.qs, request) form_submitted = 1 if '_filter' in request.GET else 0 return render_to_response( 'dnd/spells/spell_index.html', { 'request': request, 'spell_list': paginator.items(), 'paginator': paginator, 'filter': f, 'form_submitted': form_submitted, }, context_instance=RequestContext(request), )
def spell_index(request): if is_admin(request): f = SpellFilterAdmin( request.GET, queryset=Spell.objects.select_related( "rulebook", "rulebook__dnd_edition", "school", "verified_author" ).distinct(), ) else: f = SpellFilter( request.GET, queryset=Spell.objects.select_related("rulebook", "rulebook__dnd_edition", "school").distinct() ) paginator = DndPaginator(f.qs, request) form_submitted = 1 if "_filter" in request.GET else 0 return render_to_response( "dnd/spells/spell_index.html", { "request": request, "spell_list": paginator.items(), "paginator": paginator, "filter": f, "form_submitted": form_submitted, }, context_instance=RequestContext(request), )
def spell_verify(request, spell_id): if not is_admin(request): return HttpResponseForbidden("Forbidden.") spell = get_object_or_404(Spell, id=spell_id) spell.verified = True spell.verified_time = datetime.now() spell.verified_author = request.user spell.save() return permanent_redirect_object(request, spell)
def spell_index(request): if is_admin(request): f = SpellFilterAdmin(request.GET, queryset=Spell.objects.select_related( 'rulebook', 'rulebook__dnd_edition', 'school', 'verified_author').distinct()) else: f = SpellFilter(request.GET, queryset=Spell.objects.select_related( 'rulebook', 'rulebook__dnd_edition', 'school').distinct()) paginator = DndPaginator(f.qs, request) form_submitted = 1 if 'name' in request.GET else 0 return render_to_response('dnd/spells/spell_index.html', { 'request': request, 'spell_list': paginator.items(), 'paginator': paginator, 'filter': f, 'form_submitted': form_submitted, }, context_instance=RequestContext(request), )