Small fix to delete unnecessary code, condensed into the model. · pythonDrive/bootcamp@061684c · GitHub
Skip to content

Commit 061684c

Browse files
Small fix to delete unnecessary code, condensed into the model.
1 parent 36ad87a commit 061684c

12 files changed

Lines changed: 23 additions & 92 deletions

File tree

bootcamp/templates/articles/article_detail.html

Lines changed: 2 additions & 14 deletions

bootcamp/templates/articles/article_list.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,7 @@ <h2 class="card-title">{{ article.title|title }}</h2>
3737
<div class="card-footer text-muted">
3838
{% trans 'Posted' %} {{ article.timestamp|naturaltime }}
3939
<i class="lead fa fa-user"></i>
40-
<a href="{% url 'users:detail' article.user.username %}">
41-
{% if article.user.name %}
42-
{{ article.user.name|title }}
43-
{% else %}
44-
{{ article.user.username|title }}
45-
{% endif %}
46-
</a>
40+
<a href="{% url 'users:detail' article.user.username %}">{{ article.user.get_profile_name|title }}</a>
4741
{% for tag in article.tags.names %}
4842
<a href="#">{{ tag }}</a>
4943
{% endfor %}

bootcamp/templates/messager/message_list.html

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,7 @@
1010
{% block content %}
1111

1212
<div class="page-header">
13-
<h1>
14-
{% if request.user.name %}
15-
{{ request.user.name|title }}
16-
{% else %}
17-
{{ request.user.username|title }}
18-
{% endif %}
19-
{% trans 'Conversations' %}
20-
</h1>
13+
<h1>{{ request.user.get_profile_name|title }} {% trans 'Conversations' %}</h1>
2114
</div>
2215
<div class="row" style="margin-top: 1em">
2316
<div class="col-md-3 list-group users-list">
@@ -29,11 +22,7 @@ <h1>
2922
{% empty %}
3023
<img src="{% static 'img/user.png' %}" height="30px" alt="{% trans 'No Profile Picture' %}" />
3124
{% endthumbnail %}
32-
{% if user.name %}
33-
{{ user.name|title }}
34-
{% else %}
35-
{{ user.username|title }}
36-
{% endif %}
25+
{{ user.get_profile_name|title }}
3726
</a>
3827
{% endfor %}
3928
</div>

bootcamp/templates/messager/single_message.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,7 @@
99
{% endthumbnail %}
1010
<div>
1111
<b>
12-
<a href="{% url 'users:detail' message.sender.username %}">
13-
{% if message.sender.name %}
14-
{{ message.sender.name|title }}
15-
{% else %}
16-
{{ message.sender.username|title }}
17-
{% endif %}
18-
</a>
12+
<a href="{% url 'users:detail' message.sender.username %}">{{ message.sender.get_profile_name|title }}</a>
1913
</b>
2014
<small> - {{ message.timestamp|date:'N d G:i' }}</small>
2115
<br>

bootcamp/templates/news/news_single.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@
1919
{% endif %}
2020
<p>
2121
<strong>
22-
<a href="{% url 'users:detail' news.user.username %}">
23-
{% if news.user.name %}
24-
{{ news.user.name|title }}
25-
{% else %}
26-
{{ news.user.username|title }}
27-
{% endif %}
28-
</a>
22+
<a href="{% url 'users:detail' news.user.username %}">{{ news.user.get_profile_name|title }}</a>
2923
</strong>
3024
</p>
3125
<p>{{ news }}</p>

bootcamp/templates/news/news_thread.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,7 @@
2121
{% endif %}
2222
<p>
2323
<strong>
24-
<a href="{% url 'users:detail' reply.user.username %}">
25-
{% if reply.user.name %}
26-
{{ reply.user.name|title }}
27-
{% else %}
28-
{{ reply.user.username|title }}
29-
{% endif %}
30-
</a>
24+
<a href="{% url 'users:detail' reply.user.username %}">{{ reply.user.get_profile_name|title }}</a>
3125
</strong>
3226
</p>
3327
<p>{{ reply }}</p>

bootcamp/templates/notifications/notification_list.html

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@
1010
{% block content %}
1111
<h1>
1212
{% trans 'Unread notifications for' %}
13-
{% if request.user.name %}
14-
{{ request.user.name|title }}
15-
{% else %}
16-
{{ request.user.username|title }}
17-
{% endif %}
13+
{{ request.user.get_profile_name|title }}
1814
<a class="btn btn-dark pull-right" href="{% url 'notifications:mark_all_read' %}">{% trans 'Mark all as read' %}</a>
1915
</h1>
2016
<ul class="notifications">
@@ -33,13 +29,7 @@ <h1>
3329
<div class="media-body">
3430
<a class="btn btn-success btn-sm pull-right" title="{% trans 'Mark as read' %}" href="{% url 'notifications:mark_as_read' notification.slug %}"><i class="fa fa-check-circle"></i></a>
3531
<strong class="notification-title">
36-
<a href="{% url 'users:detail' notification.actor.username %}">
37-
{% if notification.actor.name %}
38-
{{ notification.actor.name|title }}
39-
{% else %}
40-
{{ notification.actor.username|title }}
41-
{% endif %}
42-
</a>
32+
<a href="{% url 'users:detail' notification.actor.username %}">{{ notification.actor.get_profile_name|title }}</a>
4333
</strong>
4434
<p class="notification-desc">
4535
{{ notification.get_verb_display }}

bootcamp/templates/qa/question_detail.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,7 @@ <h3 id="questionVotes">{{ question.total_votes }}</h3>
3737
<p>{{ question.content }}</p>
3838
<div class="question-user pull-right">
3939
<span class="text-secondary">{% trans 'Asked' %} {{ question.timestamp|naturaltime }} {% trans 'by' %}</span>
40-
<a href="{% url 'users:detail' question.user.username %}">
41-
{% if question.user.name %}
42-
{{ question.user.name|title }}
43-
{% else %}
44-
{{ question.user.username|title }}
45-
{% endif %}
46-
</a>
40+
<a href="{% url 'users:detail' question.user.username %}">{{ question.user.get_profile_name|title }}</a>
4741
{% if question.tags.names %}
4842
<p>
4943
{% for tag in question.tags.names %}

bootcamp/templates/qa/question_sample.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@ <h4 class="card-title">
1616
<p>{{ question.content|truncatechars:100 }}</p>
1717
<div class="question-user pull-right">
1818
<span class="text-secondary">{% trans 'Asked' %} {{ question.timestamp|naturaltime }} {% trans 'by' %}</span>
19-
<a href="{% url 'users:detail' question.user.username %}">
20-
{% if question.user.name %}
21-
{{ question.user.name|title }}
22-
{% else %}
23-
{{ question.user.username|title }}
24-
{% endif %}
25-
</a>
19+
<a href="{% url 'users:detail' question.user.username %}">{{ question.user.get_profile_name|title }}</a>
2620
{% if question.tags.names %}
2721
<p style="position: absolute; bottom: 0;">
2822
{% for tag in question.tags.names %}

bootcamp/templates/users/user_detail.html

Lines changed: 2 additions & 5 deletions

0 commit comments

Comments
 (0)