# # Views for the various models in the player application. # from django.shortcuts import render_to_response, get_object_or_404 from guildbuilder.apps.player.models import * from django.template import RequestContext # Our index view for skills/spells. def index(request): prof_list = Profession.objects.all().order_by('-name') pagevars = { "page_title": "Skill Index", "prof_list": prof_list, } context_instance = RequestContext(request) return render_to_response('skills/index.html', pagevars, context_instance) # Show an individual skill/spell. def show_skill(request, skill_id): disped_skill = get_object_or_404(Skill, pk=skill_id) pagevars = { "page_title": "Skill Details", "skill": disped_skill, } context_instance = RequestContext(request) return render_to_response('skills/show_skill.html', pagevars, context_instance) # Show the skills for a given profession. def show_prof(request, prof_id): disped_prof = get_object_or_404(Profession, pk=prof_id) prof_name = disped_prof.name pagevars = { "page_title": prof_name + " Skills", "prof": disped_prof, } context_instance = RequestContext(request) return render_to_response('skills/prof_skills.html', pagevars, context_instance)