* adds news app for future implementations
This commit is contained in:
mipel
2021-07-06 08:53:08 +02:00
parent f069baa260
commit b01442ef17
14 changed files with 132 additions and 45 deletions

View File

@@ -1,21 +0,0 @@
"""
Author: Michel Peltriaux
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
Contact: michel.peltriaux@sgdnord.rlp.de
Created on: 05.07.21
"""
from django.contrib import admin
from konova.models import ServerMessage
class ServerMessageAdmin(admin.ModelAdmin):
list_display = [
"id",
"subject",
"publish_on",
"is_active",
]
admin.site.register(ServerMessage, ServerMessageAdmin)

View File

@@ -70,15 +70,3 @@ class Geometry(BaseResource):
Outsourced geometry model so multiple versions of the same object can refer to the same geometry if it is not changed
"""
geom = MultiPolygonField(null=True, blank=True)
class ServerMessage(BaseResource):
"""
Holds messages, which can be displayed on the user's dashboard
"""
subject = models.CharField(max_length=500, null=False, blank=False)
body = models.TextField()
is_active = models.BooleanField(default=True)
publish_on = models.DateTimeField()
unpublish_on = models.DateTimeField()
importance = models.CharField(max_length=100, choices=ServerMessageImportance.as_choices(drop_empty_choice=True))

View File

@@ -61,6 +61,7 @@ INSTALLED_APPS = [
'compensation',
'intervention',
'organisation',
'news',
]
if DEBUG:
INSTALLED_APPS += [
@@ -101,6 +102,7 @@ TEMPLATES = [
},
},
]
WSGI_APPLICATION = 'konova.wsgi.application'

View File

@@ -1,31 +1,9 @@
{% extends 'base.html' %}
{% load i18n ksp_filters %}
{% load i18n %}
{% block body %}
<div id="server-messages" class="row px-3">
<h4 class="row">{% trans 'News' %}</h4>
<div class="row px-3">
{% for msg in msgs %}
<div class="card col-md {{msg.importance|bootstrap_cls}}">
<div class="card-body">
<h6 class="card-title">{{msg.subject}}</h6>
<small>{% trans 'Published on' %} {{msg.publish_on}}</small>
<article class="card-text">{{msg.body|safe}}</article>
</div>
</div>
{% endfor %}
<div class="card col-md {{msg.importance|bootstrap_cls}} align-items-center justify-content-center">
<a class="w-100 h-100 align-middle text-center" href="{% url 'home' %}">
<div class="card-body">
<h5 class="card-title">{% trans 'Older ...' %}</h5>
</div>
</a>
</div>
</div>
</div>
{% include 'news/dashboard-news.html' %}
<hr>
<div id="quickstart" class="col-md px-3">
<h4 class="row">{% trans 'Quickstart' %}</h4>
<div class="row px-3">

View File

@@ -34,6 +34,7 @@ urlpatterns = [
path('ema/', include("intervention.urls")), #ToDo
path('organisation/', include("organisation.urls")),
path('user/', include("intervention.urls")), #ToDo
path('news/', include("news.urls")),
# Autocomplete paths
path("atcmplt/orgs", OrganisationAutocomplete.as_view(), name="orgs-autocomplete"),

View File

@@ -12,7 +12,7 @@ from django.shortcuts import redirect, render
from django.utils import timezone
from konova.contexts import BaseContext
from konova.models import ServerMessage
from news.models import ServerMessage
from konova.settings import SSO_SERVER_BASE