Commit 488d497b authored by Jason D Yeomans's avatar Jason D Yeomans
Browse files

Merge branch 'allauth'

parents 368a72ed b6efed73
...@@ -22,12 +22,13 @@ class Student(TimeStampedModel): ...@@ -22,12 +22,13 @@ class Student(TimeStampedModel):
slug = AutoSlugField(populate_from='user', unique=True) slug = AutoSlugField(populate_from='user', unique=True)
def profile_image_url(self): def profile_image_url(self):
fb_uid = SocialAccount.objects.filter(user_id=self.user.id, provider='facebook') fb_uid = SocialAccount.objects.filter(user=self.user.id, provider='facebook')
print("profile_image")
if len(fb_uid): if len(fb_uid)>0:
return "http://graph.facebook.com/{}/picture?width=40&height=40".format(fb_uid[0].uid) return "http://graph.facebook.com/{}/picture?width=175&height=175".format(fb_uid[0].uid)
return "http://www.gravatar.com/avatar/{}?s=40".format(hashlib.md5(self.user.email).hexdigest()) return "http://www.gravatar.com/avatar/{}?s=175".format(hashlib.md5(self.user.email).hexdigest())
def __str__(self): # __unicode__ on Python 2 def __str__(self): # __unicode__ on Python 2
......
{% extends 'layouts/base.html' %} {% extends 'layouts/base.html' %} {% block title %} GMU RoomList | {{ student.user.first_name }} {{ student.user.last_name }} {% endblock %} {% load socialaccount %} {% block content %}
{% block title %} GMU RoomList | {{ student.user.first_name }} {{ student.user.last_name }} {% endblock %}
{% block content %}
{% load gravatar %}
<!-- gravatar_url student.user.email 175 %} -->
{% get_social_accounts student.user as accounts %}
<div class="page-header" id="banner"> <div class="page-header" id="banner">
<div class="row"> <div class="row">
<div class="col-md-8 col-md-offset-2 text-center"> <div class="col-md-8 col-md-offset-2 text-center">
<img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 175 %}" alt="{{ student.user.first_name }} Gravatar picture"> <img class="img-circle img-responsive center center-block" src="{{ student.profile_image_url }}" alt="{{ student.user.first_name }} Gravatar picture">
<h1>{{ student.user.first_name }} {{ student.user.last_name }}</h1> <h1>{{ student.user.first_name }} {{ student.user.last_name }}</h1>
</div> </div>
</div> </div>
...@@ -47,18 +43,19 @@ ...@@ -47,18 +43,19 @@
<table class="table table-hover text-center"> <table class="table table-hover text-center">
<tbody> <tbody>
<tr> <tr>
<td><i class="fa fa-facebook fa-lg"></i></td> <td><i class="fa fa-facebook fa-lg"></i>
<td>link</td> </td>
<td>{% if accounts.facebook %} <a href="http://www.facebook.com/{{ accounts.facebook.0.uid }}" target="_blank">Facebook</a> {% endif %}</td>
</tr> </tr>
<tr> <tr>
<td><i class="fa fa-google fa-lg"></i></td> <td><i class="fa fa-google fa-lg"></i>
<td>link</td> </td>
<td>{% if accounts.google %} <a href="https://plus.google.com/{{ accounts.google.0.uid }}" target="_blank">Google+</a> {% endif %}</td>
</tr> </tr>
<tr> <tr>
<td><i class="fa fa-twitter fa-lg"></i></td> <td><i class="fa fa-twitter fa-lg"></i>
<td>link</td> </td>
<td>{% if accounts.twitter %} <a href="https://twitter.com/intent/user?user_id={{ accounts.twitter.0.uid }}" target="_blank">Twitter</a> {% endif %}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
...@@ -33,13 +33,6 @@ urlpatterns = patterns('', ...@@ -33,13 +33,6 @@ urlpatterns = patterns('',
template_name="createStudent.html"), template_name="createStudent.html"),
name='createStudent'), name='createStudent'),
url(r'^settings/(?P<slug>[\w-]+)/$',
DetailStudentSettings.as_view(
model=Student,
context_object_name='student',
template_name="studentSettings.html"),
name='studentSettings'),
url(r'^settings/$', url(r'^settings/$',
DetailCurrentStudentSettings.as_view( DetailCurrentStudentSettings.as_view(
model=Student, model=Student,
......
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