Unverified Commit 9c26881f authored by Joost Rijneveld's avatar Joost Rijneveld
Browse files

Re-introduce 'firstname' as display option

parent 6e5575fc
......@@ -105,7 +105,7 @@ class Command(BaseCommand):
user.member.display_name_preference = {
'Full name': 'full',
'Initials and last name': 'initials',
'First name': 'full',
'First name': 'firstname',
'Nickname': 'nickname',
'First name + nickname + last name': 'fullnick',
'Nickname + last name': 'nicklast',
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-01 20:44
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('members', '0008_member_initials'),
]
operations = [
migrations.AlterField(
model_name='member',
name='display_name_preference',
field=models.CharField(choices=[('full', 'Show full name'), ('nickname', 'Show only nickname'), ('firstname', 'Show only first name'), ('initials', 'Show initials and last name'), ('fullnick', 'Show name like "John \'nickname\' Doe"'), ('nicklast', 'Show nickname and last name')], default='full', max_length=10, verbose_name='How to display name'),
),
]
......@@ -238,6 +238,7 @@ class Member(models.Model):
verbose_name=_('How to display name'),
choices=(('full', _('Show full name')),
('nickname', _('Show only nickname')),
('firstname', _('Show only first name')),
('initials', _('Show initials and last name')),
('fullnick', _("Show name like \"John 'nickname' Doe\"")),
('nicklast', _("Show nickname and last name"))),
......@@ -292,6 +293,8 @@ class Member(models.Model):
pref = self.display_name_preference
if pref == 'nickname':
return self.nickname
if pref == 'firstname':
return self.user.first_name
elif pref == 'initials':
return '{} {}'.format(self.initials, self.user.last_name)
elif pref == 'fullnick':
......
Markdown is supported
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