- Standards-Single view fertig
- Update-Logik der Standards implementiert
This commit is contained in:
parent
d53020c056
commit
7b35a8b4b4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -82,7 +82,7 @@ WSGI_APPLICATION = 'digitaleagentur.wsgi.application'
|
|||
CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'
|
||||
|
||||
CKEDITOR_UPLOAD_PATH = "uploadsCK/" # <-- this folder you uploaded image saved in s3 under media folder
|
||||
CKEDITOR_RESTRICT_BY_USER = True
|
||||
CKEDITOR_RESTRICT_BY_USER = False
|
||||
CKEDITOR_REQUIRE_STAFF=False
|
||||
AWS_QUERYSTRING_AUTH = True
|
||||
CKEDITOR_IMAGE_BACKEND = "pillow"
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 885 B |
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 885 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,5 +1,6 @@
|
|||
# Generated by Django 2.2.7 on 2019-12-04 17:08
|
||||
# Generated by Django 3.0 on 2019-12-05 07:09
|
||||
|
||||
import ckeditor_uploader.fields
|
||||
import datetime
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
|
@ -10,6 +11,9 @@ class Migration(migrations.Migration):
|
|||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('tasks', '0002_tasks_name'),
|
||||
('areas', '0001_initial'),
|
||||
('users', '0002_auto_20191204_0857'),
|
||||
('standards', '0001_initial'),
|
||||
]
|
||||
|
||||
|
|
@ -26,12 +30,12 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
migrations.AddField(
|
||||
model_name='standards',
|
||||
name='last_modifed_by',
|
||||
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_modifed_on',
|
||||
name='last_modified_on',
|
||||
field=models.DateField(blank=True, default=datetime.date.today),
|
||||
),
|
||||
migrations.AddField(
|
||||
|
|
@ -44,9 +48,29 @@ class Migration(migrations.Migration):
|
|||
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'),
|
||||
),
|
||||
]
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# Generated by Django 2.2.7 on 2019-12-04 17:13
|
||||
|
||||
from django.db import migrations
|
||||
import tinymce.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('standards', '0002_auto_20191204_1808'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='standards',
|
||||
name='content',
|
||||
field=tinymce.models.HTMLField(),
|
||||
),
|
||||
]
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# Generated by Django 2.2.7 on 2019-12-04 17:31
|
||||
|
||||
import ckeditor.fields
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('standards', '0003_auto_20191204_1813'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='standards',
|
||||
name='content',
|
||||
field=ckeditor.fields.RichTextField(blank=True, null=True),
|
||||
),
|
||||
]
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# Generated by Django 2.2.7 on 2019-12-04 18:24
|
||||
|
||||
import ckeditor_uploader.fields
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('standards', '0004_auto_20191204_1831'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='standards',
|
||||
name='content',
|
||||
field=ckeditor_uploader.fields.RichTextUploadingField(blank=True),
|
||||
),
|
||||
]
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
# Generated by Django 2.2.7 on 2019-12-04 19:03
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('standards', '0005_auto_20191204_1924'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='standards',
|
||||
old_name='last_modifed_by',
|
||||
new_name='last_modified_by',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='standards',
|
||||
old_name='last_modifed_on',
|
||||
new_name='last_modified_on',
|
||||
),
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,5 +1,4 @@
|
|||
from django.db import models
|
||||
from tinymce.models import HTMLField
|
||||
from django.contrib.auth.models import User
|
||||
from users.models import Agency
|
||||
from django.urls import reverse
|
||||
|
|
|
|||
|
|
@ -13,12 +13,11 @@
|
|||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
{% for item in standards_of_agency %}
|
||||
|
||||
{% for item in standards_of_agency %}
|
||||
<div class=" mb-2 mr-2 col-5">
|
||||
<div class="card">
|
||||
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
|
||||
{{item.name}}
|
||||
<a href="{% url 'standard-single' item.pk%}"><h4><u>{{item.name}}</u></h4></a>
|
||||
{% if item.created_standard_by == user or perms.users.standard_management %}
|
||||
<div class="dropdown no-arrow">
|
||||
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
|
|
@ -30,8 +29,7 @@
|
|||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="{% url 'standard-delete' item.pk %}" >Löschen</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% block content %}
|
||||
<div class="content-section col-12">
|
||||
{{standard.media}}
|
||||
{{standard.content|safe}}
|
||||
</div>
|
||||
|
||||
{% endblock content %}
|
||||
|
|
@ -11,7 +11,15 @@
|
|||
{{editorForm}}
|
||||
<p>Wenn ein Standard bearbeitet wurde, kann er nur von einer Person mit dem Recht <i>Standards bearbeiten und freischalten</i> wieder veröffentlicht werden. Ein Standard wird nach Bearbeitung als <i>Nicht veröffentlicht</i> gesetzt.</p>
|
||||
<hr>
|
||||
<button type="submit" class="btn btn-success" href="{% url 'standard-update' 1 %} ">Aktualisieren</button>
|
||||
<button type="submit" class="btn btn-success" href="{% url 'standard-update' standard_id %} ">Aktualisieren</button>
|
||||
|
||||
{% if perms.users.standard_management %}
|
||||
{% if standard_status == False %}
|
||||
<a class="btn btn-primary" href="{% url 'standard-status' standard_id %} ">Standard veröffentlichen</a>
|
||||
{% else %}
|
||||
<a class="btn btn-warning" href="{% url 'standard-status' standard_id %} ">Standard unveröffentlichen</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<a class="btn" href="{% url 'standards' %} ">Abbrechen</a>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
from django.urls import path
|
||||
from django.contrib.auth import views as auth_views
|
||||
from django.contrib.auth.decorators import login_required, permission_required
|
||||
#from .views import StandardsManagement, StandardAdd
|
||||
from .views import StandardsManagement, StandardDeleteView
|
||||
from . import views
|
||||
'''
|
||||
|
|
@ -13,5 +12,7 @@ urlpatterns = [
|
|||
path('standardadd/', views.StandardAdd, name='standard-add'),
|
||||
path('standardupdate/<int:id>', views.StandardUpdate, name='standard-update'),
|
||||
path('ajax/loadtasks/', views.load_tasks, name='ajax_loadtasks'),
|
||||
path('standards/<int:pk>/delete', StandardDeleteView.as_view(), name='standard-delete'),
|
||||
path('standards/<int:pk>/delete', StandardDeleteView.as_view(), name='standard-delete'),
|
||||
path('standard/<int:pk>/changestat', views.StandardChangePublic, name="standard-status"),
|
||||
path('standard/<int:pk>/single', views.StandardSingle, name="standard-single")
|
||||
]
|
||||
|
|
|
|||
|
|
@ -104,9 +104,15 @@ def StandardUpdate(request, id):
|
|||
existing_standard.area = normalForm.cleaned_data['area']
|
||||
existing_standard.name = normalForm.cleaned_data['name']
|
||||
existing_standard.content = editorForm.cleaned_data['content']
|
||||
existing_standard.public = False
|
||||
if request.user.has_perm('standard_management'):
|
||||
messages.success(request, f'Standard {existing_standard.name} aktualisiert!')
|
||||
else:
|
||||
if existing_standard.public:
|
||||
existing_standard.public = False
|
||||
messages.warning(request, f'Standard {existing_standard.name} aktualisiert und ist nicht mehr öffentlich, damit Änderungen geprüft werden können.')
|
||||
else:
|
||||
messages.success(request, f'Standard {existing_standard.name} aktualisiert!')
|
||||
existing_standard.save()
|
||||
messages.success(request, f'Standard {existing_standard.name} aktualisiert!')
|
||||
return redirect('/standards')
|
||||
|
||||
else:
|
||||
|
|
@ -117,10 +123,13 @@ def StandardUpdate(request, id):
|
|||
context = {
|
||||
'normalForm' : normalForm,
|
||||
'editorForm' : editorForm,
|
||||
'active_link' : 'standards'
|
||||
'active_link' : 'standards',
|
||||
'standard_id' : standard.pk,
|
||||
'standard_status' : standard.public
|
||||
}
|
||||
return render(request, 'standards/standards_update.html', context)
|
||||
|
||||
@login_required
|
||||
def load_tasks(request):
|
||||
areaid = request.GET.get('areaid')
|
||||
tasks = Tasks.objects.filter(area__id=areaid).order_by('name')
|
||||
|
|
@ -135,4 +144,25 @@ class StandardDeleteView(LoginRequiredMixin, DeleteView):
|
|||
def get_context_data(self, **kwargs):
|
||||
context = super(StandardDeleteView, self).get_context_data(**kwargs)
|
||||
context['active_link'] = 'standards'
|
||||
return context
|
||||
return context
|
||||
|
||||
@login_required
|
||||
def StandardChangePublic(request, pk):
|
||||
standard = Standards.objects.get(pk=pk)
|
||||
if standard.public:
|
||||
standard.public = False
|
||||
messages.warning(request, f'Standard {standard.name} ist nicht mehr öffentlich!')
|
||||
else:
|
||||
standard.public = True
|
||||
messages.success(request, f'Standard {standard.name} wurde veröffentlicht und ist innerhalb der Agentur sichtbar!')
|
||||
standard.save()
|
||||
return redirect('standards')
|
||||
|
||||
@login_required
|
||||
def StandardSingle(request, pk):
|
||||
standard = Standards.objects.get(pk=pk)
|
||||
context = {
|
||||
'active_link':'standards',
|
||||
'standard' : standard
|
||||
}
|
||||
return render(request, 'standards/standards_single.html', context)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,26 @@
|
|||
# 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'),
|
||||
),
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -220,10 +220,12 @@
|
|||
</button>
|
||||
</div>
|
||||
<script>
|
||||
//Ausfaden der Meldungen erstmal rausgenommen
|
||||
/*
|
||||
setTimeout(function() {
|
||||
$('#message_{{forloop.counter}}').fadeOut();
|
||||
}, 3000 );
|
||||
|
||||
*/
|
||||
</script>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
|
|
|||
Loading…
Reference in New Issue