Fixed radio buttons in user profile view

This commit is contained in:
Fergal Moran
2014-08-28 20:29:14 +01:00
parent 6c8c06a7ed
commit ab4ae43279
4 changed files with 22 additions and 52 deletions

View File

@@ -1,28 +0,0 @@
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import NoArgsCommand, CommandError
from spa.models import UserProfile
from core.utils.url import unique_slugify
class Command(NoArgsCommand):
help = "Updates audio files with their durations"
def handle(user, *args, **options):
try:
candidates = User.objects.all()
for user in candidates:
try:
profile = user.get_profile()
except ObjectDoesNotExist, ce:
print "Creating profile for %s" % user.get_username()
UserProfile.objects.create(user=user)
profile = user.get_profile()
if profile.slug is None or profile.slug == '':
profile.slug = unique_slugify(profile, user.get_username())
print "Slugified: %s" % profile.slug
profile.save()
user.save()
except Exception, ex:
raise CommandError(ex.message)

View File

@@ -67,21 +67,14 @@ class UserProfile(BaseModel):
Save Photo after ensuring it is not blank. Resize as needed. Save Photo after ensuring it is not blank. Resize as needed.
""" """
if self.slug is None or self.slug == '': if self.slug is None or self.slug == '':
self.slug = unique_slugify(self, self.get_username()) self.slug = unique_slugify(self, self.user.get_username())
print "Slugified: %s" % self.slug print "Slugified: %s" % self.slug
"""
Check if follower has been added
"""
l = self.get_dirty_fields()
return super(UserProfile, self).save(force_insert, force_update, using, update_fields) return super(UserProfile, self).save(force_insert, force_update, using, update_fields)
def get_username(self): def get_username(self):
return self.user.username return self.user.username
username = property(get_username)
def get_email(self): def get_email(self):
return self.user.email return self.user.email

View File

@@ -84,7 +84,7 @@
My Profile My Profile
</a> </a>
</li> </li>
<li class="purple"> <li >
<a href="/me"> <a href="/me">
<i class="menu-icon fa fa-cogs"></i> <i class="menu-icon fa fa-cogs"></i>
Settings Settings

View File

@@ -33,22 +33,27 @@
value="<%= email %>"> value="<%= email %>">
</div> </div>
</div> </div>
<div class="clearfix control-group" id="div_avatar_image_select">
<label class="control-label requiredField" for="avatar_image_select_0">Avatar Image
<span class="asteriskField">*</span></label>
<div class="controls"> <div class="control-group">
<label class="radio"> <label class="control-label bolder blue">Avatar Image</label>
Use gravatar image.
<input type="radio" id='avatar_gravatar' value='gravatar' name="avatar_type"/> <div class="radio">
<label>
<input type="radio" id='avatar_gravatar' value='gravatar' name="avatar_type"
class="ace"/>
<span class="lbl"> Use gravatar image.</span>
</label> </label>
<label class="radio"> </div>
Use Twitter/Facebook image. <div class="radio">
<input type="radio" id='avatar_social' value='social' name="avatar_type"/> <label>
<input type="radio" id='avatar_social' value='social' name="avatar_type" class="ace"/>
<span class="lbl"> Use Twitter/Facebook image.</span>
</label> </label>
<label class="radio"> </div>
Use custom image. <div class="radio">
<input type="radio" id='avatar_custom' value='custom' name="avatar_type"/> <label>
<input type="radio" id='avatar_custom' value='custom' name="avatar_type" class="ace"/>
<span class="lbl"> Use custom image.</span>
</label> </label>
</div> </div>
</div> </div>
@@ -80,12 +85,12 @@
<td> <td>
<input type="checkbox" name="activity_sharing_favourites" <input type="checkbox" name="activity_sharing_favourites"
id="activity_sharing_favourites" id="activity_sharing_favourites"
<%= renderCheckbox(activity_sharing_favourites) %>> <%= renderCheckbox(activity_sharing_favourites) %>>
</td> </td>
<td> <td>
<input type="checkbox" name="activity_sharing_comments" <input type="checkbox" name="activity_sharing_comments"
id="activity_sharing_comments" id="activity_sharing_comments"
<%= renderCheckbox(activity_sharing_comments) %>> <%= renderCheckbox(activity_sharing_comments) %>>
</td> </td>
</tr> </tr>
</tbody> </tbody>