News noch umgeschrieben und Benachrichtigungen hinzugefügt, Bug bei Summernote entfernt
This commit is contained in:
parent
be8a215c51
commit
1ba4da5b89
|
|
@ -31,4 +31,5 @@ users/migrations/*
|
|||
!users/migrations/__init__.py
|
||||
users/__pycache__/*
|
||||
|
||||
orga/__pycache__/*
|
||||
orga/__pycache__/*
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,6 +1,7 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% block content %}
|
||||
{% if request.user.profile.agency.module_news %}
|
||||
<div class="content-section col-6">
|
||||
<h3>News anlegen</h3>
|
||||
<hr>
|
||||
|
|
@ -20,4 +21,7 @@ $(document).ready(function() {
|
|||
});
|
||||
});
|
||||
</script>
|
||||
{% else %}
|
||||
<h3>Das Modul News wurde in ihrer Agentur deaktiviert.</h3>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% block content %}
|
||||
{% if request.user.profile.agency.module_news %}
|
||||
<div class="content-section">
|
||||
<div class="media">
|
||||
<div class="media-body">
|
||||
|
|
@ -16,4 +17,7 @@
|
|||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% else %}
|
||||
<h3>Das Modul News wurde in ihrer Agentur deaktiviert.</h3>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% block content %}
|
||||
{% if request.user.profile.agency.module_news %}
|
||||
<div class="content-section col-12">
|
||||
<h3>News</h3>
|
||||
<hr>
|
||||
|
|
@ -162,4 +163,7 @@ $('#news_tabs a').on('click', function (e) {
|
|||
});
|
||||
|
||||
</script>
|
||||
{% else %}
|
||||
<h3>Das Modul News wurde in ihrer Agentur deaktiviert.</h3>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% block content %}
|
||||
{% if request.user.profile.agency.module_news %}
|
||||
<div class="content-section col-12">
|
||||
<small>
|
||||
<h2>{{news.name}}</h2>
|
||||
|
|
@ -12,4 +13,7 @@
|
|||
{{news.media}}
|
||||
{{news.content|safe}}
|
||||
</div>
|
||||
{% else %}
|
||||
<h3>Das Modul News wurde in ihrer Agentur deaktiviert.</h3>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% block content %}
|
||||
{% if request.user.profile.agency.module_news %}
|
||||
<div class="content-section col-6">
|
||||
<h3>News bearbeiten</h3>
|
||||
<hr>
|
||||
|
|
@ -20,4 +21,7 @@ $(document).ready(function() {
|
|||
});
|
||||
});
|
||||
</script>
|
||||
{% else %}
|
||||
<h3>Das Modul News wurde in ihrer Agentur deaktiviert.</h3>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
from django.urls import path
|
||||
from .views import NewsManagement, NewsAdd, NewsDeleteView
|
||||
from django.contrib.auth.decorators import login_required, permission_required
|
||||
from . import views
|
||||
'''
|
||||
Permissions definiert in models.py bei USERS und dann hier vor die View geschrieben!
|
||||
|
|
@ -7,9 +8,9 @@ Permissions definiert in models.py bei USERS und dann hier vor die View geschrie
|
|||
|
||||
urlpatterns = [
|
||||
path('', NewsManagement.as_view(template_name="news/news_management.html"), name='news-management'),
|
||||
path('newsadd/', views.NewsAdd, name='news-add'),
|
||||
path('newsupdate/<int:id>/', views.NewsUpdate, name='news-update'),
|
||||
path('news/<int:pk>/delete', NewsDeleteView.as_view(), name='news-delete'),
|
||||
path('newsadd/', permission_required('users.modulenews')(views.NewsAdd), name='news-add'),
|
||||
path('newsupdate/<int:id>/', permission_required('users.modulenews')(views.NewsUpdate), name='news-update'),
|
||||
path('news/<int:pk>/delete', permission_required('users.modulenews')(NewsDeleteView.as_view()), name='news-delete'),
|
||||
#path('ajax/loadtasks/', views.load_tasks, name='ajax_loadtasks'),
|
||||
#path('standard/<int:pk>/changestat', views.StandardChangePublic, name="standard-status"),
|
||||
path('news/<int:pk>/single', views.NewsSingle, name="news-single"),
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,6 +2,7 @@ from django.db.models.signals import post_save, pre_delete, m2m_changed
|
|||
from django.contrib.auth.models import User, Group
|
||||
from django.dispatch import receiver
|
||||
from .models import Profile, Agency, AgencyGroup
|
||||
from news.models import News
|
||||
from django.contrib.auth.models import Permission
|
||||
from notificsys.models import UserNotification
|
||||
from django.core.mail import send_mail
|
||||
|
|
@ -86,4 +87,29 @@ def adjust_group_notifications(instance, action, reverse, model, pk_set, using,
|
|||
html_message=msg_html,
|
||||
fail_silently=False
|
||||
)
|
||||
|
||||
|
||||
# SIGNAL FOR NEWS
|
||||
@receiver(post_save, sender=News)
|
||||
def save_news(sender, instance, **kwargs):
|
||||
if(kwargs["created"]):
|
||||
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
||||
for user in usersofagency:
|
||||
|
||||
if(user.profile.news_mail):
|
||||
notificationtext = "Neue Agenturnews: " + instance.name
|
||||
|
||||
username = user.first_name + " " + user.last_name
|
||||
msg_html = render_to_string('notificsys/notification_mail.html', {'username': username, 'notificationtext' : notificationtext})
|
||||
if(GLOBALSENDMAILS):
|
||||
send_mail(
|
||||
'Agentur-Benachrichtigung',
|
||||
'Hallo ' + user.first_name + ' ' + user.last_name + '! ' + notificationtext,
|
||||
'support@digitale-agentur.com',
|
||||
[user.email],
|
||||
html_message=msg_html,
|
||||
fail_silently=False
|
||||
)
|
||||
|
||||
if(user.profile.news_push):
|
||||
newnotification = UserNotification(touser=user, notificationtext="Neue Agenturnews: " + instance.name, notificationtype="agencynews")
|
||||
newnotification.save()
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@
|
|||
<link href='https://fonts.googleapis.com/css?family=Roboto&display=swap' rel='stylesheet' type='text/css'>
|
||||
|
||||
<!-- include summernote css/js -->
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.12/summernote.css" rel="stylesheet">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.12/summernote.js"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/summernote@0.8.15/dist/summernote.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/summernote@0.8.15/dist/summernote.min.js"></script>
|
||||
|
||||
<!-- CROPPER -->
|
||||
<link href="{% static 'users/css/cropper.min.css' %}" rel="stylesheet">
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<hr>
|
||||
|
||||
<div class="row" style="float: left;">
|
||||
|
||||
{% if request.user.profile.agency.module_news %}
|
||||
<div class="card d-block mb-3 mr-3 " style="width: 60%" >
|
||||
<div class="card-body" >
|
||||
<h5 class="card-title">News</h5>
|
||||
|
|
@ -32,12 +32,22 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if request.user.profile.agency.module_news %}
|
||||
<div class="card d-block mb-3" style="width: 34.8%">
|
||||
<div class="card-body">
|
||||
<img width="100%" src="{{ request.user.profile.agency.get_photo_url }}">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if not request.user.profile.agency.module_news %}
|
||||
<div class="card d-block mb-3 mr-3 " style="width: 60%" >
|
||||
{% else %}
|
||||
<div class="card d-block mb-3" style="width: 96%">
|
||||
{% endif %}
|
||||
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Neueste Standards</h5>
|
||||
<div class="table-responsive">
|
||||
|
|
@ -58,9 +68,17 @@
|
|||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if not request.user.profile.agency.module_news %}
|
||||
<div class="card d-block mb-3" style="width: 34.8%">
|
||||
<div class="card-body">
|
||||
<img width="100%" src="{{ request.user.profile.agency.get_photo_url }}">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
|
|
|||
Loading…
Reference in New Issue