Commit 196774da3e2de82598b36b729ca0e0356efc75ab
1 parent
671b8263
Exists in
master
and in
39 other branches
Accessing profile fields using user fields
Showing
4 changed files
with
13 additions
and
61 deletions
Show diff stats
src/accounts/templates/accounts/user-profile.html
... | ... | @@ -26,25 +26,25 @@ |
26 | 26 | <div class="divider"></div> |
27 | 27 | |
28 | 28 | <ul class="unstyled-list"> |
29 | - {% if user_.profile.institution or user_.profile.role %} | |
29 | + {% if user_.institution or user_.role %} | |
30 | 30 | <li> |
31 | 31 | <span class="icon-briefcase icon-fixed-width"></span> |
32 | - {{ user_.profile.role }} | |
33 | - {% if user_.profile.institution and user_.profile.role %}-{% endif %} | |
34 | - {{ user_.profile.institution }} | |
32 | + {{ user_.role }} | |
33 | + {% if user_.institution and user_.role %}-{% endif %} | |
34 | + {{ user_.institution }} | |
35 | 35 | </li> |
36 | 36 | {% endif %} |
37 | - {% if user_.profile.twitter %} | |
38 | - <li><span class="icon-twitter icon-fixed-width"></span> {{ user_.profile.twitter }}</li> | |
37 | + {% if user_.twitter %} | |
38 | + <li><span class="icon-twitter icon-fixed-width"></span> {{ user_.twitter }}</li> | |
39 | 39 | {% endif %} |
40 | - {% if user_.profile.facebook %} | |
41 | - <li><span class="icon-facebook icon-fixed-width"></span> {{ user_.profile.facebook }}</li> | |
40 | + {% if user_.facebook %} | |
41 | + <li><span class="icon-facebook icon-fixed-width"></span> {{ user_.facebook }}</li> | |
42 | 42 | {% endif %} |
43 | - {% if user_.profile.google_talk %} | |
44 | - <li><span class="icon-google-plus icon-fixed-width"></span> {{ user_.profile.google_talk }}</li> | |
43 | + {% if user_.google_talk %} | |
44 | + <li><span class="icon-google-plus icon-fixed-width"></span> {{ user_.google_talk }}</li> | |
45 | 45 | {% endif %} |
46 | - {% if user_.profile.webpage %} | |
47 | - <li><span class="icon-link icon-fixed-width"></span> {{ user_.profile.webpage }}</li> | |
46 | + {% if user_.webpage %} | |
47 | + <li><span class="icon-link icon-fixed-width"></span> {{ user_.webpage }}</li> | |
48 | 48 | {% endif %} |
49 | 49 | </ul> |
50 | 50 | </div> | ... | ... |
src/colab/deprecated/signup.py
src/colab/deprecated/views/userprofile.py
... | ... | @@ -1,40 +0,0 @@ |
1 | -#!/usr/bin/env python | |
2 | -# encoding: utf-8 | |
3 | -""" | |
4 | -userprofile.py | |
5 | - | |
6 | -Created by Sergio Campos on 2012-01-10. | |
7 | -""" | |
8 | - | |
9 | -from django.contrib.auth.models import User | |
10 | -from django.forms.models import model_to_dict | |
11 | -from django.contrib.auth.decorators import login_required | |
12 | -from django.shortcuts import render, get_object_or_404, redirect | |
13 | - | |
14 | -from colab.deprecated import solrutils | |
15 | -from accounts.forms import UserCreationForm, UserUpdateForm | |
16 | -from super_archives.models import Message, UserProfile, EmailAddress | |
17 | - | |
18 | - | |
19 | - | |
20 | -@login_required | |
21 | -def update(request, username): | |
22 | - profile = get_object_or_404(UserProfile, user__username=username) | |
23 | - form = UserUpdateForm(initial=model_to_dict(profile)) | |
24 | - | |
25 | - if request.method == "GET": | |
26 | - return read(request, profile.user, editable=True, form=form) | |
27 | - | |
28 | - form = UserUpdateForm(request.POST) | |
29 | - if not form.is_valid(): | |
30 | - return read(request, profile.user, editable=True, form=form) | |
31 | - | |
32 | - profile.institution = form.cleaned_data.get('institution') | |
33 | - profile.role = form.cleaned_data.get('role') | |
34 | - profile.twitter = form.cleaned_data.get('twitter') | |
35 | - profile.facebook = form.cleaned_data.get('facebook') | |
36 | - profile.google_talk = form.cleaned_data.get('google_talk') | |
37 | - profile.webpage = form.cleaned_data.get('webpage') | |
38 | - profile.save() | |
39 | - | |
40 | - return redirect('user_profile', profile.user.username) |
src/super_archives/models.py
... | ... | @@ -40,14 +40,6 @@ class EmailAddress(models.Model): |
40 | 40 | return self.user.get_full_name() |
41 | 41 | elif self.real_name: |
42 | 42 | return self.real_name |
43 | - | |
44 | - def get_profile_link(self): | |
45 | - if self.user: | |
46 | - # TODO: stop using username in url | |
47 | - return reverse('user_profile', args=[self.user.username]) | |
48 | - else: | |
49 | - return reverse('colab.deprecated.views.userprofile.by_emailhash', | |
50 | - args=[self.md5]) | |
51 | 43 | |
52 | 44 | def __unicode__(self): |
53 | 45 | return '"%s" <%s>' % (self.get_full_name(), self.address) | ... | ... |