Commit 937b64e5 authored by Michal Čihař's avatar Michal Čihař

Use first_name field for full name

I don't want to override User model, so let's stick with confusing
naming.

Issue #401
parent 3bed442c
...@@ -26,7 +26,7 @@ from django.contrib.auth.models import User ...@@ -26,7 +26,7 @@ from django.contrib.auth.models import User
class ProfileAdmin(admin.ModelAdmin): class ProfileAdmin(admin.ModelAdmin):
list_display = [ list_display = [
'user', 'get_full_name', 'language', 'suggested', 'translated' 'user', 'full_name', 'language', 'suggested', 'translated'
] ]
search_fields = [ search_fields = [
'user__username', 'user__email', 'user__first_name', 'user__last_name' 'user__username', 'user__email', 'user__first_name', 'user__last_name'
......
...@@ -538,11 +538,12 @@ class Profile(models.Model): ...@@ -538,11 +538,12 @@ class Profile(models.Model):
} }
) )
def get_full_name(self): @property
def full_name(self):
''' '''
Returns user's full name. Returns user's full name.
''' '''
return self.user.get_full_name() return self.user.first_name
def get_secondary_units(self, unit): def get_secondary_units(self, unit):
''' '''
......
...@@ -215,7 +215,7 @@ def get_initial_contact(request): ...@@ -215,7 +215,7 @@ def get_initial_contact(request):
''' '''
initial = {} initial = {}
if request.user.is_authenticated(): if request.user.is_authenticated():
initial['name'] = request.user.get_full_name() initial['name'] = request.user.first_name
initial['email'] = request.user.email initial['email'] = request.user.email
return initial return initial
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</p> </p>
<p> <p>
{% blocktrans with site|site_title as site_title and user.get_full_name as username %}{{ username }} has just made a first contribution on {{ translation }} at {{ site_title }}.{% endblocktrans %} {% blocktrans with site|site_title as site_title and user.first_name as username %}{{ username }} has just made a first contribution on {{ translation }} at {{ site_title }}.{% endblocktrans %}
<p> <p>
{% include "mail/footer.html" %} {% include "mail/footer.html" %}
......
{% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %} {% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %}
{% blocktrans with site|site_title as site_title and user.get_full_name as username %}{{ username }} has just made a first contribution on {{ translation }} at {{ site_title }}.{% endblocktrans %} {% blocktrans with site|site_title as site_title and user.first_name as username %}{{ username }} has just made a first contribution on {{ translation }} at {{ site_title }}.{% endblocktrans %}
{% endfilter%}{% endautoescape %}{% include "mail/footer.txt" %} {% endfilter%}{% endautoescape %}{% include "mail/footer.txt" %}
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</th> </th>
<td> <td>
<a href="mailto:{{ user.email }}">{{ user.get_full_name }}</a> <a href="mailto:{{ user.email }}">{{ user.first_name }}</a>
</td> </td>
</tr> </tr>
......
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
{% trans "Requesting user:" %} {% trans "Requesting user:" %}
{{ user.get_full_name }} <{{ user.email }}> {{ user.first_name }} <{{ user.email }}>
{% endfilter%}{% endautoescape %}{% include "mail/footer.txt" %} {% endfilter%}{% endautoescape %}{% include "mail/footer.txt" %}
...@@ -735,7 +735,7 @@ class Translation(models.Model, URLMixin, PercentMixin): ...@@ -735,7 +735,7 @@ class Translation(models.Model, URLMixin, PercentMixin):
Returns formatted author name with email. Returns formatted author name with email.
''' '''
# Get full name from database # Get full name from database
full_name = user.get_full_name() full_name = user.first_name
# Use username if full name is empty # Use username if full name is empty
if full_name == '': if full_name == '':
......
...@@ -109,7 +109,7 @@ def get_user_display(user, icon=True, link=False): ...@@ -109,7 +109,7 @@ def get_user_display(user, icon=True, link=False):
email = '' email = ''
else: else:
# Get full name # Get full name
full_name = user.get_full_name() full_name = user.first_name
# Use user name if full name is empty # Use user name if full name is empty
if full_name.strip() == '': if full_name.strip() == '':
......
...@@ -75,7 +75,7 @@ def home(request): ...@@ -75,7 +75,7 @@ def home(request):
# Warn about not filled in username (usually caused by migration of # Warn about not filled in username (usually caused by migration of
# users from older system # users from older system
if not request.user.is_anonymous() and request.user.get_full_name() == '': if not request.user.is_anonymous() and request.user.first_name == '':
messages.warning( messages.warning(
request, request,
_('Please set your full name in your profile.') _('Please set your full name in your profile.')
......
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