Renamed category to detail
This commit is contained in:
parent
56b9e831c8
commit
57d591fee8
@ -433,8 +433,8 @@ class AssignmentPDF(PDFView):
|
|||||||
candidate_string = candidate.clean_name
|
candidate_string = candidate.clean_name
|
||||||
if candidate in elected_candidates:
|
if candidate in elected_candidates:
|
||||||
candidate_string = "* " + candidate_string
|
candidate_string = "* " + candidate_string
|
||||||
if candidate.category:
|
if candidate.name_suffix:
|
||||||
candidate_string += "\n(%s)" % candidate.category
|
candidate_string += "\n(%s)" % candidate.name_suffix
|
||||||
row.append(candidate_string)
|
row.append(candidate_string)
|
||||||
for vote in poll_list:
|
for vote in poll_list:
|
||||||
if vote == None:
|
if vote == None:
|
||||||
@ -594,7 +594,7 @@ class AssignmentPollPDF(PDFView):
|
|||||||
cell.append(Paragraph(circle + candidate.clean_name,
|
cell.append(Paragraph(circle + candidate.clean_name,
|
||||||
stylesheet['Ballot_option_name']))
|
stylesheet['Ballot_option_name']))
|
||||||
if candidate.name_suffix:
|
if candidate.name_suffix:
|
||||||
cell.append(Paragraph("(%s)" % candidate.category,
|
cell.append(Paragraph("(%s)" % candidate.name_suffix,
|
||||||
stylesheet['Ballot_option_group_right']))
|
stylesheet['Ballot_option_group_right']))
|
||||||
else:
|
else:
|
||||||
cell.append(Paragraph(" ",
|
cell.append(Paragraph(" ",
|
||||||
|
@ -27,7 +27,7 @@ class UserCreateForm(forms.ModelForm, CssClassMixin):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
fields = ('first_name', 'last_name', 'is_active', 'groups', 'category',
|
fields = ('first_name', 'last_name', 'is_active', 'groups', 'detail',
|
||||||
'gender', 'type', 'committee', 'comment', 'default_password')
|
'gender', 'type', 'committee', 'comment', 'default_password')
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ class UserUpdateForm(UserCreateForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
fields = ('username', 'first_name', 'last_name', 'is_active', 'groups',
|
fields = ('username', 'first_name', 'last_name', 'is_active', 'groups',
|
||||||
'category', 'gender', 'type', 'committee', 'comment',
|
'detail', 'gender', 'type', 'committee', 'comment',
|
||||||
'default_password')
|
'default_password')
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ class User(DjangoUser, PersonMixin, Person):
|
|||||||
)
|
)
|
||||||
|
|
||||||
django_user = models.OneToOneField(DjangoUser, editable=False, parent_link=True)
|
django_user = models.OneToOneField(DjangoUser, editable=False, parent_link=True)
|
||||||
category = models.CharField(
|
detail = models.CharField(
|
||||||
max_length=100, null=True, blank=True, verbose_name=_("Category"),
|
max_length=100, blank=True, default='', verbose_name=_("Detail"),
|
||||||
help_text=_('Will be shown behind the name.'))
|
help_text=_('Will be shown behind the name.'))
|
||||||
gender = models.CharField(
|
gender = models.CharField(
|
||||||
max_length=50, choices=GENDER_CHOICES, blank=True,
|
max_length=50, choices=GENDER_CHOICES, blank=True,
|
||||||
@ -47,13 +47,13 @@ class User(DjangoUser, PersonMixin, Person):
|
|||||||
max_length=100, choices=TYPE_CHOICES, blank=True,
|
max_length=100, choices=TYPE_CHOICES, blank=True,
|
||||||
verbose_name=_("Typ"), help_text=_('Only for filter the userlist.'))
|
verbose_name=_("Typ"), help_text=_('Only for filter the userlist.'))
|
||||||
committee = models.CharField(
|
committee = models.CharField(
|
||||||
max_length=100, null=True, blank=True, verbose_name=_("Committee"),
|
max_length=100, blank=True, default='', verbose_name=_("Committee"),
|
||||||
help_text=_('Only for filter the userlist.'))
|
help_text=_('Only for filter the userlist.'))
|
||||||
comment = models.TextField(
|
comment = models.TextField(
|
||||||
null=True, blank=True, verbose_name=_('Comment'),
|
blank=True, default='', verbose_name=_('Comment'),
|
||||||
help_text=_('Only for notes.'))
|
help_text=_('Only for notes.'))
|
||||||
default_password = models.CharField(
|
default_password = models.CharField(
|
||||||
max_length=100, null=True, blank=True,
|
max_length=100, blank=True, default='',
|
||||||
verbose_name=_("Default password"))
|
verbose_name=_("Default password"))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -61,10 +61,10 @@ class User(DjangoUser, PersonMixin, Person):
|
|||||||
return self.get_full_name() or self.username
|
return self.get_full_name() or self.username
|
||||||
|
|
||||||
def get_name_suffix(self):
|
def get_name_suffix(self):
|
||||||
return self.category
|
return self.detail
|
||||||
|
|
||||||
def set_name_suffix(self, value):
|
def set_name_suffix(self, value):
|
||||||
self.category = value
|
self.detail = value
|
||||||
|
|
||||||
name_suffix = property(get_name_suffix, set_name_suffix)
|
name_suffix = property(get_name_suffix, set_name_suffix)
|
||||||
|
|
||||||
|
@ -26,11 +26,11 @@
|
|||||||
<option value="female"{% if 'female' in sortfilter.gender %} selected{% endif %}>{% trans "Female" %}</option>
|
<option value="female"{% if 'female' in sortfilter.gender %} selected{% endif %}>{% trans "Female" %}</option>
|
||||||
<option value=""{% if '' in sortfilter.gender %} selected{% endif %}>{% trans "Not specified" %}</option>
|
<option value=""{% if '' in sortfilter.gender %} selected{% endif %}>{% trans "Not specified" %}</option>
|
||||||
</select>
|
</select>
|
||||||
<select class="default-input" name="category" onchange="document.forms['filter'].submit()">
|
<select class="default-input" name="detail" onchange="document.forms['filter'].submit()">
|
||||||
<option value="---">-- {% trans "Category" %} --</option>
|
<option value="---">-- {% trans "Detail" %} --</option>
|
||||||
{% for category in categories %}
|
{% for detail in details %}
|
||||||
<option value="{{ category }}"{% if category in sortfilter.category %} selected{% endif %}>
|
<option value="{{ detail }}"{% if detail in sortfilter.detail %} selected{% endif %}>
|
||||||
{{ category }}</option>
|
{{ detail }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
<select class="default-input" name="type" onchange="document.forms['filter'].submit()">
|
<select class="default-input" name="type" onchange="document.forms['filter'].submit()">
|
||||||
@ -65,7 +65,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th><a href="?sort=first_name&reverse={% if 'first_name' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "First Name" %}</a></th>
|
<th><a href="?sort=first_name&reverse={% if 'first_name' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "First Name" %}</a></th>
|
||||||
<th><a href="?sort=last_name&reverse={% if 'last_name' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Last Name" %}</a></th>
|
<th><a href="?sort=last_name&reverse={% if 'last_name' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Last Name" %}</a></th>
|
||||||
<th><a href="?sort=category&reverse={% if 'category' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Category" %}</a></th>
|
<th><a href="?sort=detail&reverse={% if 'detail' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Detail" %}</a></th>
|
||||||
<th><a href="?sort=type&reverse={% if 'type' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Type" %}</a></th>
|
<th><a href="?sort=type&reverse={% if 'type' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Type" %}</a></th>
|
||||||
<th><a href="?sort=committee&reverse={% if 'committee' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Committee" %}</a></th>
|
<th><a href="?sort=committee&reverse={% if 'committee' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Committee" %}</a></th>
|
||||||
{% if perms.participant.can_manage_participant %}
|
{% if perms.participant.can_manage_participant %}
|
||||||
@ -78,7 +78,7 @@
|
|||||||
<tr class="{% cycle '' 'odd' %}">
|
<tr class="{% cycle '' 'odd' %}">
|
||||||
<td>{{ user.first_name }}</td>
|
<td>{{ user.first_name }}</td>
|
||||||
<td>{{ user.last_name }}</td>
|
<td>{{ user.last_name }}</td>
|
||||||
<td>{{ user.category }}</td>
|
<td>{{ user.detail }}</td>
|
||||||
<td>{{ user.get_type_display }}</td>
|
<td>{{ user.get_type_display }}</td>
|
||||||
<td>{{ user.committee }}</td>
|
<td>{{ user.committee }}</td>
|
||||||
{% if perms.participant.can_manage_participant %}
|
{% if perms.participant.can_manage_participant %}
|
||||||
|
@ -35,12 +35,12 @@ class UserTest(TestCase):
|
|||||||
self.assertEqual(self.django_user1, self.user1.django_user)
|
self.assertEqual(self.django_user1, self.user1.django_user)
|
||||||
|
|
||||||
def test_repr(self):
|
def test_repr(self):
|
||||||
self.assertEqual(unicode(self.user1), u'Max Mustermann')
|
self.assertEqual(unicode(self.user1), 'Max Mustermann')
|
||||||
|
|
||||||
def test_name_surfix(self):
|
def test_name_surfix(self):
|
||||||
self.user1.category = u'München'
|
self.user1.detail = 'München'
|
||||||
self.user1.save()
|
self.user1.save()
|
||||||
self.assertEqual(unicode(self.user1), u'Max Mustermann (München)')
|
self.assertEqual(unicode(self.user1), 'Max Mustermann (München)')
|
||||||
|
|
||||||
def test_reset_password(self):
|
def test_reset_password(self):
|
||||||
self.assertIsInstance(self.user1.default_password, basestring)
|
self.assertIsInstance(self.user1.default_password, basestring)
|
||||||
|
@ -66,8 +66,8 @@ class Overview(ListView):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
sortfilter = {}
|
sortfilter = {}
|
||||||
|
|
||||||
for value in [u'gender', u'category', u'type', u'committee', u'status',
|
for value in ['gender', 'detail', 'type', 'committee', 'status',
|
||||||
u'sort', u'reverse']:
|
'sort', 'reverse']:
|
||||||
if value in self.request.REQUEST:
|
if value in self.request.REQUEST:
|
||||||
if self.request.REQUEST[value] == '---':
|
if self.request.REQUEST[value] == '---':
|
||||||
try:
|
try:
|
||||||
@ -80,8 +80,8 @@ class Overview(ListView):
|
|||||||
query = User.objects
|
query = User.objects
|
||||||
if 'gender' in sortfilter:
|
if 'gender' in sortfilter:
|
||||||
query = query.filter(gender__iexact=sortfilter['gender'][0])
|
query = query.filter(gender__iexact=sortfilter['gender'][0])
|
||||||
if 'category' in sortfilter:
|
if 'detail' in sortfilter:
|
||||||
query = query.filter(category__iexact=sortfilter['category'][0])
|
query = query.filter(detail__iexact=sortfilter['detail'][0])
|
||||||
if 'type' in sortfilter:
|
if 'type' in sortfilter:
|
||||||
query = query.filter(type__iexact=sortfilter['type'][0])
|
query = query.filter(type__iexact=sortfilter['type'][0])
|
||||||
if 'committee' in sortfilter:
|
if 'committee' in sortfilter:
|
||||||
@ -92,7 +92,7 @@ class Overview(ListView):
|
|||||||
if sortfilter['sort'][0] in ['first_name', 'last_name', 'last_login']:
|
if sortfilter['sort'][0] in ['first_name', 'last_name', 'last_login']:
|
||||||
query = query.order_by(sortfilter['sort'][0])
|
query = query.order_by(sortfilter['sort'][0])
|
||||||
elif (sortfilter['sort'][0] in
|
elif (sortfilter['sort'][0] in
|
||||||
['category', 'type', 'committee', 'comment']):
|
['detail', 'type', 'committee', 'comment']):
|
||||||
query = query.order_by(
|
query = query.order_by(
|
||||||
'%s' % sortfilter['sort'][0])
|
'%s' % sortfilter['sort'][0])
|
||||||
else:
|
else:
|
||||||
@ -118,8 +118,8 @@ class Overview(ListView):
|
|||||||
percent = 0
|
percent = 0
|
||||||
|
|
||||||
# list of all existing categories
|
# list of all existing categories
|
||||||
categories = [p['category'] for p in User.objects.values('category')
|
details = [p['detail'] for p in User.objects.values('detail')
|
||||||
.exclude(category='').distinct()]
|
.exclude(detail='').distinct()]
|
||||||
|
|
||||||
# list of all existing committees
|
# list of all existing committees
|
||||||
committees = [p['committee'] for p in User.objects.values('committee')
|
committees = [p['committee'] for p in User.objects.values('committee')
|
||||||
@ -127,7 +127,7 @@ class Overview(ListView):
|
|||||||
context.update({
|
context.update({
|
||||||
'allusers': all_users,
|
'allusers': all_users,
|
||||||
'percent': round(percent, 1),
|
'percent': round(percent, 1),
|
||||||
'categories': categories,
|
'details': details,
|
||||||
'committees': committees,
|
'committees': committees,
|
||||||
'cookie': ['participant_sortfilter', urlencode(decodedict(self.sortfilter),
|
'cookie': ['participant_sortfilter', urlencode(decodedict(self.sortfilter),
|
||||||
doseq=True)],
|
doseq=True)],
|
||||||
@ -223,7 +223,7 @@ class ParticipantsListPDF(PDFView):
|
|||||||
counter,
|
counter,
|
||||||
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.category, stylesheet['Tablecell']),
|
Paragraph(user.detail, stylesheet['Tablecell']),
|
||||||
Paragraph(user.type, stylesheet['Tablecell']),
|
Paragraph(user.type, stylesheet['Tablecell']),
|
||||||
Paragraph(user.committee, stylesheet['Tablecell'])])
|
Paragraph(user.committee, stylesheet['Tablecell'])])
|
||||||
t = LongTable(data, style=[
|
t = LongTable(data, style=[
|
||||||
|
Loading…
Reference in New Issue
Block a user