add option 'hidden'. You can hide news from newsfeed (e.g. about)
This commit is contained in:
@@ -23,7 +23,7 @@ from collections import deque
|
||||
##################
|
||||
|
||||
def index(request):
|
||||
posts = deque(Post.objects.order_by('-public_date').all())
|
||||
posts = deque(Post.objects.get_visible_articles().order_by('-public_date'))
|
||||
|
||||
def f(p):
|
||||
return p.tags
|
||||
@@ -33,21 +33,23 @@ def index(request):
|
||||
|
||||
|
||||
def tags(request, tag=""):
|
||||
posts = deque(Post.objects.filter(tags__name=tag))
|
||||
featured_post = Post.objects.filter(slug=tag).first()
|
||||
posts = deque(Post.objects.get_visible_articles().filter(tags__name=tag))
|
||||
featured_post = Post.objects.get_visible_articles().filter(slug=tag).first()
|
||||
|
||||
context = {
|
||||
"posts": posts,
|
||||
"featured_post": featured_post,
|
||||
"tags_list": None,
|
||||
}
|
||||
|
||||
return render(request, 'posts/tag.html', context)
|
||||
|
||||
|
||||
def show(request, id=None):
|
||||
if id.isdigit() or id is int:
|
||||
p = Post.objects.get(id=int(id))
|
||||
p = Post.objects.get_visible_articles().get(id=int(id))
|
||||
elif id != "" and id is not None:
|
||||
p = Post.objects.get(slug=(id))
|
||||
p = Post.objects.get_visible_articles().get(slug=(id))
|
||||
|
||||
# post_author = Member.all_members.filter(nickname=p.author)
|
||||
|
||||
@@ -108,7 +110,7 @@ def tag_complete(request):
|
||||
|
||||
def get_next_dict():
|
||||
# TODO: Docstring
|
||||
posts = Post.articles.values('slug')
|
||||
posts = Post.articles.get_visible_articles().values('slug')
|
||||
print(posts)
|
||||
d = {}
|
||||
print(d)
|
||||
|
||||
Reference in New Issue
Block a user