rearange the userprofile. Only show first line from the user.profile.comment in the overview

This commit is contained in:
Oskar Hahn 2012-06-23 15:02:13 +02:00
parent 442a24ccd8
commit 7df1264abf
2 changed files with 21 additions and 7 deletions

View File

@ -30,12 +30,18 @@ class Profile(models.Model):
)
user = models.OneToOneField(User, unique=True, editable=False)
gender = models.CharField(max_length=50, choices=GENDER_CHOICES, blank=True, verbose_name = _("Gender"))
group = models.CharField(max_length=100, null=True, blank=True, verbose_name = _("Group"))
type = models.CharField(max_length=100, choices=TYPE_CHOICE, blank=True, verbose_name = _("Typ"))
committee = models.CharField(max_length=100, null=True, blank=True, verbose_name = _("Committee"))
comment = models.CharField(max_length=255, null=True, blank=True, verbose_name = _("Comment"))
firstpassword = models.CharField(max_length=100, null=True, blank=True, verbose_name = _("First Password"))
group = models.CharField(max_length=100, null=True, blank=True,
verbose_name = _("Group"), help_text=_('Shown behind the name.'))
gender = models.CharField(max_length=50, choices=GENDER_CHOICES, blank=True,
verbose_name = _("Gender"), help_text=_('Only for filter the userlist.'))
type = models.CharField(max_length=100, choices=TYPE_CHOICE, blank=True,
verbose_name = _("Typ"), help_text=_('Only for filter the userlist.'))
committee = models.CharField(max_length=100, null=True, blank=True,
verbose_name = _("Committee"), help_text=_('Only for filter the userlist.'))
comment = models.TextField(null=True, blank=True, verbose_name = _('Comment'),
help_text=_('Only for notes.'))
firstpassword = models.CharField(max_length=100, null=True, blank=True,
verbose_name = _("First Password"))
def reset_password(self):
@ -57,6 +63,14 @@ class Profile(models.Model):
if link == 'delete':
return ('user_delete', [str(self.user.id)])
def get_comment_line(self):
lines = self.comment.split('\n')
if len(lines) > 1 or len(lines[0]) > 40:
s = "%s ..."
else:
s = "%s"
return s % lines[0][:40]
def __unicode__(self):
if self.group:
return "%s (%s)" % (self.user.get_full_name(), self.group)

View File

@ -80,7 +80,7 @@
<td>{{ user.profile.get_type_display }}</td>
<td>{{ user.profile.committee }}</td>
{% if perms.participant.can_manage_participant %}
<td>{{ user.profile.comment }}</td>
<td>{{ user.profile.get_comment_line }}</td>
<td>{% if user.last_login > user.date_joined %}
{{ user.last_login }}
{% endif %}</td>