update tag links
This commit is contained in:
@@ -179,6 +179,23 @@ class Post(models.Model):
|
|||||||
def tag_string(self):
|
def tag_string(self):
|
||||||
return self.get_tags()
|
return self.get_tags()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def three_tag_names(self):
|
||||||
|
tag_lst = []
|
||||||
|
count = 0
|
||||||
|
|
||||||
|
for t in self.tags.names():
|
||||||
|
tag_lst.append(t)
|
||||||
|
count += 1
|
||||||
|
if count > 2:
|
||||||
|
break
|
||||||
|
|
||||||
|
return tag_lst
|
||||||
|
|
||||||
|
@property
|
||||||
|
def tag_names(self):
|
||||||
|
return [t for t in self.tags.names()]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def imageurl(self):
|
def imageurl(self):
|
||||||
""" returns the url to the image"""
|
""" returns the url to the image"""
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ def tags(request, tag=""):
|
|||||||
"featured_post": featured_post,
|
"featured_post": featured_post,
|
||||||
"job_members": job_members,
|
"job_members": job_members,
|
||||||
"tags_list": None,
|
"tags_list": None,
|
||||||
|
"tag": tag,
|
||||||
}
|
}
|
||||||
|
|
||||||
return render(request, "posts/tag.html", context)
|
return render(request, "posts/tag.html", context)
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
<div class="article-cover-desc">
|
<div class="article-cover-desc">
|
||||||
<div class="article-cover-desc-items">
|
<div class="article-cover-desc-items">
|
||||||
<ul class="article-cover-tags">
|
<ul class="article-cover-tags">
|
||||||
<li><a href="#">#fet</a></li>
|
{% for t in post.three_tag_names %}
|
||||||
<li><a href="#">#ug</a></li>
|
<li><a href="{% url 'posts:posts.tags' t %}">#{{ t }}</a></li>
|
||||||
<li><a href="#">#öh</a></li>
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
<div>
|
<div>
|
||||||
<a href="{{ post.url }}"><h3 class="text-gray-50">{{ post.title | safe }}</h3></a>
|
<a href="{{ post.url }}"><h3 class="text-gray-50">{{ post.title | safe }}</h3></a>
|
||||||
|
|||||||
@@ -48,9 +48,9 @@
|
|||||||
<section>
|
<section>
|
||||||
<div class="mb-4 flex flex-col sm:flex-col gap-2 mx-auto">
|
<div class="mb-4 flex flex-col sm:flex-col gap-2 mx-auto">
|
||||||
<ul class="px-4 sm:px-0 mb-2 flex flex-row justify-center gap-2 sm:gap-4 flex-wrap text-blue-700 text-sm uppercase tracking-wide sm:font-medium">
|
<ul class="px-4 sm:px-0 mb-2 flex flex-row justify-center gap-2 sm:gap-4 flex-wrap text-blue-700 text-sm uppercase tracking-wide sm:font-medium">
|
||||||
<li class="inline-block py-1 px-2 bg-blue-100 rounded-full"><a href="#">#fachschaft</a></li>
|
{% for t in post.tag_names %}
|
||||||
<li class="inline-block py-1 px-2 bg-blue-100 rounded-full"><a href="#">#WelcomeDay</a></li>
|
<li class="inline-block py-1 px-2 bg-blue-100 rounded-full"><a href="{% url 'posts:posts.tags' t %}">#{{ t }}</a></li>
|
||||||
<li class="inline-block py-1 px-2 bg-blue-100 rounded-full"><a href="#">#Inskriptionsberatung</a></li>
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
<h1 class="px-4 sm:px-0 text-lg sm:text-xl lg:text-3xl text-center sm:text-left font-medium text-gray-900 font-serif tracking-wider leading-normal" style="line-height: 1.5;">{{ post.title|tags_to_url }}</h1>
|
<h1 class="px-4 sm:px-0 text-lg sm:text-xl lg:text-3xl text-center sm:text-left font-medium text-gray-900 font-serif tracking-wider leading-normal" style="line-height: 1.5;">{{ post.title|tags_to_url }}</h1>
|
||||||
<div class="mx-auto max-w-max sm:mx-0 sm:max-w-none sm:flex justify-between items-center">
|
<div class="mx-auto max-w-max sm:mx-0 sm:max-w-none sm:flex justify-between items-center">
|
||||||
|
|||||||
Reference in New Issue
Block a user