forked from 00dani/lemoncurry
Hide likes and replies from the homepage
This commit is contained in:
parent
28e4a71cae
commit
adb302ebe3
2 changed files with 10 additions and 3 deletions
|
@ -1,8 +1,9 @@
|
||||||
class Entry:
|
class Entry:
|
||||||
def __init__(self, id, plural, icon, slug=False):
|
def __init__(self, id, plural, icon, on_home=True, slug=False):
|
||||||
self.id = id
|
self.id = id
|
||||||
self.plural = plural
|
self.plural = plural
|
||||||
self.icon = icon
|
self.icon = icon
|
||||||
|
self.on_home = on_home
|
||||||
self.slug = slug
|
self.slug = slug
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -46,12 +47,14 @@ Reply = Entry(
|
||||||
id='reply',
|
id='reply',
|
||||||
icon='fa fa-comment',
|
icon='fa fa-comment',
|
||||||
plural='replies',
|
plural='replies',
|
||||||
|
on_home=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
Like = Entry(
|
Like = Entry(
|
||||||
id='like',
|
id='like',
|
||||||
icon='fa fa-heart',
|
icon='fa fa-heart',
|
||||||
plural='likes',
|
plural='likes',
|
||||||
|
on_home=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
Repost = Entry(
|
Repost = Entry(
|
||||||
|
@ -61,5 +64,6 @@ Repost = Entry(
|
||||||
)
|
)
|
||||||
|
|
||||||
all = (Note, Article, Photo, Reply, Like, Repost)
|
all = (Note, Article, Photo, Reply, Like, Repost)
|
||||||
|
on_home = (k.id for k in all if k.on_home)
|
||||||
from_id = {k.id: k for k in all}
|
from_id = {k.id: k for k in all}
|
||||||
from_plural = {k.plural: k for k in all}
|
from_plural = {k.plural: k for k in all}
|
||||||
|
|
|
@ -3,9 +3,11 @@ from django.http import HttpResponse
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from users.models import User
|
from users.models import User
|
||||||
from lemoncurry import breadcrumbs, utils
|
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
|
from entries import kinds
|
||||||
|
from lemoncurry import breadcrumbs, utils
|
||||||
|
|
||||||
breadcrumbs.add('home:index', 'home')
|
breadcrumbs.add('home:index', 'home')
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,10 +15,11 @@ breadcrumbs.add('home:index', 'home')
|
||||||
def index(request):
|
def index(request):
|
||||||
query = User.objects.prefetch_related('entries', 'profiles', 'keys')
|
query = User.objects.prefetch_related('entries', 'profiles', 'keys')
|
||||||
user = get_object_or_404(query, pk=1)
|
user = get_object_or_404(query, pk=1)
|
||||||
|
entries = user.entries.filter(kind__in=kinds.on_home)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'user': user,
|
'user': user,
|
||||||
'entries': user.entries.all(),
|
'entries': entries,
|
||||||
'atom': 'entries:atom',
|
'atom': 'entries:atom',
|
||||||
'rss': 'entries:rss',
|
'rss': 'entries:rss',
|
||||||
'meta': user.as_meta(request),
|
'meta': user.as_meta(request),
|
||||||
|
|
Loading…
Reference in a new issue