#436: New participant field 'title'

This commit is contained in:
Emanuel Schuetze 2013-04-08 21:47:33 +02:00
parent dc65f5e349
commit 051f9af1f7
4 changed files with 14 additions and 4 deletions

View File

@ -36,8 +36,8 @@ class UserCreateForm(forms.ModelForm, CssClassMixin):
class Meta: class Meta:
model = User model = User
fields = ('first_name', 'last_name', 'is_active', 'groups', 'structure_level', fields = ('title', 'first_name', 'last_name', 'gender', 'groups', 'structure_level',
'gender', 'type', 'committee', 'about_me', 'comment', 'default_password') 'type', 'committee', 'about_me', 'comment', 'default_password', 'is_active')
class UserUpdateForm(UserCreateForm): class UserUpdateForm(UserCreateForm):

View File

@ -41,6 +41,9 @@ class User(PersonMixin, Person, SlideMixin, DjangoUser):
structure_level = models.CharField( structure_level = models.CharField(
max_length=100, blank=True, default='', verbose_name=_("Structure level"), max_length=100, blank=True, default='', verbose_name=_("Structure level"),
help_text=_('Will be shown after the name.')) help_text=_('Will be shown after the name.'))
title = models.CharField(
max_length=50, blank=True, default='', verbose_name=_("Titel"),
help_text=_('Will be shown before the name.'))
gender = models.CharField( gender = models.CharField(
max_length=50, choices=GENDER_CHOICES, blank=True, max_length=50, choices=GENDER_CHOICES, blank=True,
verbose_name=_("Gender"), help_text=_('Only for filtering the participant list.')) verbose_name=_("Gender"), help_text=_('Only for filtering the participant list.'))
@ -62,7 +65,11 @@ class User(PersonMixin, Person, SlideMixin, DjangoUser):
@property @property
def clean_name(self): def clean_name(self):
return self.get_full_name() or self.username if self.title:
name = "%s %s" % (self.title, self.get_full_name())
else:
name = self.get_full_name()
return name or self.username
def get_name_suffix(self): def get_name_suffix(self):
return self.structure_level return self.structure_level

View File

@ -59,6 +59,7 @@
<thead> <thead>
<tr> <tr>
<th>{% trans "Present" %}</th> <th>{% trans "Present" %}</th>
<th>{% trans "Title" %}</th>
<th>{% trans "First Name" %}</th> <th>{% trans "First Name" %}</th>
<th>{% trans "Last Name" %}</th> <th>{% trans "Last Name" %}</th>
<th class="optional">{% trans "Structure level" %}</th> <th class="optional">{% trans "Structure level" %}</th>
@ -88,6 +89,7 @@
title="{% if user.is_active %}{% trans 'present' %}{% else %}{% trans 'absent' %}{% endif %}"></i> title="{% if user.is_active %}{% trans 'present' %}{% else %}{% trans 'absent' %}{% endif %}"></i>
{% endif %} {% endif %}
</td> </td>
<td>{{ user.title }}</td>
<td><a href="{% url 'user_view' user.id %}">{{ user.first_name }}</a></td> <td><a href="{% url 'user_view' user.id %}">{{ user.first_name }}</a></td>
<td><a href="{% url 'user_view' user.id %}">{{ user.last_name }}</a></td> <td><a href="{% url 'user_view' user.id %}">{{ user.last_name }}</a></td>
<td class="optional">{{ user.structure_level }}</td> <td class="optional">{{ user.structure_level }}</td>

View File

@ -184,7 +184,7 @@ class ParticipantsListPDF(PDFView):
document_title = ugettext_lazy('List of Participants') document_title = ugettext_lazy('List of Participants')
def append_to_pdf(self, story): def append_to_pdf(self, story):
data = [['#', _('Last Name'), _('First Name'), _('Group'), _('Type'), data = [['#', _('Title'), _('Last Name'), _('First Name'), _('Group'), _('Type'),
_('Committee')]] _('Committee')]]
if config['participant_sort_users_by_first_name']: if config['participant_sort_users_by_first_name']:
sort = 'first_name' sort = 'first_name'
@ -195,6 +195,7 @@ class ParticipantsListPDF(PDFView):
counter += 1 counter += 1
data.append([ data.append([
counter, counter,
Paragraph(user.title, stylesheet['Tablecell']),
Paragraph(user.last_name, stylesheet['Tablecell']), Paragraph(user.last_name, stylesheet['Tablecell']),
Paragraph(user.first_name, stylesheet['Tablecell']), Paragraph(user.first_name, stylesheet['Tablecell']),
Paragraph(user.structure_level, stylesheet['Tablecell']), Paragraph(user.structure_level, stylesheet['Tablecell']),