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