fix member missing error
This commit is contained in:
@@ -193,7 +193,8 @@ class Post(models.Model):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def author_member(self):
|
def author_member(self):
|
||||||
return (Member.all_members.get(nickname=self.author.username))
|
return Member.all_members.filter(nickname=self.author.username).first()
|
||||||
|
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
"save the post with some defaults"
|
"save the post with some defaults"
|
||||||
|
|||||||
@@ -17,13 +17,13 @@
|
|||||||
{{post.subtitle | tags_to_url }}
|
{{post.subtitle | tags_to_url }}
|
||||||
{% if post.author_member != None %}
|
{% if post.author_member != None %}
|
||||||
<div class="article-author"><a href="{% url 'member' post.author_member.nickname %}">
|
<div class="article-author"><a href="{% url 'member' post.author_member.nickname %}">
|
||||||
<img src="{{post.author_member.image | thumbnail_url:'avatar'}}" alt="" />
|
<img src="{{post.author_member.image | thumbnail_url:'avatar'}}" alt="" />{{post.author_member.nickname}}
|
||||||
{{post.author}}</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="article-author"><a href="">
|
<div class="article-author"><a href="">
|
||||||
<img src="" alt="" />
|
<img src="" alt="" />
|
||||||
FET</a>
|
{{post.author}}</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user