Commit a2ebd31a authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Show mentorship on profile pages and fix issues in model.

Squashed commits:
[e05e712] Rename Mentors to Mentorship instead of Mentor
[a694422] Fix PEP
[16ecef4] Add 'mentor achievement' to member profiles
[dd10f23] Fix the string format

Gave an exception when saving the model in the admin
[88717d0] Add admin for the mentor model
[08eb778] Change mentors to mentor (all models are singular)
parent 8ad68bee
......@@ -20,3 +20,8 @@ class BoardAdmin(admin.ModelAdmin):
class CommitteeMembershipAdmin(admin.ModelAdmin):
class MentorsAdmin(admin.ModelAdmin):
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-06 08:15
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('committees', '0007_mentors'),
operations = [
......@@ -248,9 +248,9 @@ class CommitteeMembership(models.Model):
verbose_name_plural = _('committee memberships')
class Mentors(models.Model):
class Mentorship(models.Model):
members = models.ManyToManyField(Member)
year = models.IntegerField(unique=True)
def __str__(self):
return _("Mentor introduction {year}".format(self.year))
return _("Mentor introduction {year}").format(year=self.year)
......@@ -109,6 +109,14 @@ def profile(request, pk):
achievements[name]['periods'].sort(key=lambda period: period['since'])
mentor_years = member.mentor_set.all()
for mentor_year in mentor_years:
name = str(mentor_year)
if not achievements.get(name):
achievements[name] = {
'name': name
return render(request, 'members/profile.html',
{'member': member, 'achievements': achievements.values()})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment