Commit 666aec77 authored by Sherif's avatar Sherif

gave better method names for student name getters and changed empty name...

gave better method names for student name getters and changed empty name string checker to use boolean condition if(not) rather than if(==)
parent a3daba23
......@@ -215,23 +215,23 @@ class Student(TimeStampedModel):
my_flag_num = Confirmation.objects.filter(student=self, lives_there=False).count()
return my_flag_num
def get_first_name(self):
if self.user.get_short_name() == "":
def get_first_name_or_uname(self):
if not(self.user.get_short_name()):
return self.user.get_username()
else:
return self.user.get_short_name()
def get_last_name(self):
if self.user.last_name == "":
def get_last_name_or_uname(self):
if not(self.user.last_name):
return self.user.get_username()
else:
return self.user.last_name
def get_full_name(self):
if self.user.get_full_name() == "":
def get_full_name_or_uname(self):
if not(self.user.get_full_name_or_uname()):
return self.user.get_username()
else:
return self.user.get_full_name()
return self.user.get_full_name_or_uname()
class Meta:
ordering = ['user']
......
{% extends 'layouts/base.html' %}
{% block title %} SRCT RoomList | Flag {{ student.user.get_full_name }} {% endblock %}
{% block title %} SRCT RoomList | Flag {{ student.user.get_full_name_or_uname }} {% endblock %}
{% block message_queue %}
{% endblock %}
......@@ -14,10 +14,10 @@
<p class="lead text-center">
<i class="fa fa-flag fa-lg"></i>
<strong>
{% if not student.user.get_full_name %}
{% if not student.user.get_full_name_or_uname %}
Someone
{% else %}
{{ student.user.get_full_name }}
{{ student.user.get_full_name_or_uname }}
{% endif %}
</strong>
<em>is in the wrong room!</em>
......
{% extends 'layouts/base.html' %}
{% block title %} SRCT RoomList | Remove Flag {{ confirmation.student.user.get_full_name }} {% endblock %}
{% block title %} SRCT RoomList | Remove Flag {{ confirmation.student.user.get_full_name_or_uname }} {% endblock %}
{% block message_queue %}
{% endblock %}
......@@ -15,10 +15,10 @@
<i class="fa fa-flag fa-lg"></i>
Maybe
<strong>
{% if not confirmation.student.user.get_full_name %}
{% if not confirmation.student.user.get_full_name_or_uname %}
Someone
{% else %}
{{ confirmation.student.user.get_full_name }}
{{ confirmation.student.user.get_full_name_or_uname }}
{% endif %}
</strong>
<em>is in the correct room after all...</em>
......
......@@ -10,7 +10,7 @@
</div>
<div class="col-md-6 text-center">
<h1><strong>{{ student.user.get_full_name }}</strong></h1>
<h1><strong>{{ student.user.get_full_name_or_uname }}</strong></h1>
{% if shares %}
<p class="lead"><strong>
{% if student.room == None %}
......
{{ object.user.username }}
{{ object.user.get_full_name }}
{{ object.user.get_full_name_or_uname }}
......@@ -45,7 +45,7 @@ SRCT Roomlist &bull; Search Students
<h4>{{ result.object.user.username }}</h4>
</td>
<td>
<a href="{{ result.object.get_absolute_url }}"><h4><strong>{{ result.object.user.get_full_name }}</strong></h4></a>
<a href="{{ result.object.get_absolute_url }}"><h4><strong>{{ result.object.user.get_full_name_or_uname }}</strong></h4></a>
</td>
<td>
{% if result.object.major %}
......
{% extends 'layouts/base.html' %}
{% block title %} SRCT Roomlist | {{ student.get_full_name }} {% endblock %}
{% block title %} SRCT Roomlist | {{ student.get_full_name_or_uname }} {% endblock %}
{% block messsage_queue %}
{% endblock %}
......@@ -12,8 +12,8 @@
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-8 col-md-offset-2 text-center">
<img class="img-circle img-responsive center center-block" src="{{ student.profile_image_url }}" alt="{{ student.get_first_name }} Gravatar picture">
<h1>{{ student.get_full_name }} , {{ student.user.username }}</h1>
<img class="img-circle img-responsive center center-block" src="{{ student.profile_image_url }}" alt="{{ student.get_first_name_or_uname }} Gravatar picture">
<h1>{{ student.get_full_name_or_uname }} , {{ student.user.username }}</h1>
</div>
</div>
</div>
......
......@@ -19,7 +19,7 @@
<div class="row">
<div class="col-md-12 text-center">
<h2><strong>Welcome, {{ me.get_first_name }}!</strong></h2>
<h2><strong>Welcome, {{ me.get_first_name_or_uname }}!</strong></h2>
</div>
</div>
......
......@@ -25,8 +25,8 @@
<div class="row">
{% for student in students %}
<div class="col-sm-3 text-center">
<img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 100 %}" alt="{{ student.user.first_name }} Gravatar picture">
<h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.user.first_name }} {{ student.user.last_name }}</strong></a></h4>
<img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 100 %}" alt="{{ student.get_first_name_or_uname }} Gravatar picture">
<h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.get_full_name_or_uname }}</strong></a></h4>
<h5><a href="{{ student.major.get_absolute_url }}"><em>{{ student.major.name }}</em></a></h5>
<h5><a href="{{ student.room.get_absolute_url }}">{{ student.room }}</a></h5>
{% if student.get_flag_count %}
......
......@@ -27,8 +27,8 @@
<div class="row">
{% for student in students %}
<div class="col-sm-3 text-center">
<img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 100 %}" alt="{{ student.user.first_name }} Gravatar picture">
<h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.user.first_name }} {{ student.user.last_name }}</strong></a></h4>
<img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 100 %}" alt="{{ student.get_first_name_or_uname }} Gravatar picture">
<h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.get_full_name_or_uname }}</strong></a></h4>
<h5><a href="{{ student.major.get_absolute_url }}"><em>{{ student.major.name }}</em></a></h5>
{% if student.get_flag_count > 4 %}
<p><em>* a number of other floormates say this info is incorrect</em></p>
......
{% extends 'layouts/base.html' %} {% block title %} SRCT Roomlist &bull; Homepage {% endblock %} {% block content %}
{% load cache %}
{% load gravatar %}
<h2>Welcome Back {{ me.get_first_name }}!</h2>
<h2>Welcome Back {{ me.get_first_name_or_uname }}!</h2>
<legend></legend>
{% if not me.room %}
......@@ -20,8 +20,8 @@
<div class="row">
{% for student in roomies %}
<div class="col-md-3">
<a href="{{ student.get_absolute_url }}"><img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 100 %}" alt="{{ student.get_first_name}} Gravatar picture"></img></a>
<h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.get_full_name }}</strong></a></h4>
<a href="{{ student.get_absolute_url }}"><img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 100 %}" alt="{{ student.get_first_name_or_uname}} Gravatar picture"></img></a>
<h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.get_full_name_or_uname }}</strong></a></h4>
<h5><a href="{{ student.major.get_absolute_url }}"><em>{{ student.major }}</em></a></h5>
</div>
{% empty %}
......@@ -46,7 +46,7 @@
{% for student in floories %}
<div class="col-md-3">
<a href="{{ student.get_absolute_url }}"><img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 100 %}" alt="{{ student.user.first_name }} Gravatar picture"></a>
<h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.user.get_full_name }}</strong></a></h4>
<h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.user.get_full_name_or_uname }}</strong></a></h4>
<h5><a href="{{ student.major.get_absolute_url }}"><em>{{ student.major }}</em></a></h5>
<h5><a href="{{ student.room.get_absolute_url }}">{{ student.room }}</h5></a>
</div>
......@@ -76,7 +76,7 @@
<!--{//% for student in majormates %}
<div class="col-md-3">
<a href="{{ student.get_absolute_url }}"><img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 100 %}" alt="{{ student.user.first_name }} Gravatar picture"></a>
<h4><a href="{{ student.get_full_name }}"><strong>{{ student.user.get_full_name }}</strong></a></h4>
<h4><a href="{{ student.get_full_name_or_uname }}"><strong>{{ student.user.get_full_name_or_uname }}</strong></a></h4>
</div>
{//% empty %}
<h4>There are no other students registered in your major right now.</h4>
......
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