Commit 81ae033d authored by Daniel W Bond's avatar Daniel W Bond

Merge branch 'issue76' into '1.0'

Issue76

Should fix #76.

I went ahead and added a method to the student view so that we can put the logic in there instead of writing it every time directly inside of the template as template logic. Code reuse is fun.

Thx :dbond:

See merge request !12
parents 58af4066 bcc86f09
......@@ -19,6 +19,18 @@ class Student(TimeStampedModel):
emails_sent = models.PositiveIntegerField(default=0)
def get_first_name_or_uname(self):
if not(self.user.first_name):
return self.user.username
else:
return self.user.first_name
def get_full_name_or_uname(self):
if not(self.user.get_full_name()):
return self.user.username
else:
return self.user.get_full_name()
def has_nickname(self):
pf_name = "%s %s" % (self.pf_first_name, self.pf_last_name)
......
{% extends 'layouts/base.html' %}
{% block title %}
SRCT Bookshare • {{ student.user.get_full_name }}
SRCT Bookshare • {{ student.get_full_name_or_uname }}
{% endblock title %}
{% block content %}
......@@ -17,7 +17,7 @@ SRCT Bookshare • {{ student.user.get_full_name }}
<img class="img-circle img-responsive" src="{% gravatar_url request.user.email 75 %}">
</div>
<div class="col-md-6">
<h2><strong>{{ student.user.get_full_name }}</strong>
<h2><strong>{{ student.get_full_name_or_uname }}</strong>
{% if student.user == request.user %}
<small><a href="{% url 'name_change' %}">(Edit)</a></small>
{% endif %}
......@@ -37,7 +37,7 @@ SRCT Bookshare &bull; {{ student.user.get_full_name }}
{% endfor %}
</h3></a>
{% else %}
<small>{{ student.user.first_name }} has no ratings yet.</small>
<small>{{ student.get_first_name_or_uname }} has no ratings yet.</small>
{% endif %}
</div>
<div class="col-md-2 text-right">
......@@ -117,7 +117,7 @@ SRCT Bookshare &bull; {{ student.user.get_full_name }}
{% if student.user == request.user %}
You don't
{% else %}
{{ student.user.first_name }} doesn't
{{ student.get_first_name_or_uname }} doesn't
{% endif %}
have any listings posted yet.
{% if student.user == request.user %}
......@@ -186,7 +186,7 @@ SRCT Bookshare &bull; {{ student.user.get_full_name }}
{% if student.user == request.user %}
You don't
{% else %}
{{ student.user.first_name }} doesn't
{{ student.get_first_name_or_uname }} doesn't
{% endif %}
have any have any bids yet.
{% if student.user == request.user %}
......
{% extends 'layouts/base.html' %}
{% block title %}
SRCT Bookshare &bull; {{ student.user.first_name }} {{ student.user.last_name }}
SRCT Bookshare &bull; {{ student.get_full_name_or_uname }}
{% endblock title %}
{% block content %}
......@@ -16,7 +16,7 @@ SRCT Bookshare &bull; {{ student.user.first_name }} {{ student.user.last_name }}
<img class="img-circle img-responsive" src="{% gravatar_url request.user.email 75 %}">
</div>
<div class="col-md-6">
<h2><strong><a href="{{ student.get_absolute_url }}">{{ student.user.get_full_name }}'s</a> Ratings</strong></h2>
<h2><strong><a href="{{ student.get_absolute_url }}">{{ student.get_full_name_or_uname }}'s</a> Ratings</strong></h2>
</div>
<div class="col-md-5 text-right">
<h3><strong>{{ student_ratings_num }}</strong> reviews,
......
......@@ -33,7 +33,7 @@ SRCT Bookshare &bull; Mod
{% if student.has_nickname %}
<strong>{{ student.get_nickname }}</strong>
{% else %}
<strong>{{ student.user.get_full_name }}</strong>
<strong>{{ student.get_full_name_or_uname }}</strong>
{% endif %}
(<em>{{ student.user.username }}</em>)
</a></td>
......
......@@ -28,7 +28,7 @@ SRCT Bookshare &bull; Mod
{% if student.has_nickname %}
<strong>{{ student.get_nickname }}</strong>
{% else %}
<strong>{{ student.user.get_full_name }}</strong>
<strong>{{ student.get_full_name_or_uname }}</strong>
{% endif %}
(<em>{{ student.user.username }}</em>)
</a></td>
......
......@@ -113,7 +113,7 @@ AUTHENTICATION_BACKENDS = (
)
# Peoplefinder API for user creation
PF_URL = "http://peoplefinder.b1.akshaykarthik.com/"
PF_URL = "https://api.srct.gmu.edu/pf/v1/"
CAS_SERVER_URL = 'https://login.gmu.edu'
CAS_LOGOUT_COMPLETELY = True
......
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