Commit 72208564 authored by Mark Stenglein's avatar Mark Stenglein
Browse files

Move logic to python and change references

parent d3732542
......@@ -19,7 +19,13 @@ class Student(TimeStampedModel):
emails_sent = models.PositiveIntegerField(default=0)
def get_full_name(self):
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:
......
{% extends 'layouts/base.html' %}
{% block title %}
{% if student.user.get_full_name == "" %}
SRCT Bookshare • {{ student.user.username }}
{% else %}
SRCT Bookshare • {{ student.user.get_full_name }}
{% endif %}
SRCT Bookshare • {{ student.get_full_name_or_uname }}
{% endblock title %}
{% block content %}
......@@ -21,11 +17,7 @@
<img class="img-circle img-responsive" src="{% gravatar_url student.user.email 75 %}">
</div>
<div class="col-md-6">
{% if student.user.get_full_name == "" %}
<h2><strong>{{ student.user.username }}</strong>
{% else %}
<h2><strong>{{ student.user.get_full_name }}</strong>
{% endif %}
<h2><strong>{{ student.get_full_name_or_uname }}</strong>
{% if student.user == request.user %}
<small><a href="{% url 'name_change' %}">(Edit)</a></small>
{% endif %}
......@@ -48,7 +40,7 @@
{% if student.user.get_full_name == "" %}
<small>{{ student.user.username }} has no ratings yet.</small>
{% else %}
<small>{{ student.user.first_name }} has no ratings yet.</small>
<small>{{ student.get_first_name_or_uname }} has no ratings yet.</small>
{% endif %}
{% endif %}
</div>
......@@ -129,7 +121,7 @@
{% 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 %}
......@@ -198,7 +190,7 @@
{% 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 student.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>
......
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