from django.http import HttpResponse from django.template import Context, loader from projects.models import Project def project(request, object_id): project = Project.objects.get(pk=object_id) stats_dict = { "Status": project.get_status_display(), "Languages": ", ".join([language.name for language in project.languages.all()]), } links_dict = { "Source": project.source_url, "Bugtracker": project.bugtracker_url, "Wiki": project.wiki_url, } t = loader.get_template("projects/project_detail.html") c = Context({ "object": project, "stats": stats_dict, "links": links_dict, }) return HttpResponse(t.render(c))