Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bookshare
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
30
Issues
30
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
SRCT
bookshare
Commits
5c90508e
Commit
5c90508e
authored
Apr 08, 2016
by
Mark Stenglein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added method in Student model to fetch either full name or username if none present.
parent
cbb9d637
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
bookshare/core/models.py
bookshare/core/models.py
+6
-0
bookshare/core/templates/profile.html
bookshare/core/templates/profile.html
+15
-3
No files found.
bookshare/core/models.py
View file @
5c90508e
...
...
@@ -19,6 +19,12 @@ class Student(TimeStampedModel):
emails_sent
=
models
.
PositiveIntegerField
(
default
=
0
)
def
get_full_name
(
self
):
if
(
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
)
...
...
bookshare/core/templates/profile.html
View file @
5c90508e
{% extends 'layouts/base.html' %}
{% block title %}
SRCT Bookshare
•
{{ student.user.get_full_name }}
{% if student.user.get_full_name == "" %}
SRCT Bookshare
•
{{ student.user.username }}
{% else %}
SRCT Bookshare
•
{{ student.user.get_full_name }}
{% endif %}
{% endblock title %}
{% block content %}
...
...
@@ -17,7 +21,11 @@ SRCT Bookshare • {{ student.user.get_full_name }}
<img
class=
"img-circle img-responsive"
src=
"{% gravatar_url student.user.email 75 %}"
>
</div>
<div
class=
"col-md-6"
>
<h2><strong>
{{ student.user.get_full_name }}
</strong>
{% if student.user.get_full_name == "" %}
<h2><strong>
{{ student.user.username }}
</strong>
{% else %}
<h2><strong>
{{ student.user.get_full_name }}
</strong>
{% endif %}
{% if student.user == request.user %}
<small><a
href=
"{% url 'name_change' %}"
>
(Edit)
</a></small>
{% endif %}
...
...
@@ -37,7 +45,11 @@ SRCT Bookshare • {{ student.user.get_full_name }}
{% endfor %}
</h3></a>
{% else %}
<small>
{{ student.user.first_name }} has no ratings yet.
</small>
{% 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>
{% endif %}
{% endif %}
</div>
<div
class=
"col-md-2 text-right"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment