simplify urls and customflatpages
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
from django.urls import path
|
||||
|
||||
from . import apps
|
||||
from . import views
|
||||
|
||||
app_name = apps.AuthenticationsConfig.name
|
||||
|
||||
urlpatterns = [
|
||||
path("login/", views.loginPage, name="login"),
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
from django.urls import path
|
||||
|
||||
from . import apps
|
||||
from . import views
|
||||
|
||||
app_name = apps.BlackboardConfig.name
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.index, name="blackboard"),
|
||||
path("", views.index, name="index"),
|
||||
]
|
||||
|
||||
@@ -3,7 +3,6 @@ from datetime import timedelta
|
||||
from django.shortcuts import render
|
||||
from django.utils import timezone
|
||||
|
||||
from core.models import CustomFlatPage
|
||||
from .models import JobPosting
|
||||
|
||||
|
||||
@@ -12,13 +11,9 @@ def index(request):
|
||||
job_postings = JobPosting.all_job_postings.filter(
|
||||
publish_date__gt=job_postings_cutoff
|
||||
)
|
||||
bb_info = CustomFlatPage.objects.filter(title__iexact="blackboard").first()
|
||||
bb_empty = CustomFlatPage.objects.filter(title__iexact="blackboard empty").first()
|
||||
|
||||
context = {
|
||||
"job_postings": job_postings.order_by("-publish_date"),
|
||||
"bb_info": bb_info,
|
||||
"bb_empty": bb_empty,
|
||||
}
|
||||
|
||||
return render(request, "blackboard/index.html", context)
|
||||
|
||||
@@ -27,23 +27,22 @@ router.register(r"jobs", JobViewSet)
|
||||
router.register(r"jobmembers", JobMemberViewSet)
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.index, name="home"),
|
||||
path("admin/doc/", include("django.contrib.admindocs.urls")),
|
||||
path("admin/login/", RedirectView.as_view(pattern_name="login")),
|
||||
path("admin/login/", RedirectView.as_view(pattern_name="authentications:login")),
|
||||
path("admin/", admin.site.urls),
|
||||
path("auth/", include("authentications.urls")),
|
||||
path("", views.index, name="home"),
|
||||
path("api/", include(router.urls)),
|
||||
path("blackboard/", include("blackboard.urls"), name="blackboard"),
|
||||
path("blackboard/", include("blackboard.urls")),
|
||||
path("ckeditor/", include("ckeditor_uploader.urls")),
|
||||
path("gallery/", include("gallery.urls"), name="gallery"),
|
||||
path("index.html", views.index, name="home"),
|
||||
path("gallery/", include("gallery.urls")),
|
||||
path("intern/", include("intern.urls")),
|
||||
path("jobs/", include(jobs_urlpatterns)),
|
||||
path("members/", include("members.urls")),
|
||||
path("member/", include(member_urlpatterns)),
|
||||
path("posts/", include("posts.urls")),
|
||||
path("search/", include("search.urls")),
|
||||
path("tasks/", include("tasks.urls"), name="tasks"),
|
||||
path("intern/", include("intern.urls"), name="intern"),
|
||||
path("tasks/", include("tasks.urls")),
|
||||
path(
|
||||
"discord/",
|
||||
RedirectView.as_view(url="https://discord.com/invite/7qRuuMA"),
|
||||
@@ -70,8 +69,4 @@ urlpatterns = [
|
||||
),
|
||||
path("pages/", include("django.contrib.flatpages.urls")),
|
||||
re_path(r"^(?P<url>.*/)$", flatpages.views.flatpage),
|
||||
path(
|
||||
"impressum/", flatpages.views.flatpage, {"url": "/impressum/"}, name="impressum"
|
||||
),
|
||||
path("kontakt/", flatpages.views.flatpage, {"url": "/kontakt/"}, name="contact"),
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
from django.urls import path
|
||||
|
||||
from . import apps
|
||||
from . import views
|
||||
|
||||
app_name = apps.GalleryConfig.name
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.index, name="gallery"),
|
||||
path("", views.index, name="index"),
|
||||
path("<slug:slug>/", views.show_album, name="album"),
|
||||
path("draft/<slug:slug>/", views.show_draft_album, name="draft-album"),
|
||||
]
|
||||
|
||||
@@ -4,7 +4,6 @@ from collections import deque
|
||||
from django.http import Http404
|
||||
from django.shortcuts import render
|
||||
|
||||
from core.models import CustomFlatPage
|
||||
from .models import Member, JobMember, JobGroup
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -41,13 +40,10 @@ def index(request):
|
||||
pinned_job_groups, unpinned_job_groups = __get_job_groups()
|
||||
members = Member.all_members.all()
|
||||
|
||||
fs_info = CustomFlatPage.objects.filter(title__iexact="fachschaft").first()
|
||||
|
||||
context = {
|
||||
"pinned_job_groups": pinned_job_groups,
|
||||
"unpinned_job_groups": unpinned_job_groups,
|
||||
"members": members,
|
||||
"fs_info": fs_info,
|
||||
}
|
||||
|
||||
return render(request, "members/members.html", context)
|
||||
@@ -89,13 +85,10 @@ def members(request, filter=None):
|
||||
logger.info("Wrong member role '{}'".format(filter))
|
||||
raise Http404("no member role")
|
||||
|
||||
fs_info = CustomFlatPage.objects.filter(title__iexact="fachschaft").first()
|
||||
|
||||
context = {
|
||||
"pinned_job_groups": pinned_job_groups,
|
||||
"unpinned_job_groups": unpinned_job_groups,
|
||||
"members": members,
|
||||
"fs_info": fs_info,
|
||||
}
|
||||
|
||||
return render(request, "members/members.html", context)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{% load flatpages %}
|
||||
{% load static %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
@@ -70,12 +71,16 @@
|
||||
>
|
||||
<li><a href="{% url 'posts:index' %}">News</a></li>
|
||||
<li><a href="{% url 'members:members' 'active' %}">Fachschaft</a></li>
|
||||
<li><a href="{% url 'gallery' %}">Galerie</a></li>
|
||||
<li><a href="{% url 'blackboard' %}">Blackboard</a></li>
|
||||
<li><a href="{% url 'contact' %}">Kontakt</a></li>
|
||||
<li><a href="{% url 'gallery:index' %}">Galerie</a></li>
|
||||
<li><a href="{% url 'blackboard:index' %}">Blackboard</a></li>
|
||||
|
||||
{% get_flatpages '/kontakt/' as pages %}
|
||||
{% if pages %}
|
||||
<li><a href="{{ pages.first.url }}">{{ pages.first.title }}</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% if not request.user.is_authenticated %}
|
||||
<li><a href="{% url 'login' %}?next={{ request.path }}">Login</a></li>
|
||||
<li><a href="{% url 'authentications:login' %}?next={{ request.path }}">Anmelden</a></li>
|
||||
{% else %}
|
||||
<hr class="border-proprietary">
|
||||
<div href="#" class="inline-block w-full sm:w-auto rounded relative"
|
||||
@@ -92,7 +97,7 @@
|
||||
Hallo {{ request.user.username }}
|
||||
{% endif %}
|
||||
</a>
|
||||
<a class="hidden sm:block flex-0 px-2 py-1 hover:bg-proprietary-dark dark:hover:bg-proprietary-darker active:bg-proprietary-dark dark:active:bg-proprietary-darker rounded-r" href="{% url 'logout' %}?next={{ request.path }}"><i class="fa-solid fa-power-off"></i></a>
|
||||
<a class="hidden sm:block flex-0 px-2 py-1 hover:bg-proprietary-dark dark:hover:bg-proprietary-darker active:bg-proprietary-dark dark:active:bg-proprietary-darker rounded-r" href="{% url 'authentications:logout' %}?next={{ request.path }}"><i class="fa-solid fa-power-off"></i></a>
|
||||
</div>
|
||||
<div class="sm:block sm:absolute z-20 top-9 right-0 bg-white dark:bg-transparent dark:sm:bg-gray-700 sm:shadow-md sm:rounded w-full dark:sm:text-proprietary-lightest"
|
||||
x-show="showPopupNav || !$screen('sm')"
|
||||
@@ -109,7 +114,7 @@
|
||||
<li class="navInternal"><a href="https://legacy.fet.at/home/intern"><i class="fa-fw fa-solid fa-database mr-2"></i>Legacy</a></li>
|
||||
<li class="navInternal"
|
||||
x-show="!$screen('sm')"
|
||||
><a href="{% url 'logout' %}?next={{ request.path }}"><i class="fa-fw fa-solid fa-power-off mr-2"></i>Logout</a></li>
|
||||
><a href="{% url 'authentications:logout' %}?next={{ request.path }}"><i class="fa-fw fa-solid fa-power-off mr-2"></i>Abmelden</a></li>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -138,9 +143,12 @@
|
||||
<a href="mailto:service@fet.at"><i class="fas fa-envelope"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="legal">
|
||||
<a href="{% url 'impressum' %}" class="text-center text-sm sm:text-base">Impressum</a>
|
||||
</div>
|
||||
{% get_flatpages '/impressum/' as pages %}
|
||||
{% if pages %}
|
||||
<div class="legal">
|
||||
<a href="{{ pages.first.url }}" class="text-center text-sm sm:text-base">{{ pages.first.title }}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<hr class="legal-divider">
|
||||
<p class="copyright">© {% now 'Y' %} FET - Alle Rechte vorbehalten.</p>
|
||||
</footer>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% load flatpages %}
|
||||
|
||||
{% block title %}Blackboard{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
@@ -8,20 +10,21 @@
|
||||
<h1 class="page-title">Blackboard</h1>
|
||||
|
||||
<div class="lg:w-2/3 xl:w-7/12 mx-auto">
|
||||
<section class="my-8 flex flex-col gap-2">
|
||||
<div class="db-page-content">
|
||||
<!-- Content from DB here: -->
|
||||
{% if bb_info %}
|
||||
{{ bb_info.content|safe }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% get_flatpages '/blackboard-info/' as bb_infos %}
|
||||
{% if bb_infos %}
|
||||
<section class="my-8 flex flex-col gap-2">
|
||||
<div class="db-page-content">
|
||||
<!-- Content from DB here: -->
|
||||
{{ bb_infos.first.content|safe }}
|
||||
</div>
|
||||
|
||||
{% if request.user.is_authenticated and bb_info %}
|
||||
<a href="{% url 'admin:core_customflatpage_change' bb_info.id %}" class="self-center sm:self-end btn-small btn-primary w-full sm:w-auto max-w-sm">
|
||||
<i class="fa-regular fa-pen-to-square mr-1"></i>Info-Text bearbeiten
|
||||
</a>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% if request.user.is_authenticated %}
|
||||
<a href="{% url 'admin:core_customflatpage_change' bb_infos.first.id %}" class="self-center sm:self-end btn-small btn-primary w-full sm:w-auto max-w-sm">
|
||||
<i class="fa-regular fa-pen-to-square mr-1"></i>Info-Text bearbeiten
|
||||
</a>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if job_postings %}
|
||||
<section class="my-8 flex flex-col gap-2">
|
||||
@@ -43,13 +46,13 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
{% else %}
|
||||
<section class="my-8 p-8 flex flex-col gap-2 items-center border-2 border-dashed rounded border-gray-300 dark:border-gray-600">
|
||||
{% if bb_empty %}
|
||||
{% get_flatpages '/blackboard-blank/' as bb_blanks %}
|
||||
{% if bb_blanks %}
|
||||
<div class="text-center text-gray-600 dark:text-gray-300">
|
||||
<i class="fa-solid fa-sparkles text-gray-400 dark:text-gray-400 text-2xl mb-4"></i>
|
||||
{{ bb_empty.content|safe }}
|
||||
{{ bb_blanks.first.content|safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -58,8 +61,8 @@
|
||||
<a href="{% url 'admin:blackboard_jobposting_add' %}" class="self-center block btn-small btn-primary w-full sm:w-auto max-w-sm">
|
||||
<i class="fa-regular fa-square-plus mr-1"></i>Neuer Eintrag
|
||||
</a>
|
||||
{% if bb_empty %}
|
||||
<a href="{% url 'admin:core_customflatpage_change' bb_empty.id %}" class="self-center block btn-small btn-primary w-full sm:w-auto max-w-sm">
|
||||
{% if bb_blanks %}
|
||||
<a href="{% url 'admin:core_customflatpage_change' bb_blanks.first.id %}" class="self-center block btn-small btn-primary w-full sm:w-auto max-w-sm">
|
||||
<i class="fa-solid fa-asterisk mr-1"></i>Fülltext bearbeiten
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Gallery{% endblock %}
|
||||
{% block title %}Gallerie{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Main Content -->
|
||||
<main class="container mx-auto w-full px-4 my-8 flex-1">
|
||||
<h1 class="page-title">Fotos</h1>
|
||||
<h1 class="page-title">Gallerie</h1>
|
||||
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 justify-items-center gap-4">
|
||||
{% for album in albums %}
|
||||
{% if album.status == "10" %}
|
||||
<a href="{% url 'draft-album' album.slug %}" class="block max-w-xs sm:max-w-none">
|
||||
<a href="{% url 'gallery:draft-album' album.slug %}" class="block max-w-xs sm:max-w-none">
|
||||
{% else %}
|
||||
<a href="{% url 'album' album.slug %}" class="block max-w-xs sm:max-w-none">
|
||||
<a href="{% url 'gallery:album' album.slug %}" class="block max-w-xs sm:max-w-none">
|
||||
{% endif %}
|
||||
<img src="{{ album.thumbnail }}" class="rounded">
|
||||
<h2 class="px-2 text-proprietary-dark dark:text-sky-300">{{ album.title }}</h2>
|
||||
|
||||
@@ -63,12 +63,12 @@
|
||||
<!-- show active members first -->
|
||||
<li><a class="button header-btn header-link" href="{% url 'members:members' 'active' %}">Fachschaft</a></li>
|
||||
<li><a class="button header-btn header-link" href="{% url 'gallery' %}">Galerie</a></li>
|
||||
<li><a class="button header-btn header-link" href="{% url 'blackboard' %}">Blackboard</a></li>
|
||||
<li><a class="button header-btn header-link" href="{% url 'blackboard:index' %}">Blackboard</a></li>
|
||||
<li><a class="button header-btn header-link" href="{% url 'contact' %}">Kontakt</a></li>
|
||||
{% if request.user.is_authenticated %}
|
||||
<li><a class="button header-btn header-link" href="{% url 'logout' %}?next={{ request.path }}">Logout</a></li>
|
||||
<li><a class="button header-btn header-link" href="{% url 'authentications:logout' %}?next={{ request.path }}">Logout</a></li>
|
||||
{% else %}
|
||||
<li><a class="button header-btn header-link" href="{% url 'login' %}?next={{ request.path }}">Login</a></li>
|
||||
<li><a class="button header-btn header-link" href="{% url 'authentications:login' %}?next={{ request.path }}">Login</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% load flatpages %}
|
||||
{% load softhyphen_tags %}
|
||||
{% load static %}
|
||||
|
||||
@@ -71,9 +72,10 @@
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if fs_info %}
|
||||
{% get_flatpages '/fachschaft/' as pages %}
|
||||
{% if pages %}
|
||||
<li class="internalLI">
|
||||
<a href="{% url 'admin:core_customflatpage_change' fs_info.id %}">
|
||||
<a href="{% url 'admin:core_customflatpage_change' pages.first.id %}">
|
||||
<i class="fa-regular fa-pen-to-square mr-1"></i>Fachschaft-Text bearbeiten
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{% extends 'members/index.html' %}
|
||||
|
||||
{% load softhyphen_tags %}
|
||||
|
||||
{% block title %}{{ member.firstname }} {{ member.surname }}{% endblock %}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
{% extends 'members/index.html' %}
|
||||
|
||||
{% load flatpages %}
|
||||
|
||||
{% block title %}Fachschaft{% endblock %}
|
||||
|
||||
{% block members_content %}
|
||||
{% if fs_info %}
|
||||
{% get_flatpages '/fachschaft/' as pages %}
|
||||
{% if pages %}
|
||||
<div class="db-page-content">
|
||||
{{ fs_info.content|safe }}
|
||||
{{ pages.first.content|safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user