#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:
model = User
fields = ('first_name', 'last_name', 'is_active', 'groups', 'structure_level',
'gender', 'type', 'committee', 'about_me', 'comment', 'default_password')
fields = ('title', 'first_name', 'last_name', 'gender', 'groups', 'structure_level',
'type', 'committee', 'about_me', 'comment', 'default_password', 'is_active')
class UserUpdateForm(UserCreateForm):

View File

@ -41,6 +41,9 @@ class User(PersonMixin, Person, SlideMixin, DjangoUser):
structure_level = models.CharField(
max_length=100, blank=True, default='', verbose_name=_("Structure level"),
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(
max_length=50, choices=GENDER_CHOICES, blank=True,
verbose_name=_("Gender"), help_text=_('Only for filtering the participant list.'))
@ -62,7 +65,11 @@ class User(PersonMixin, Person, SlideMixin, DjangoUser):
@property
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):
return self.structure_level

View File

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

View File

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