Standard fertig AUSSER sonderfeld, rest läuft. Darstellung müssen wir echt nochmal besprechen

This commit is contained in:
holger.trampe 2020-03-14 00:48:15 +01:00
parent f61a58dc8a
commit 25fc0c6cad
8 changed files with 59 additions and 21 deletions

View File

@ -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})

View File

@ -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}'

View File

@ -11,9 +11,9 @@
{% for field in normalForm %}
{% if forloop.counter|divisibleby:6 %}
</div><div class="col-3">
{{field|as_crispy_field }}
{{field|as_crispy_field }}
{% else %}
{{field|as_crispy_field }}
{{field|as_crispy_field }}
{% endif %}
{% endfor %}
@ -105,6 +105,23 @@
</div>
</div>
</div>
<!--
<div class="card">
<div class="card-header" id="st_indi">
<h5 class="mb-0">
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#stindi_content" aria-expanded="false" aria-controls="stindi_content">
Freies Feld&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Bearbeiten Sie hier ein individuelles Text- und Inhaltsfeld." class="far fa-question-circle"></i></small>
</button>
</h5>
</div>
<div id="stindi_content" class="collapse" aria-labelledby="st_groups" data-parent="#additionalStandardInfos">
<div class="card-body">
dd
</div>
</div>
</div>
-->
</div>
</div></div>

View File

@ -17,18 +17,30 @@
&nbsp;|&nbsp;<a href="{% url 'standard-update' standard.pk %}">Bearbeiten</a>
{% endif%}
</small>
<small><br />
{% if standard.authority %}
Verantwortlicher:&nbsp;&nbsp;<span class="badge badge-pill badge-primary" style="font-size: 1.1em; background-color: {{standard.task.area.color}}"><a href="{% url 'orga-single' standard.authority.pk%}" style="color: #ffffff"> {{standard.authority.first_name}} {{standard.authority.last_name}}</a></span>&nbsp;|&nbsp;
<small> <br />
{% if standard.authority.count > 0 %}
Verantwortliche:&nbsp;
{% for u in standard.authority.all %}
<a href="{% url 'orga-single' u.pk%}"> {{u.first_name}} {{u.last_name}}</a>&nbsp;|&nbsp;
{% endfor %}
<br />
{% endif %}
{% if standard.executor %}
Ausführende Person:&nbsp;<span class="badge badge-pill badge-primary" style="font-size: 1.1em; background-color: {{standard.task.area.color}}"><a href="{% url 'orga-single' standard.executor.pk%}" style="color: #ffffff">{{standard.executor.first_name}} {{standard.executor.last_name}}</a></span>&nbsp;|&nbsp;
{% if standard.executor.count > 0 %}
Ausführende Personen:&nbsp;
{% for u in standard.executor.all %}
<a href="{% url 'orga-single' u.pk%}"> {{u.first_name}} {{u.last_name}}</a>&nbsp;|&nbsp;
{% endfor %}
<br />
{% endif %}
{% if standard.representative %}
Vertreter:&nbsp;<span class="badge badge-pill badge-primary" style="font-size: 1.1em; background-color: {{standard.task.area.color}}"><a href="{% url 'orga-single' standard.representative.pk%}" style="color: #ffffff">{{standard.representative.first_name}} {{standard.representative.last_name}}</a></span>&nbsp;|&nbsp;
{% if standard.representative.count > 0 %}
Vertreter:&nbsp;
{% for u in standard.representative.all %}
<a href="{% url 'orga-single' u.pk%}"> {{u.first_name}} {{u.last_name}}</a>&nbsp;|&nbsp;
{% endfor %}
<br />
{% endif %}

View File

@ -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'])
'''