view fixes
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
from django.shortcuts import render
|
||||
# from django.http import HttpResponse
|
||||
from collections import deque
|
||||
from posts.models import Post
|
||||
|
||||
from posts.models import Post, FetMeeting, Event
|
||||
from django.utils import timezone
|
||||
from django.db.models import Q
|
||||
|
||||
def index(request):
|
||||
posts = deque(Post.article_objects.all())
|
||||
|
||||
date_today = timezone.now().date()
|
||||
def get_tags(lst):
|
||||
for p in lst:
|
||||
for t in list(p.tags.names()):
|
||||
@@ -20,7 +21,9 @@ def index(request):
|
||||
|
||||
context = {
|
||||
'posts': posts,
|
||||
'events': Post.objects.filter(is_event=True).filter(Q(event_start__gt=date_today)).order_by('-public_date').all(),
|
||||
'featured_post': featured_post,
|
||||
'featured_post2': FetMeeting.objects.first(),
|
||||
'tags_list': ", ".join(t)
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,10 @@ def show_job(request, slug=None):
|
||||
job=Job.objects.get(slug=slug)
|
||||
return render(request, 'members/show_job.html', {"job": job})
|
||||
|
||||
def show_member(request, slug=None):
|
||||
member=Member.objects.get()
|
||||
return render(request, 'members/show_member.html', {"member": member})
|
||||
|
||||
def list(request, filter=None):
|
||||
"""
|
||||
View for a list of members filtered or not
|
||||
|
||||
@@ -11,6 +11,9 @@ admin.site.unregister(auth.models.User)
|
||||
admin.site.unregister(auth.models.Group)
|
||||
admin.site.unregister(taggit.models.Tag)
|
||||
|
||||
def make_fetmeeting(modeladmin, request, queryset):
|
||||
queryset.update(post_type ='F')
|
||||
make_fetmeeting.short_description = "In eine Fachschaftssitzung konvertieren"
|
||||
|
||||
class MyPostAdmin(admin.ModelAdmin):
|
||||
form = MyPostForm
|
||||
@@ -38,7 +41,7 @@ class MyEventAdmin(MyPostAdmin):
|
||||
form = MyEventForm
|
||||
model = Event
|
||||
list_display = ['title', 'subtitle', 'slug', 'event_start', 'public_date']
|
||||
|
||||
actions=[make_fetmeeting]
|
||||
|
||||
admin.site.register(Event, MyEventAdmin)
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class ArticleManager(models.Manager):
|
||||
regular fet meetings should not be contained in the news stream
|
||||
"""
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().filter(Q(post_type='E') | Q(post_type='N'))
|
||||
return super().get_queryset().filter(Q(post_type='E') | Q(post_type='N')).order_by('-public_date')
|
||||
|
||||
|
||||
class NewsManager(models.Manager):
|
||||
@@ -48,7 +48,7 @@ class EventManager(models.Manager):
|
||||
regular fet meetings should not be contained in the news stream
|
||||
"""
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().filter(Q(is_event=True) & Q(post_type='E'))
|
||||
return super().get_queryset().filter(Q(is_event=True) & ~Q(post_type='F')).order_by('-public_date')
|
||||
|
||||
|
||||
class FetMeetingManager(models.Manager):
|
||||
|
||||
@@ -32,36 +32,11 @@
|
||||
</a>
|
||||
<div class="article-row-section">
|
||||
{% with post=featured_post %}
|
||||
<a href="{{post.url}}">
|
||||
|
||||
<article class="article-row">
|
||||
|
||||
<div class="article-row-content">
|
||||
<h1 class="article-row-content-header">{{post.title}}</h1>
|
||||
|
||||
<p class="article-row-content-description">{{post.subtitle}}</p>
|
||||
|
||||
<p class="article-row-content-author">{{post.author}}</p>
|
||||
<time class="article-row-content-time" datetime="2008-02-14 20:00">{{post.public_date}}</time>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
</a>
|
||||
{% include 'posts/partials/_article_row.html' %}
|
||||
{% endwith %}
|
||||
{% with post=featured_post2 %}
|
||||
{% include 'posts/partials/_article_row.html' %}
|
||||
{% endwith %}
|
||||
|
||||
<a href="#">
|
||||
<article class="article-row">
|
||||
|
||||
<div class="article-row-content">
|
||||
<h1 class="article-row-content-header">Nächste Fachschaftssitzung</h1>
|
||||
|
||||
<p class="article-row-content-description">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Labore accusamus sint quas, odit, enim architecto officiis culpa!</p>
|
||||
|
||||
<p class="article-row-content-author">By Yeti</p>
|
||||
<time class="article-row-content-time" datetime="2008-02-14 20:00">July 14th 2021</time>
|
||||
</div>
|
||||
</article>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -74,26 +49,18 @@
|
||||
|
||||
|
||||
<div class="grid-x grid-x-padding">
|
||||
<div class="medium-8 cell">
|
||||
<div class="medium-8 small-12 small-order-2 medium-order-1"">
|
||||
{% for post in posts %}
|
||||
{% include 'posts/partials/_posts_hero.html' %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="medium-4 cell">
|
||||
<div class="date-box">
|
||||
|
||||
<span class="date-badge badge primary" style="">
|
||||
<span class="date-badge-day">16</span>
|
||||
<span class="date-badge-month">Apr</span>
|
||||
</span>
|
||||
<span class="date-text"><strong>Title</strong></span>
|
||||
<div class="medium-4 small-12 small-order-1 medium-order-2 padding-1">
|
||||
{% for post in events %}
|
||||
{% include 'posts/partials/_date_box.html' %}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
0
fet2020/templates/members/show_member.html
Normal file
0
fet2020/templates/members/show_member.html
Normal file
15
fet2020/templates/posts/partials/_article_row.html
Normal file
15
fet2020/templates/posts/partials/_article_row.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<a href="{{post.url}}">
|
||||
|
||||
<article class="article-row">
|
||||
|
||||
<div class="article-row-content">
|
||||
<h1 class="article-row-content-header">{{post.title}}</h1>
|
||||
|
||||
<p class="article-row-content-description">{{post.subtitle}}</p>
|
||||
|
||||
<p class="article-row-content-author">{{post.author}}</p>
|
||||
<time class="article-row-content-time" datetime="2008-02-14 20:00">{{post.public_date}}</time>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
</a>
|
||||
10
fet2020/templates/posts/partials/_date_box.html
Normal file
10
fet2020/templates/posts/partials/_date_box.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<a href ="">
|
||||
<div class="date-box">
|
||||
<span>
|
||||
<span class="date-badge badge primary" style="">
|
||||
<span class="date-badge-day">16</span>
|
||||
<span class="date-badge-month">Apr</span>
|
||||
</span></span>
|
||||
<span class="date-text"><strong>{{post.title}}</strong></span>
|
||||
|
||||
</div></a>
|
||||
Reference in New Issue
Block a user