# # Views for the various models in the player application. # from django.shortcuts import render_to_response, get_object_or_404 from guildbuilder.apps.links.models import * from django.template import RequestContext # Our index view for skills/spells. def index(request): cat_list = Category.objects.filter(parent__isnull=True).order_by('-name') cat_count = Category.objects.count() link_count = Link.objects.count() pagevars = { "page_title": "Links Index", "cat_list": cat_list, "cat_count": cat_count, "link_count": link_count, } context_instance = RequestContext(request) return render_to_response('links/index.html', pagevars, context_instance) # Show an individual skill/spell. def show_cat(request, cat_id): disped_cat = get_object_or_404(Category, pk=cat_id) cat_links = Link.objects.filter(category=disped_cat) cat_subcats = Category.objects.filter(parent=disped_cat) pagevars = { "page_title": "Link Category", "cat": disped_cat, "links": cat_links, "subcats": cat_subcats, } context_instance = RequestContext(request) return render_to_response('links/show_cat.html', pagevars, context_instance)