Package madrona :: Package help :: Module views
[hide private]

Source Code for Module madrona.help.views

 1  from django.http import HttpResponse, HttpResponseRedirect, HttpResponseBadRequest, HttpResponseServerError, HttpResponseForbidden 
 2  from django.template import RequestContext, Context 
 3  from django.template.loader import get_template 
 4  from django.shortcuts import get_object_or_404, render_to_response 
 5  from django.conf import settings 
 6  from madrona.screencasts.models import YoutubeScreencast 
 7  from madrona.simplefaq.models import * 
 8   
9 -def get_faqs():
10 faq_groups = FaqGroup.objects.all().order_by('importance') 11 faqs_by_group = [] 12 #Build an faq list by group, then by faq. order them by importance 13 for group in faq_groups: 14 faq_query = Faq.objects.filter(faq_group__faq_group_name=group.faq_group_name).order_by('importance') 15 faqs_by_group.append({'group_obj':group,'group_faqs':faq_query}) 16 return faqs_by_group
17
18 -def get_vids():
19 #return Screencast.objects.filter(selected_for_help=True).order_by('importance') 20 return YoutubeScreencast.objects.filter(selected_for_help=True).order_by('importance')
21 22
23 -def help(request):
24 vids = get_vids() 25 faqs = get_faqs() 26 c = RequestContext(request, 27 {'faqs_by_group':faqs, 'screencast_list':vids, 'MEDIA_URL':settings.MEDIA_URL} 28 ) 29 return render_to_response('help.html', c)
30