diff --git a/areas/migrations/0001_initial.py b/areas/migrations/0001_initial.py index b169754..6d36ba4 100644 --- a/areas/migrations/0001_initial.py +++ b/areas/migrations/0001_initial.py @@ -1,10 +1,8 @@ -# Generated by Django 3.0 on 2019-12-03 22:58 +# Generated by Django 2.2.7 on 2019-12-09 17:02 import colorful.fields import datetime -from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): @@ -12,8 +10,6 @@ class Migration(migrations.Migration): initial = True dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('users', '0001_initial'), ] operations = [ @@ -26,9 +22,6 @@ class Migration(migrations.Migration): ('desc', models.TextField(blank=True, max_length=3000)), ('created_area_date', models.DateField(blank=True, default=datetime.date.today)), ('visible', models.BooleanField(default=True)), - ('agency', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='users.Agency')), - ('created_area_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), - ('usersfield', models.ManyToManyField(blank=True, related_name='users_in_area', to=settings.AUTH_USER_MODEL)), ], ), ] diff --git a/areas/migrations/0002_auto_20191209_1802.py b/areas/migrations/0002_auto_20191209_1802.py new file mode 100644 index 0000000..c81cbd3 --- /dev/null +++ b/areas/migrations/0002_auto_20191209_1802.py @@ -0,0 +1,34 @@ +# Generated by Django 2.2.7 on 2019-12-09 17:02 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('areas', '0001_initial'), + ('users', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.AddField( + model_name='areas', + name='agency', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='users.Agency'), + ), + migrations.AddField( + model_name='areas', + name='created_area_by', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='areas', + name='usersfield', + field=models.ManyToManyField(blank=True, related_name='users_in_area', to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/areas/migrations/__pycache__/0001_initial.cpython-38.pyc b/areas/migrations/__pycache__/0001_initial.cpython-38.pyc index 77c5047..e7289b8 100644 Binary files a/areas/migrations/__pycache__/0001_initial.cpython-38.pyc and b/areas/migrations/__pycache__/0001_initial.cpython-38.pyc differ diff --git a/areas/migrations/__pycache__/0002_auto_20191209_1802.cpython-38.pyc b/areas/migrations/__pycache__/0002_auto_20191209_1802.cpython-38.pyc new file mode 100644 index 0000000..547252b Binary files /dev/null and b/areas/migrations/__pycache__/0002_auto_20191209_1802.cpython-38.pyc differ diff --git a/areas/templates/areas/areas_management.html b/areas/templates/areas/areas_management.html index 18eab57..00ecbbc 100644 --- a/areas/templates/areas/areas_management.html +++ b/areas/templates/areas/areas_management.html @@ -13,59 +13,38 @@
- {% for item in areas_of_agency %} - -
-
- -
-
{{item.name }}
- -
diff --git a/digitaleagentur/__pycache__/settings.cpython-38.pyc b/digitaleagentur/__pycache__/settings.cpython-38.pyc index c2c88dc..1b9fb5b 100644 Binary files a/digitaleagentur/__pycache__/settings.cpython-38.pyc and b/digitaleagentur/__pycache__/settings.cpython-38.pyc differ diff --git a/digitaleagentur/__pycache__/urls.cpython-38.pyc b/digitaleagentur/__pycache__/urls.cpython-38.pyc index ccf04f6..a45d73b 100644 Binary files a/digitaleagentur/__pycache__/urls.cpython-38.pyc and b/digitaleagentur/__pycache__/urls.cpython-38.pyc differ diff --git a/digitaleagentur/settings.py b/digitaleagentur/settings.py index 9b4611a..6f80711 100644 --- a/digitaleagentur/settings.py +++ b/digitaleagentur/settings.py @@ -35,6 +35,7 @@ INSTALLED_APPS = [ 'orga.apps.OrgaConfig', 'tasks.apps.TasksConfig', 'standards.apps.StandardsConfig', + 'news.apps.NewsConfig', 'crispy_forms', 'colorful', 'ckeditor', @@ -45,6 +46,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'bootstrap_datepicker_plus', ] MIDDLEWARE = [ @@ -193,3 +195,8 @@ EMAIL_USE_TLS = True EMAIL_HOST_USER = "support@digitale-agentur.com" EMAIL_HOST_PASSWORD = "aPx9m3!7x3m@8o!t" + +# FOR DATEPICKER +BOOTSTRAP4 = { + 'include_jquery': True, +} \ No newline at end of file diff --git a/digitaleagentur/urls.py b/digitaleagentur/urls.py index aa0a82a..80e84f1 100644 --- a/digitaleagentur/urls.py +++ b/digitaleagentur/urls.py @@ -17,6 +17,7 @@ from django.contrib.auth.decorators import login_required tasks standards orga + news -> Rest ist von Django @@ -28,6 +29,7 @@ urlpatterns = [ path('areas/', include('areas.urls'), name="areas-management"), path('tasks/', include('tasks.urls'), name="tasks-management"), path('standards/', include('standards.urls'), name="standards"), + path('news/', include('news.urls'), name="dashboard"), path('orga/', include('orga.urls'), name="orga"), path('password-reset/', auth_views.PasswordResetView.as_view(template_name='users/password_reset.html'), name='password-reset'), path('password-reset/done/', auth_views.PasswordResetDoneView.as_view(template_name='users/password_reset_done.html'), name='password_reset_done'), diff --git a/media/userprofilepics/Makris_Philipp_7zkFtau.jpg b/media/userprofilepics/Makris_Philipp_7zkFtau.jpg index 56f88cc..d5db87e 100644 Binary files a/media/userprofilepics/Makris_Philipp_7zkFtau.jpg and b/media/userprofilepics/Makris_Philipp_7zkFtau.jpg differ diff --git a/media/userprofilepics/Timm_Hannes.jpg b/media/userprofilepics/Timm_Hannes.jpg index 0b6d00c..b2e134e 100644 Binary files a/media/userprofilepics/Timm_Hannes.jpg and b/media/userprofilepics/Timm_Hannes.jpg differ diff --git a/media/userprofilepics/Valentiner_Sebastian_apbr5VU.jpg b/media/userprofilepics/Valentiner_Sebastian_apbr5VU.jpg index a337ebf..0f86948 100644 Binary files a/media/userprofilepics/Valentiner_Sebastian_apbr5VU.jpg and b/media/userprofilepics/Valentiner_Sebastian_apbr5VU.jpg differ diff --git a/news/__init__.py b/news/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/news/__pycache__/__init__.cpython-38.pyc b/news/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..50d4891 Binary files /dev/null and b/news/__pycache__/__init__.cpython-38.pyc differ diff --git a/news/__pycache__/admin.cpython-38.pyc b/news/__pycache__/admin.cpython-38.pyc new file mode 100644 index 0000000..8692976 Binary files /dev/null and b/news/__pycache__/admin.cpython-38.pyc differ diff --git a/news/__pycache__/apps.cpython-38.pyc b/news/__pycache__/apps.cpython-38.pyc new file mode 100644 index 0000000..45a5cfe Binary files /dev/null and b/news/__pycache__/apps.cpython-38.pyc differ diff --git a/news/__pycache__/forms.cpython-38.pyc b/news/__pycache__/forms.cpython-38.pyc new file mode 100644 index 0000000..4f2a036 Binary files /dev/null and b/news/__pycache__/forms.cpython-38.pyc differ diff --git a/news/__pycache__/models.cpython-38.pyc b/news/__pycache__/models.cpython-38.pyc new file mode 100644 index 0000000..efe672a Binary files /dev/null and b/news/__pycache__/models.cpython-38.pyc differ diff --git a/news/__pycache__/urls.cpython-38.pyc b/news/__pycache__/urls.cpython-38.pyc new file mode 100644 index 0000000..4f0ef46 Binary files /dev/null and b/news/__pycache__/urls.cpython-38.pyc differ diff --git a/news/__pycache__/views.cpython-38.pyc b/news/__pycache__/views.cpython-38.pyc new file mode 100644 index 0000000..f23ea34 Binary files /dev/null and b/news/__pycache__/views.cpython-38.pyc differ diff --git a/news/admin.py b/news/admin.py new file mode 100644 index 0000000..a0137d8 --- /dev/null +++ b/news/admin.py @@ -0,0 +1,4 @@ +from django.contrib import admin +from .models import News +# Register your models here. +admin.site.register(News) \ No newline at end of file diff --git a/news/apps.py b/news/apps.py new file mode 100644 index 0000000..5a7b92d --- /dev/null +++ b/news/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class NewsConfig(AppConfig): + name = 'news' diff --git a/news/forms.py b/news/forms.py new file mode 100644 index 0000000..497ac48 --- /dev/null +++ b/news/forms.py @@ -0,0 +1,35 @@ +from bootstrap_datepicker_plus import DatePickerInput +from django import forms +from django.forms import ModelForm +from .models import News +from ckeditor.widgets import CKEditorWidget + + +class NewsAddNews(forms.ModelForm): + + + class Meta: + model = News + labels = { + "name" : "Titel", + "go_online_on" : "Veröffentlichen", + "go_offline_on" : "Ins Archiv" + } + fields = ['name', 'go_online_on', 'go_offline_on'] + widgets = { + 'go_online_on': DatePickerInput(options={"format":'DD.MM.YYYY HH:mm', "locale":'de'}), + 'go_offline_on': DatePickerInput(options={"format":'DD.MM.YYYY HH:mm', "locale":'de'}), + } + +class NewsAddNewsEditor(forms.ModelForm): + + class Meta: + model = News + labels = { + "content" : "Inhalt" + } + fields = ['content'] + + + + \ No newline at end of file diff --git a/news/migrations/0001_initial.py b/news/migrations/0001_initial.py new file mode 100644 index 0000000..859bf21 --- /dev/null +++ b/news/migrations/0001_initial.py @@ -0,0 +1,28 @@ +# Generated by Django 2.2.7 on 2019-12-09 17:02 + +import ckeditor_uploader.fields +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='News', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(default='', max_length=200)), + ('content', ckeditor_uploader.fields.RichTextUploadingField(blank=True, verbose_name='Inhalt')), + ('created_date', models.DateField(blank=True, default=datetime.date.today)), + ('go_online_on', models.DateField(blank=True, default=datetime.date.today)), + ('go_offline_on', models.DateField(blank=True, default=datetime.date.today)), + ('last_modified_on', models.DateField(blank=True, default=datetime.date.today)), + ], + ), + ] diff --git a/news/migrations/0002_auto_20191209_1802.py b/news/migrations/0002_auto_20191209_1802.py new file mode 100644 index 0000000..ee73a8a --- /dev/null +++ b/news/migrations/0002_auto_20191209_1802.py @@ -0,0 +1,34 @@ +# Generated by Django 2.2.7 on 2019-12-09 17:02 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('news', '0001_initial'), + ('users', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.AddField( + model_name='news', + name='agency', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.Agency'), + ), + migrations.AddField( + model_name='news', + name='created_by', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='news', + name='last_modified_by', + field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.PROTECT, related_name='news_mod_by', to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/news/migrations/0003_auto_20191209_1828.py b/news/migrations/0003_auto_20191209_1828.py new file mode 100644 index 0000000..ebba84d --- /dev/null +++ b/news/migrations/0003_auto_20191209_1828.py @@ -0,0 +1,24 @@ +# Generated by Django 2.2.7 on 2019-12-09 17:28 + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('news', '0002_auto_20191209_1802'), + ] + + operations = [ + migrations.AlterField( + model_name='news', + name='go_offline_on', + field=models.DateTimeField(blank=True, default=datetime.date.today), + ), + migrations.AlterField( + model_name='news', + name='go_online_on', + field=models.DateTimeField(blank=True, default=datetime.date.today), + ), + ] diff --git a/news/migrations/__init__.py b/news/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/news/migrations/__pycache__/0001_initial.cpython-38.pyc b/news/migrations/__pycache__/0001_initial.cpython-38.pyc new file mode 100644 index 0000000..5c9082c Binary files /dev/null and b/news/migrations/__pycache__/0001_initial.cpython-38.pyc differ diff --git a/news/migrations/__pycache__/0002_auto_20191209_1753.cpython-38.pyc b/news/migrations/__pycache__/0002_auto_20191209_1753.cpython-38.pyc new file mode 100644 index 0000000..0a3ee48 Binary files /dev/null and b/news/migrations/__pycache__/0002_auto_20191209_1753.cpython-38.pyc differ diff --git a/news/migrations/__pycache__/0002_auto_20191209_1802.cpython-38.pyc b/news/migrations/__pycache__/0002_auto_20191209_1802.cpython-38.pyc new file mode 100644 index 0000000..87961de Binary files /dev/null and b/news/migrations/__pycache__/0002_auto_20191209_1802.cpython-38.pyc differ diff --git a/news/migrations/__pycache__/0003_auto_20191209_1757.cpython-38.pyc b/news/migrations/__pycache__/0003_auto_20191209_1757.cpython-38.pyc new file mode 100644 index 0000000..23af06f Binary files /dev/null and b/news/migrations/__pycache__/0003_auto_20191209_1757.cpython-38.pyc differ diff --git a/news/migrations/__pycache__/0003_auto_20191209_1828.cpython-38.pyc b/news/migrations/__pycache__/0003_auto_20191209_1828.cpython-38.pyc new file mode 100644 index 0000000..4af0db9 Binary files /dev/null and b/news/migrations/__pycache__/0003_auto_20191209_1828.cpython-38.pyc differ diff --git a/news/migrations/__pycache__/__init__.cpython-38.pyc b/news/migrations/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..a1952a4 Binary files /dev/null and b/news/migrations/__pycache__/__init__.cpython-38.pyc differ diff --git a/news/models.py b/news/models.py new file mode 100644 index 0000000..4c866e3 --- /dev/null +++ b/news/models.py @@ -0,0 +1,29 @@ +from django.db import models +from django.contrib.auth.models import User +from users.models import Agency +from django.urls import reverse +import datetime +from ckeditor_uploader.fields import RichTextUploadingField +from bootstrap_datepicker_plus import DatePickerInput + +class News(models.Model): + + agency = models.ForeignKey(Agency, on_delete=models.CASCADE) + name = models.CharField(max_length=200, blank=False, default="") + content = RichTextUploadingField(blank=True, verbose_name='Inhalt') + + created_by = models.ForeignKey(User, on_delete=models.PROTECT) + created_date = models.DateField(default=datetime.date.today, blank=True) + + go_online_on = models.DateTimeField(default=datetime.date.today, blank=True) + go_offline_on = models.DateTimeField(default=datetime.date.today, blank=True) + + last_modified_by = models.ForeignKey(User, on_delete=models.PROTECT, related_name='news_mod_by', default=None) + last_modified_on = models.DateField(default=datetime.date.today, blank=True) + + def __str__(self): + return f'{self.name}' + + # Hier Path für Templates des Models mit Parametern + def get_absolute_url(self): + return reverse('news-update', kwargs={'pk':self.pk}) \ No newline at end of file diff --git a/news/templates/news/news_addnews.html b/news/templates/news/news_addnews.html new file mode 100644 index 0000000..b00e2ff --- /dev/null +++ b/news/templates/news/news_addnews.html @@ -0,0 +1,18 @@ +{% extends "users/base.html" %} +{% load crispy_forms_tags %} +{% block content %} +
+

News erstellen

+
+
+ {% csrf_token %} + {{normalForm.media}} + {{normalForm|crispy}} + {{editorForm.media}} + {{editorForm}} +
+   + Abbrechen +
+
+{% endblock content %} \ No newline at end of file diff --git a/news/templates/news/news_confirm_delete.html b/news/templates/news/news_confirm_delete.html new file mode 100644 index 0000000..f51ccaa --- /dev/null +++ b/news/templates/news/news_confirm_delete.html @@ -0,0 +1,19 @@ +{% extends "users/base.html" %} +{% load crispy_forms_tags %} +{% block content %} +
+
+
+ +
+
+
+
+ {% csrf_token %} +
+   + Abbrechen +
+
+
+{% endblock content %} \ No newline at end of file diff --git a/news/templates/news/news_management.html b/news/templates/news/news_management.html new file mode 100644 index 0000000..ea239c8 --- /dev/null +++ b/news/templates/news/news_management.html @@ -0,0 +1,51 @@ +{% extends "users/base.html" %} +{% block content %} +
+

News

+
+

+ Newsbereich verwalten +

+
+ +
+
+
+ + + + + + + + + + + {% for news_single in news %} + + + + + + + + {% endfor %} +
TitelErstellt vonErstellt amSichtbar von/bis 
{{news_single.name }}{{ news_single.created_by.first_name }} {{ news_single.created_by.last_name }}{{ news_single.created_date }}{{ news_single.go_online_on|date:"d.m.Y, h:i"}} bis {{ news_single.go_offline_on|date:"d.m.Y, h:i"}} + {% if news_single.created_by == request.user or perms.users.news_management %} + + + {% endif %} + +
+
+{% endblock content %} diff --git a/news/templates/news/news_single.html b/news/templates/news/news_single.html new file mode 100644 index 0000000..228a5d4 --- /dev/null +++ b/news/templates/news/news_single.html @@ -0,0 +1,15 @@ +{% extends "users/base.html" %} +{% block content %} +
+ +

{{news.name}}

+ Erstellt durch {{news.created_by.first_name}} {{news.created_by.last_name}} am {{news.created_date}} | Zuletzt bearbeitet von {{ news.last_modified_by.first_name}} {{ news.last_modified_by.last_name}} am {{ news.last_modified_on}} + {% if news.created_by == user or perms.users.news_management %} +  | Bearbeiten + {% endif %} +
+
+ {{news.media}} + {{news.content|safe}} +
+{% endblock content %} \ No newline at end of file diff --git a/news/templates/news/news_update.html b/news/templates/news/news_update.html new file mode 100644 index 0000000..bb7a26e --- /dev/null +++ b/news/templates/news/news_update.html @@ -0,0 +1,18 @@ +{% extends "users/base.html" %} +{% load crispy_forms_tags %} +{% block content %} +
+

News bearbeiten

+
+
+ {% csrf_token %} + {{normalForm.media}} + {{normalForm|crispy}} + {{editorForm.media}} + {{editorForm}} +
+   + Abbrechen +
+
+{% endblock content %} \ No newline at end of file diff --git a/news/tests.py b/news/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/news/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/news/urls.py b/news/urls.py new file mode 100644 index 0000000..6e3ca0e --- /dev/null +++ b/news/urls.py @@ -0,0 +1,18 @@ +from django.urls import path +from .views import NewsManagement, NewsAdd, NewsDeleteView +from . import views +''' +Permissions definiert in models.py bei USERS und dann hier vor die View geschrieben! +''' + +urlpatterns = [ + path('', NewsManagement.as_view(template_name="news/news_management.html"), name='news-management'), + path('newsadd/', views.NewsAdd, name='news-add'), + path('newsupdate//', views.NewsUpdate, name='news-update'), + path('news//delete', NewsDeleteView.as_view(), name='news-delete'), + #path('ajax/loadtasks/', views.load_tasks, name='ajax_loadtasks'), + #path('standard//changestat', views.StandardChangePublic, name="standard-status"), + path('news//single', views.NewsSingle, name="news-single"), + #path('standard//area', views.StandardArea, name="standard-area"), + #path('standard//task', views.StandardTask, name="standard-task") +] diff --git a/news/views.py b/news/views.py new file mode 100644 index 0000000..92a0494 --- /dev/null +++ b/news/views.py @@ -0,0 +1,121 @@ +from django.shortcuts import render, redirect +from django.contrib.auth.mixins import LoginRequiredMixin +from django.views.generic import CreateView, ListView, UpdateView, DetailView, DeleteView +from django.contrib.auth.models import User +from .models import News +from .forms import NewsAddNews, NewsAddNewsEditor +from django.contrib.auth.decorators import login_required +from datetime import datetime +from django.contrib import messages +from django.utils.dateparse import parse_date +# Create your views here. +# ALLE STANDARDS EINER AGENTUR +class NewsManagement(LoginRequiredMixin, ListView): + model = News + # Adding active_link + # Loading only user same agency + # Change context and return for template-data + def get_context_data(self, **kwargs): + filterdate = datetime.now() + news = News.objects.filter(agency__pk=self.request.user.profile.agency.pk) + context = super().get_context_data(**kwargs) + context.update({'active_link' : 'newsmanagement', 'news' : news}) + return context +''' +class NewsAddNews(LoginRequiredMixin, CreateView): + model = News + fields = ['name', 'content','go_online_on', 'go_offline_on'] + success_url = '/dashboard/news/' +''' +@login_required +def NewsAdd(request): + if request.method == 'POST': + normalForm = NewsAddNews(request.POST, instance=request.user) + editorForm = NewsAddNewsEditor(request.POST, instance=request.user) + + if editorForm.is_valid() and normalForm.is_valid(): + normalForm.agency = request.user.profile.agency + normalForm.created_by = request.user + normalForm.last_modified_by = request.user + normalForm.save() + editorForm.save() + new_news = News() + new_news.agency = request.user.profile.agency + new_news.created_by = request.user + + new_news.last_modified_by = request.user + new_news.created_date = datetime.now() + new_news.last_modified_on = datetime.now() + + new_news.name = normalForm.cleaned_data['name'] + new_news.content = editorForm.cleaned_data['content'] + new_news.go_online_on = normalForm.cleaned_data['go_online_on'] + new_news.go_offline_on = normalForm.cleaned_data['go_offline_on'] + + new_news.save() + messages.success(request, f'News gespeichert!') + return redirect('news-management') + + else: + normalForm = NewsAddNews(instance=request.user) + editorForm = NewsAddNewsEditor(instance=request.user) + + + context = { + 'normalForm' : normalForm, + 'editorForm' : editorForm, + 'active_link' : 'newsmanagement' + } + return render(request, 'news/news_addnews.html', context) + +@login_required +def NewsUpdate(request, id): + news = News.objects.get(pk=id) + if request.method == 'POST': + normalForm = NewsAddNews(request.POST, instance=news) + editorForm = NewsAddNewsEditor(request.POST, instance=news) + + if editorForm.is_valid() and normalForm.is_valid(): + news = News.objects.get(pk=id) + news.last_modified_by = request.user + news.last_modified_on = datetime.now() + news.go_online_on = normalForm.cleaned_data['go_online_on'] + news.go_offline_on = normalForm.cleaned_data['go_offline_on'] + news.name = normalForm.cleaned_data['name'] + news.content = editorForm.cleaned_data['content'] + news.save() + messages.success(request, f'News aktualisiert!') + return redirect('/news') + + else: + normalForm = NewsAddNews(instance=news) + editorForm = NewsAddNewsEditor(instance=news) + + + context = { + 'normalForm' : normalForm, + 'editorForm' : editorForm, + 'active_link' : 'newsmanagement', + 'news_id' : news.pk, + } + return render(request, 'news/news_update.html', context) + +class NewsDeleteView(LoginRequiredMixin, DeleteView): + model = News + success_url = '/news' + template_name = 'news/news_confirm_delete.html' + + def get_context_data(self, **kwargs): + context = super(NewsDeleteView, self).get_context_data(**kwargs) + context['active_link'] = 'newsmanagement' + return context + + +@login_required +def NewsSingle(request, pk): + news = News.objects.get(pk=pk) + context = { + 'active_link':'newsmanagement', + 'news' : news + } + return render(request, 'news/news_single.html', context) \ No newline at end of file diff --git a/orga/templates/orga/orga_main.html b/orga/templates/orga/orga_main.html index 97d75f9..6500efe 100644 --- a/orga/templates/orga/orga_main.html +++ b/orga/templates/orga/orga_main.html @@ -16,7 +16,7 @@
{{ leader.first_name }} {{ leader.last_name }}
-   {{ leader.profile.get_func_display }} + {{ leader.profile.get_func_display }} @@ -67,8 +67,6 @@ {% endfor %} - - diff --git a/standards/__pycache__/urls.cpython-38.pyc b/standards/__pycache__/urls.cpython-38.pyc index ad0fdc8..67f12f1 100644 Binary files a/standards/__pycache__/urls.cpython-38.pyc and b/standards/__pycache__/urls.cpython-38.pyc differ diff --git a/standards/migrations/0001_initial.py b/standards/migrations/0001_initial.py index ca2973e..a3bf549 100644 --- a/standards/migrations/0001_initial.py +++ b/standards/migrations/0001_initial.py @@ -1,9 +1,8 @@ -# Generated by Django 2.2.7 on 2019-12-04 16:51 +# Generated by Django 2.2.7 on 2019-12-09 17:02 +import ckeditor_uploader.fields import datetime -from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): @@ -11,10 +10,6 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('users', '0002_auto_20191204_0857'), - ('tasks', '0002_tasks_name'), - ('areas', '0001_initial'), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ @@ -23,13 +18,11 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(default='', max_length=200)), - ('content', models.TextField(blank=True, max_length=3000)), - ('created_area_date', models.DateField(blank=True, default=datetime.date.today)), - ('public', models.BooleanField(default=True)), - ('agency', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='users.Agency')), - ('area', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='areas.Areas')), - ('created_area_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), - ('task', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='tasks.Tasks')), + ('content', ckeditor_uploader.fields.RichTextUploadingField(blank=True, verbose_name='Inhalt')), + ('created_standard_date', models.DateField(blank=True, default=datetime.date.today)), + ('published_on', models.DateField(blank=True, default=datetime.date.today)), + ('last_modified_on', models.DateField(blank=True, default=datetime.date.today)), + ('public', models.BooleanField(default=False)), ], ), ] diff --git a/standards/migrations/0002_auto_20191205_0809.py b/standards/migrations/0002_auto_20191209_1802.py similarity index 53% rename from standards/migrations/0002_auto_20191205_0809.py rename to standards/migrations/0002_auto_20191209_1802.py index f3b2d12..7731721 100644 --- a/standards/migrations/0002_auto_20191205_0809.py +++ b/standards/migrations/0002_auto_20191209_1802.py @@ -1,7 +1,5 @@ -# Generated by Django 3.0 on 2019-12-05 07:09 +# Generated by Django 2.2.7 on 2019-12-09 17:02 -import ckeditor_uploader.fields -import datetime from django.conf import settings from django.db import migrations, models import django.db.models.deletion @@ -9,66 +7,43 @@ import django.db.models.deletion class Migration(migrations.Migration): + initial = True + dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('tasks', '0002_tasks_name'), - ('areas', '0001_initial'), - ('users', '0002_auto_20191204_0857'), ('standards', '0001_initial'), + ('tasks', '0001_initial'), + ('areas', '0002_auto_20191209_1802'), + ('users', '0001_initial'), ] operations = [ - migrations.RenameField( + migrations.AddField( model_name='standards', - old_name='created_area_by', - new_name='created_standard_by', + name='agency', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.Agency'), ), - migrations.RenameField( + migrations.AddField( model_name='standards', - old_name='created_area_date', - new_name='created_standard_date', + name='area', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='areas.Areas'), + ), + migrations.AddField( + model_name='standards', + name='created_standard_by', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), ), migrations.AddField( model_name='standards', name='last_modified_by', field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.PROTECT, related_name='user_modified_standard', to=settings.AUTH_USER_MODEL), ), - migrations.AddField( - model_name='standards', - name='last_modified_on', - field=models.DateField(blank=True, default=datetime.date.today), - ), migrations.AddField( model_name='standards', name='published_by', field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.PROTECT, related_name='user_published_standard', to=settings.AUTH_USER_MODEL), ), migrations.AddField( - model_name='standards', - name='published_on', - field=models.DateField(blank=True, default=datetime.date.today), - ), - migrations.AlterField( - model_name='standards', - name='agency', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.Agency'), - ), - migrations.AlterField( - model_name='standards', - name='area', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='areas.Areas'), - ), - migrations.AlterField( - model_name='standards', - name='content', - field=ckeditor_uploader.fields.RichTextUploadingField(blank=True, verbose_name='Inhalt'), - ), - migrations.AlterField( - model_name='standards', - name='public', - field=models.BooleanField(default=False), - ), - migrations.AlterField( model_name='standards', name='task', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tasks.Tasks'), diff --git a/standards/migrations/__pycache__/0001_initial.cpython-38.pyc b/standards/migrations/__pycache__/0001_initial.cpython-38.pyc index 7411eab..c923d66 100644 Binary files a/standards/migrations/__pycache__/0001_initial.cpython-38.pyc and b/standards/migrations/__pycache__/0001_initial.cpython-38.pyc differ diff --git a/standards/migrations/__pycache__/0002_auto_20191209_1802.cpython-38.pyc b/standards/migrations/__pycache__/0002_auto_20191209_1802.cpython-38.pyc new file mode 100644 index 0000000..d05a16b Binary files /dev/null and b/standards/migrations/__pycache__/0002_auto_20191209_1802.cpython-38.pyc differ diff --git a/standards/templates/standards/standard_area.html b/standards/templates/standards/standard_area.html index d8125b9..bf827fd 100644 --- a/standards/templates/standards/standard_area.html +++ b/standards/templates/standards/standard_area.html @@ -4,47 +4,59 @@

Standards aus dem Bereich {{areaname}}


+ + + + + + + + + + + + {% for item in standards_of_agency_area %} - {% if item.public or item.created_standard_by == user or perms.users.standard_management %} -
-
-
- - {% if item.public %} -

{{item.name}}

- {% else %} -

{{item.name}}

- {% endif %} -
- {% if item.created_standard_by == user or perms.users.standard_management %} - - {% endif %} -
-
-
{{item.created_standard_by.first_name}} {{item.created_standard_by.last_name}}
Zuletzt bearbeitet von {{ item.last_modified_by.first_name }} {{ item.last_modified_by.last_name }} am {{ item.last_modified_on }}
- -

{{ item.content|truncatechars:250|safe}}

-
-
-
- {% endif %} - {% endfor%} + {% if item.public or item.created_standard_by == user or perms.users.standard_management %} + + + + + + + + + + {% endif %} + {% endfor %} +
TitelErstellt vonErstellt amGeändert vonGeändert amÖffentlichkeitsstatus 
{{item.name}}{{item.created_standard_by.first_name}} {{item.created_standard_by.last_name}}{{ item.created_standard_date}}{{ item.last_modified_by.first_name }} {{ item.last_modified_by.last_name }}{{ item.last_modified_on }}{{item.public|yesno:"Öffentlich,Nicht öffentlich"}} + {% if item.created_standard_by == user or perms.users.standard_management %} + + {% endif %} +
{% endblock content %} + + + + + + + + + diff --git a/users/templates/users/dashboard_SAVE_standardcards.html b/standards/templates/standards/standard_area_OLD.html similarity index 60% rename from users/templates/users/dashboard_SAVE_standardcards.html rename to standards/templates/standards/standard_area_OLD.html index ae02b2d..d8125b9 100644 --- a/users/templates/users/dashboard_SAVE_standardcards.html +++ b/standards/templates/standards/standard_area_OLD.html @@ -1,25 +1,25 @@ {% extends "users/base.html" %} {% block content %}
-

Willkommen, {{request.user.first_name}} {{request.user.last_name}}!

- Letzter Login: {{ request.user.last_login }} + +

Standards aus dem Bereich {{areaname}}


-

Agentur: {{ request.user.profile.agency.name }}

-
-
Neueste Standards
-
-
- {% for item in standards_of_agency %} + {% for item in standards_of_agency_area %} {% if item.public or item.created_standard_by == user or perms.users.standard_management %} -
+
{% if item.public %} -
{{item.name}}
+

{{item.name}}

{% else %} -
{{item.name}}
+

{{item.name}}

{% endif %}
{% if item.created_standard_by == user or perms.users.standard_management %} @@ -37,18 +37,14 @@ {% endif %}
-
{{item.created_standard_by.first_name}} {{item.created_standard_by.last_name}} Zuletzt bearbeitet von {{ item.last_modified_by.first_name }} {{ item.last_modified_by.last_name }} am {{ item.last_modified_on }} -
-

{{ item.content|truncatechars:80|safe}}

+
{{item.created_standard_by.first_name}} {{item.created_standard_by.last_name}}
Zuletzt bearbeitet von {{ item.last_modified_by.first_name }} {{ item.last_modified_by.last_name }} am {{ item.last_modified_on }}
+ +

{{ item.content|truncatechars:250|safe}}

{% endif %} {% endfor%} -
-
- -
-{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/standards/templates/standards/standard_task.html b/standards/templates/standards/standard_task.html index 2ea2f08..1baf176 100644 --- a/standards/templates/standards/standard_task.html +++ b/standards/templates/standards/standard_task.html @@ -11,41 +11,56 @@

Standards aus dem Aufgabenbereich {{taskname}} des Bereichs {{areaname}}


+ + + + + + + + + + + + {% for item in standards_of_agency_task %} - {% if item.public or item.created_standard_by == user or perms.users.standard_management %} -
-
-
- - {% if item.public %} -

{{item.name}}

- {% else %} -

{{item.name}}

- {% endif %} -
- {% if item.created_standard_by == user or perms.users.standard_management %} - - {% endif %} -
-
-
{{item.created_standard_by.first_name}} {{item.created_standard_by.last_name}}
Zuletzt bearbeitet von {{ item.last_modified_by.first_name }} {{ item.last_modified_by.last_name }} am {{ item.last_modified_on }}
- -

{{ item.content|truncatechars:250|safe}}

-
-
-
- {% endif %} - {% endfor%} + {% if item.public or item.created_standard_by == user or perms.users.standard_management %} + + + + + + + + + + {% endif %} + {% endfor %} +
TitelErstellt vonErstellt amGeändert vonGeändert amÖffentlichkeitsstatus 
{{item.name}}{{item.created_standard_by.first_name}} {{item.created_standard_by.last_name}}{{ item.created_standard_date}}{{ item.last_modified_by.first_name }} {{ item.last_modified_by.last_name }}{{ item.last_modified_on }}{{item.public|yesno:"Öffentlich,Nicht öffentlich"}} + {% if item.created_standard_by == user or perms.users.standard_management %} + + {% endif %} +
+ + + + + + + + + + + +
{% endblock content %} diff --git a/standards/templates/standards/standard_task_OLD.html b/standards/templates/standards/standard_task_OLD.html new file mode 100644 index 0000000..2ea2f08 --- /dev/null +++ b/standards/templates/standards/standard_task_OLD.html @@ -0,0 +1,51 @@ +{% extends "users/base.html" %} +{% block content %} +
+ +

Standards aus dem Aufgabenbereich {{taskname}} des Bereichs {{areaname}}

+
+
+ {% for item in standards_of_agency_task %} + {% if item.public or item.created_standard_by == user or perms.users.standard_management %} +
+
+
+ + {% if item.public %} +

{{item.name}}

+ {% else %} +

{{item.name}}

+ {% endif %} +
+ {% if item.created_standard_by == user or perms.users.standard_management %} + + {% endif %} +
+
+
{{item.created_standard_by.first_name}} {{item.created_standard_by.last_name}}
Zuletzt bearbeitet von {{ item.last_modified_by.first_name }} {{ item.last_modified_by.last_name }} am {{ item.last_modified_on }}
+ +

{{ item.content|truncatechars:250|safe}}

+
+
+
+ {% endif %} + {% endfor%} +
+
+{% endblock content %} diff --git a/standards/urls.py b/standards/urls.py index 033a13c..19e8171 100644 --- a/standards/urls.py +++ b/standards/urls.py @@ -17,4 +17,4 @@ urlpatterns = [ path('standard//single', views.StandardSingle, name="standard-single"), path('standard//area', views.StandardArea, name="standard-area"), path('standard//task', views.StandardTask, name="standard-task") -] +] \ No newline at end of file diff --git a/tasks/migrations/0001_initial.py b/tasks/migrations/0001_initial.py index 54035c3..e5386c0 100644 --- a/tasks/migrations/0001_initial.py +++ b/tasks/migrations/0001_initial.py @@ -1,9 +1,7 @@ -# Generated by Django 3.0 on 2019-12-04 07:57 +# Generated by Django 2.2.7 on 2019-12-09 17:02 import datetime -from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): @@ -11,9 +9,6 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('areas', '0001_initial'), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('users', '0002_auto_20191204_0857'), ] operations = [ @@ -21,13 +16,10 @@ class Migration(migrations.Migration): name='Tasks', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(default='', max_length=200)), ('desc', models.TextField(blank=True, max_length=3000)), ('created_area_date', models.DateField(blank=True, default=datetime.date.today)), ('visible', models.BooleanField(default=True)), - ('agency', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='users.Agency')), - ('area', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='areas.Areas')), - ('created_area_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), - ('usersfield', models.ManyToManyField(blank=True, related_name='users_in_task', to=settings.AUTH_USER_MODEL)), ], ), ] diff --git a/tasks/migrations/0002_auto_20191209_1802.py b/tasks/migrations/0002_auto_20191209_1802.py new file mode 100644 index 0000000..23caba7 --- /dev/null +++ b/tasks/migrations/0002_auto_20191209_1802.py @@ -0,0 +1,40 @@ +# Generated by Django 2.2.7 on 2019-12-09 17:02 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('tasks', '0001_initial'), + ('users', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('areas', '0002_auto_20191209_1802'), + ] + + operations = [ + migrations.AddField( + model_name='tasks', + name='agency', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.Agency'), + ), + migrations.AddField( + model_name='tasks', + name='area', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='areas.Areas'), + ), + migrations.AddField( + model_name='tasks', + name='created_area_by', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='tasks', + name='usersfield', + field=models.ManyToManyField(blank=True, related_name='users_in_task', to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/tasks/migrations/0002_tasks_name.py b/tasks/migrations/0002_tasks_name.py deleted file mode 100644 index 3e105e9..0000000 --- a/tasks/migrations/0002_tasks_name.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0 on 2019-12-04 08:10 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('tasks', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='tasks', - name='name', - field=models.CharField(default='', max_length=200), - ), - ] diff --git a/tasks/migrations/0003_auto_20191205_0809.py b/tasks/migrations/0003_auto_20191205_0809.py deleted file mode 100644 index ee3cc1d..0000000 --- a/tasks/migrations/0003_auto_20191205_0809.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 3.0 on 2019-12-05 07:09 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('areas', '0001_initial'), - ('users', '0002_auto_20191204_0857'), - ('tasks', '0002_tasks_name'), - ] - - operations = [ - migrations.AlterField( - model_name='tasks', - name='agency', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.Agency'), - ), - migrations.AlterField( - model_name='tasks', - name='area', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='areas.Areas'), - ), - ] diff --git a/tasks/migrations/__pycache__/0001_initial.cpython-38.pyc b/tasks/migrations/__pycache__/0001_initial.cpython-38.pyc index decdf9d..dd3c6d4 100644 Binary files a/tasks/migrations/__pycache__/0001_initial.cpython-38.pyc and b/tasks/migrations/__pycache__/0001_initial.cpython-38.pyc differ diff --git a/tasks/migrations/__pycache__/0002_auto_20191209_1802.cpython-38.pyc b/tasks/migrations/__pycache__/0002_auto_20191209_1802.cpython-38.pyc new file mode 100644 index 0000000..bb1c7b8 Binary files /dev/null and b/tasks/migrations/__pycache__/0002_auto_20191209_1802.cpython-38.pyc differ diff --git a/users/__pycache__/models.cpython-38.pyc b/users/__pycache__/models.cpython-38.pyc index 4d0e60d..0ec8d15 100644 Binary files a/users/__pycache__/models.cpython-38.pyc and b/users/__pycache__/models.cpython-38.pyc differ diff --git a/users/__pycache__/views.cpython-38.pyc b/users/__pycache__/views.cpython-38.pyc index 5ecbd0c..1054c30 100644 Binary files a/users/__pycache__/views.cpython-38.pyc and b/users/__pycache__/views.cpython-38.pyc differ diff --git a/users/migrations/0001_initial.py b/users/migrations/0001_initial.py index 9e01bff..fe376f9 100644 --- a/users/migrations/0001_initial.py +++ b/users/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.0 on 2019-12-03 22:58 +# Generated by Django 2.2.7 on 2019-12-09 17:02 from django.conf import settings from django.db import migrations, models @@ -10,6 +10,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ + ('tasks', '0001_initial'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] @@ -40,7 +41,16 @@ class Migration(migrations.Migration): ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], options={ - 'permissions': [('agency_change', 'Agenturinformationen verändern'), ('users_usermanagement', 'Benutzer bearbeiten'), ('tasks_management', 'Aufgabenbereiche bearbeiten'), ('areas_management', 'Bereiche bearbeiten')], + 'permissions': [('agency_change', 'Agenturinformationen verändern'), ('users_usermanagement', 'Benutzer bearbeiten'), ('areas_management', 'Bereiche bearbeiten'), ('tasks_management', 'Aufgabenbereiche bearbeiten'), ('standard_management', 'Standards bearbeiten und freischalten'), ('news_management', 'News bearbeiten und veröffentlichen')], }, ), + migrations.CreateModel( + name='Prio', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('prio', models.IntegerField(default=0)), + ('task', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tasks.Tasks')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), ] diff --git a/users/migrations/0002_auto_20191204_0857.py b/users/migrations/0002_auto_20191204_0857.py deleted file mode 100644 index a4f5c8b..0000000 --- a/users/migrations/0002_auto_20191204_0857.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 3.0 on 2019-12-04 07:57 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('users', '0001_initial'), - ] - - operations = [ - migrations.AlterModelOptions( - name='profile', - options={'permissions': [('agency_change', 'Agenturinformationen verändern'), ('users_usermanagement', 'Benutzer bearbeiten'), ('areas_management', 'Bereiche bearbeiten'), ('tasks_management', 'Aufgabenbereiche bearbeiten'), ('standard_management', 'Standards bearbeiten und freischalten')]}, - ), - ] diff --git a/users/migrations/0003_prio.py b/users/migrations/0003_prio.py deleted file mode 100644 index d26f133..0000000 --- a/users/migrations/0003_prio.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 2.2.7 on 2019-12-05 17:41 - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('tasks', '0003_auto_20191205_0809'), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('users', '0002_auto_20191204_0857'), - ] - - operations = [ - migrations.CreateModel( - name='Prio', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('prio', models.IntegerField(default=0)), - ('task', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tasks.Tasks')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - ] diff --git a/users/migrations/__pycache__/0001_initial.cpython-38.pyc b/users/migrations/__pycache__/0001_initial.cpython-38.pyc index ae1f439..833bdc6 100644 Binary files a/users/migrations/__pycache__/0001_initial.cpython-38.pyc and b/users/migrations/__pycache__/0001_initial.cpython-38.pyc differ diff --git a/users/migrations/__pycache__/0004_auto_20191209_1753.cpython-38.pyc b/users/migrations/__pycache__/0004_auto_20191209_1753.cpython-38.pyc new file mode 100644 index 0000000..5deef91 Binary files /dev/null and b/users/migrations/__pycache__/0004_auto_20191209_1753.cpython-38.pyc differ diff --git a/users/models.py b/users/models.py index 0c67b3b..e90880a 100644 --- a/users/models.py +++ b/users/models.py @@ -73,7 +73,7 @@ class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) phoneland = models.CharField(max_length=60, blank=True) phonemobile = models.CharField(max_length=60, blank=True) - func = models.CharField(choices=agency_task, default="external", max_length=50) + func = models.CharField(choices=agency_task, default="lead", max_length=50) # Wenn dieses Profil gelöscht wird, wird NICHT die Agency geslöscht agency = models.ForeignKey(Agency, on_delete=models.PROTECT) image = models.ImageField(default='default.jpg', upload_to='userprofilepics', blank=True) @@ -112,7 +112,8 @@ class Profile(models.Model): ('users_usermanagement', 'Benutzer bearbeiten'), ('areas_management', 'Bereiche bearbeiten'), ('tasks_management', 'Aufgabenbereiche bearbeiten'), - ('standard_management', 'Standards bearbeiten und freischalten') + ('standard_management', 'Standards bearbeiten und freischalten'), + ('news_management', 'News bearbeiten und veröffentlichen') ] diff --git a/users/templates/users/base.html b/users/templates/users/base.html index f174865..2f31d0e 100644 --- a/users/templates/users/base.html +++ b/users/templates/users/base.html @@ -100,7 +100,7 @@ - {% if perms.users.users_usermanagement or perms.users.areas_management or perms.users.tasks_management %} + {% if perms.users.users_usermanagement or perms.users.areas_management or perms.users.tasks_management or perms.user.news_management %}