[snowy: 25/26] Remove display_name property from UserProfile
- From: Sanford Armstrong <sharm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [snowy: 25/26] Remove display_name property from UserProfile
- Date: Tue, 22 Jun 2010 20:59:06 +0000 (UTC)
commit bf267064ec4b00c98d8093ced55ddb03686f4880
Author: Leon Handreke <leon handreke gmail com>
Date: Mon May 31 22:38:15 2010 +0200
Remove display_name property from UserProfile
accounts/forms.py | 8 ------
accounts/models.py | 3 --
accounts/templates/accounts/preferences.html | 17 --------------
.../templates/registration/registration_form.html | 9 -------
accounts/views.py | 24 +++----------------
templates/base.html | 24 +++++---------------
6 files changed, 10 insertions(+), 75 deletions(-)
---
diff --git a/accounts/forms.py b/accounts/forms.py
index 1134800..426d574 100644
--- a/accounts/forms.py
+++ b/accounts/forms.py
@@ -92,16 +92,8 @@ class InternationalizationForm(forms.ModelForm):
model = UserProfile
fields = ('language', )
-class DisplayNameChangeForm(forms.ModelForm):
- class Meta:
- model = UserProfile
- fields = ('display_name',)
-
class EmailChangeForm(forms.ModelForm):
class Meta:
model = User
fields = ('email', )
- def __init__(self, *args, **kwargs):
- super(EmailChangeForm, self).__init__(*args, **kwargs)
- self.fields['email'].required = True
diff --git a/accounts/models.py b/accounts/models.py
index eb5823a..82325fb 100644
--- a/accounts/models.py
+++ b/accounts/models.py
@@ -33,9 +33,6 @@ class UserProfile(models.Model):
language = models.CharField(max_length=5, choices=settings.LANGUAGES,
verbose_name=_(u'Application Language'),
null=True, blank=True)
- display_name = models.CharField(_('display name'), max_length=80,
- blank=True,
- help_text=_(u'Optional. Will be displayed to other users when sharing notes.'))
openid_user = models.BooleanField(verbose_name=_(u'OpenID User'),)
def __unicode__(self):
diff --git a/accounts/templates/accounts/preferences.html b/accounts/templates/accounts/preferences.html
index 0272c5a..b88f2fe 100644
--- a/accounts/templates/accounts/preferences.html
+++ b/accounts/templates/accounts/preferences.html
@@ -36,23 +36,6 @@
<input type="hidden" name="email_form" value="1" />
</form>
-<h3>{% trans "Change your display name" %}</h3>
-<form method="POST">
- <table class="input-form">
- {{ display_name_form.as_table }}
- <tfoot>
- <tr>
- <th></th>
- <td>
- <input type="submit" value="{% trans "Save" %}"/>
- </td>
- </tr>
- </tfoot>
- </table>
- <input type="hidden" name="display_name_form" value="1" />
-</form>
-
-
<h3>{% trans "Internationalization" %}</h3>
<form method="POST">
<table class="input-form">
diff --git a/accounts/templates/registration/registration_form.html b/accounts/templates/registration/registration_form.html
index 8642f67..9cbdac5 100644
--- a/accounts/templates/registration/registration_form.html
+++ b/accounts/templates/registration/registration_form.html
@@ -41,15 +41,6 @@
</p>
{% endif %}
- {% if form.display_name %}
- <p>
- <label for="display_name" class="registration-form-label">{{ form.display_name.label }}:</label>
- {{ form.display_name }}
- <span class="registration-form-errors">{{ form.display_name.errors.0 }}</span>
- <br /><span class="registration-form-help-text">{{ form.display_name.help_text }}<span>
- </p>
- {% endif %}
-
{% if form.captcha %}
<p>
{{ form.captcha }}
diff --git a/accounts/views.py b/accounts/views.py
index d8e7d46..184d2c1 100644
--- a/accounts/views.py
+++ b/accounts/views.py
@@ -28,7 +28,7 @@ from django.template import RequestContext
from django.conf import settings
from snowy.accounts.models import UserProfile
-from snowy.accounts.forms import InternationalizationForm, OpenIDRegistrationFormUniqueUser
+from snowy.accounts.forms import InternationalizationForm, OpenIDRegistrationFormUniqueUser, EmailChangeForm
from django_openid_auth import auth
@@ -59,10 +59,6 @@ def openid_registration(request, template_name='registration/registration_form.h
if email:
user.email = email
- #display_name = registration_form.cleaned_data.get('display_name')
- #if display_name:
- # user.get_profile().display_name = display_name
-
user.save()
user.get_profile().save()
if user.is_active:
@@ -90,26 +86,15 @@ def accounts_preferences(request, template_name='accounts/preferences.html'):
password_form = PasswordChangeForm(user)
if 'email_form' in request.POST:
- email_form = EmailChangeForm(request.POST, instance=profile)
+ email_form = EmailChangeForm(request.POST, instance=user)
if email_form.is_valid():
- print 'Email form is valid!'
email_form.save()
else:
- email_form = EmailChangeForm(instance=profile)
-
- if 'display_name_form' in request.POST:
- display_name_form = DisplayNameChangeForm(request.POST, instance=profile)
- if display_name_form.is_valid():
- print 'Display Name form is valid!'
- display_name_form.save()
- else:
- display_name_form = DisplayNameChangeForm(instance=profile)
-
+ email_form = EmailChangeForm(instance=user)
if 'i18n_form' in request.POST:
i18n_form = InternationalizationForm(request.POST, instance=profile)
if i18n_form.is_valid():
- print 'Internationalization form is valid!'
i18n_form.save()
else:
i18n_form = InternationalizationForm(instance=profile)
@@ -117,6 +102,5 @@ def accounts_preferences(request, template_name='accounts/preferences.html'):
return render_to_response(template_name,
{'user': user, 'i18n_form': i18n_form,
'password_form': password_form,
- 'email_form' : email_form,
- 'display_name_form' : display_name_form},
+ 'email_form' : email_form},
context_instance=RequestContext(request))
diff --git a/templates/base.html b/templates/base.html
index 56c0b52..673386b 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -29,32 +29,20 @@
</a>
</td>
<td id="header-auth">
-{% if user.is_authenticated %}
+ {% if user.is_authenticated %}
<h3>
- {% if user.get_profile.registration_complete %}
- {% if user.get_profile.display_name %}
- {{ user.get_profile.display_name }}
- {% else %}
- {{ user }}
- {% endif %}
- {% else %}
- {% trans "OpenID User" %}
- {% endif %}
+ {{ user }}
</h3>
<p><a href="{% url preferences %}">{% trans "preferences" %}</a> / <a href="{% url django.contrib.auth.views.logout %}">{% trans "log out" %}</a></p>
-{% else %}
+ {% else %}
<p>{% trans "hello stranger! care to " %}<a href="{% url openid_login %}">{% trans "log in" %}</a>{% trans "?" %}</p>
<!--<p><small>{% trans "not a member yet?" %} <a href="{% url registration.views.register %}">{% trans "Sign up." %}</a></small></p>-->
-{% endif %}
+ {% endif %}
</td>
<td id="header-avatar">
-{% if user.is_authenticated %}
-{% if user.get_profile.registration_complete %}
+ {% if user.is_authenticated %}
<a href="{% url notes.views.note_index user.username %}">{% gravatar_img_for_user user 64 %}</a>
-{% else %}
- <img src="{{MEDIA_URL}}/img/accounts/openid.png" height="64" width="64" alt="OpenID icon">
-{% endif %}
-{% endif %}
+ {% endif %}
</td>
</tr>
</table>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]