diff --git a/news/__pycache__/views.cpython-38.pyc b/news/__pycache__/views.cpython-38.pyc index 0b197b2..ef35905 100644 Binary files a/news/__pycache__/views.cpython-38.pyc and b/news/__pycache__/views.cpython-38.pyc differ diff --git a/news/views.py b/news/views.py index 765e5b9..1bbb7f6 100644 --- a/news/views.py +++ b/news/views.py @@ -21,7 +21,7 @@ class NewsManagement(LoginRequiredMixin, ListView): news = News.objects.filter(agency__pk=self.request.user.profile.agency.pk).filter(go_online_on__lt=filterdate).filter(go_offline_on__gt=filterdate).order_by('-created_date') news_arch = News.objects.filter(agency__pk=self.request.user.profile.agency.pk).filter(go_offline_on__lt=filterdate).order_by('-created_date') - news_coming = News.objects.filter(agency__pk=self.request.user.profile.agency.pk).filter(go_offline_on__gt=filterdate).order_by('-created_date') + news_coming = News.objects.filter(agency__pk=self.request.user.profile.agency.pk).filter(go_online_on__gt=filterdate).order_by('-created_date') context = super().get_context_data(**kwargs) context.update({'active_link' : 'dashboard', 'news' : news, 'news_arch' : news_arch, 'news_coming' : news_coming}) diff --git a/standards/__pycache__/models.cpython-38.pyc b/standards/__pycache__/models.cpython-38.pyc index 475fd1c..df81997 100644 Binary files a/standards/__pycache__/models.cpython-38.pyc and b/standards/__pycache__/models.cpython-38.pyc differ diff --git a/standards/__pycache__/views.cpython-38.pyc b/standards/__pycache__/views.cpython-38.pyc index 4427a52..79cbb5f 100644 Binary files a/standards/__pycache__/views.cpython-38.pyc and b/standards/__pycache__/views.cpython-38.pyc differ diff --git a/standards/models.py b/standards/models.py index 5fff059..c44af06 100644 --- a/standards/models.py +++ b/standards/models.py @@ -32,11 +32,15 @@ class Standards(models.Model): # USER # VERTRETER - representative = models.ForeignKey(User, on_delete=models.PROTECT, related_name="user_repr", blank=True, null=True) + #representative = models.ForeignKey(User, on_delete=models.PROTECT, related_name="user_repr", blank=True, null=True) + representative = models.ManyToManyField(User, blank=True, related_name='user_rep') # AUSFÜHRENDER - executor = models.ForeignKey(User, on_delete=models.PROTECT, related_name="user_executor", blank=True, null=True) + #executor = models.ForeignKey(User, on_delete=models.PROTECT, related_name="user_executor", blank=True, null=True) + executor = models.ManyToManyField(User, blank=True, related_name='user_ex') # VERANTWORTLICHER - authority = models.ForeignKey(User, on_delete=models.PROTECT, related_name="user_authority", blank=True, null=True) + #authority = models.ForeignKey(User, on_delete=models.PROTECT, related_name="user_authority", blank=True, null=True) + authority = models.ManyToManyField(User, blank=True, related_name='user_aut') + # FILES addedfiles = models.ManyToManyField(DataFile, blank=True) # VERLINKTE STANDARDS @@ -44,6 +48,9 @@ class Standards(models.Model): # GORUPS visibleby = models.ManyToManyField(AgencyGroup, blank=True) + indi_name = models.CharField(max_length=200, blank=False, default="") + indi_conmtent = models.CharField(max_length=500, blank=False, default="") + def __str__(self): return f'{self.name}' diff --git a/standards/templates/standards/standards_add.html b/standards/templates/standards/standards_add.html index 0ef03e1..49f1fcc 100644 --- a/standards/templates/standards/standards_add.html +++ b/standards/templates/standards/standards_add.html @@ -11,9 +11,9 @@ {% for field in normalForm %} {% if forloop.counter|divisibleby:6 %}
- {{field|as_crispy_field }} + {{field|as_crispy_field }} {% else %} - {{field|as_crispy_field }} + {{field|as_crispy_field }} {% endif %} {% endfor %} @@ -105,6 +105,23 @@
+ diff --git a/standards/templates/standards/standards_single.html b/standards/templates/standards/standards_single.html index 93caced..d3f5ae6 100644 --- a/standards/templates/standards/standards_single.html +++ b/standards/templates/standards/standards_single.html @@ -17,18 +17,30 @@  | Bearbeiten {% endif%} -
- - {% if standard.authority %} - Verantwortlicher:   {{standard.authority.first_name}} {{standard.authority.last_name}} |  +
+ + {% if standard.authority.count > 0 %} + Verantwortliche:  + {% for u in standard.authority.all %} + {{u.first_name}} {{u.last_name}} |  + {% endfor %} +
{% endif %} - {% if standard.executor %} - Ausführende Person: {{standard.executor.first_name}} {{standard.executor.last_name}} |  + {% if standard.executor.count > 0 %} + Ausführende Personen:  + {% for u in standard.executor.all %} + {{u.first_name}} {{u.last_name}} |  + {% endfor %} +
{% endif %} - {% if standard.representative %} - Vertreter: {{standard.representative.first_name}} {{standard.representative.last_name}} |  + {% if standard.representative.count > 0 %} + Vertreter:  + {% for u in standard.representative.all %} + {{u.first_name}} {{u.last_name}} |  + {% endfor %} +
{% endif %} diff --git a/standards/views.py b/standards/views.py index dd21acc..dbfee48 100644 --- a/standards/views.py +++ b/standards/views.py @@ -107,13 +107,15 @@ def StandardAdd(request): new_standard.content = editorForm.cleaned_data['content'] new_standard.public = normalForm.cleaned_data['public'] - new_standard.representative = normalForm.cleaned_data['representative'] - new_standard.executor = normalForm.cleaned_data['executor'] - new_standard.authority = normalForm.cleaned_data['authority'] - # GROUPS new_standard.save() + new_standard.representative.set(normalForm.cleaned_data['representative']) + new_standard.executor.set(normalForm.cleaned_data['executor']) + new_standard.authority.set(normalForm.cleaned_data['authority']) + + + # ADD GROUPS groups = normalForm.cleaned_data['checked_groups'].split(",") @@ -192,9 +194,9 @@ def StandardUpdate(request, id): existing_standard.name = normalForm.cleaned_data['name'] existing_standard.content = editorForm.cleaned_data['content'] - existing_standard.representative = normalForm.cleaned_data['representative'] - existing_standard.executor = normalForm.cleaned_data['executor'] - existing_standard.authority = normalForm.cleaned_data['authority'] + existing_standard.representative.set(normalForm.cleaned_data['representative']) + existing_standard.executor.set(normalForm.cleaned_data['executor']) + existing_standard.authority.set(normalForm.cleaned_data['authority']) '''