Source

Resume / resume_app / myproject / web / views.py

Full commit
# -*- coding: utf-8 -*-

from datetime import datetime, timedelta
from django.views.generic import *
from django.db.models import Count
from django.http import HttpResponse
from django.core.urlresolvers import reverse
from django.shortcuts import redirect, get_object_or_404

from web.forms import *
from web.models import *

class ApplicantListView(ListView):
    model = Applicant
    template_name = "applicant_list.django.html"
    context_object_name = "applicants"

class ApplicantView(DetailView):
    model = Applicant
    template_name = "applicant.django.html"
    context_object_name = "applicant"
    def get_context_data(self, **kwargs):
        context = kwargs
        applicant = context.get("object")
        context[self.context_object_name] = applicant
        skill_groups = []
        for group in SkillGroup.objects.all():
            skills = applicant.skills.filter(group=group)
            if skills.count():
                skill_groups.append({"group":group, "skills":skills})
        context["skill_groups"] = skill_groups
        return context

class ContactView(ApplicantView):
    template_name = "applicant_contact.django.html"