Neuer Editor
Und Suche sollte nun laufen - das war eine alte File?!?!?
This commit is contained in:
parent
d1f4b868c6
commit
89fa8910de
Binary file not shown.
|
|
@ -42,7 +42,7 @@ urlpatterns = [
|
|||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
urlpatterns += [
|
||||
path('ckeditor/upload/', login_required(upload), name='ckeditor_upload'),
|
||||
path('ckeditor/', include('ckeditor_uploader.urls')),
|
||||
]
|
||||
#urlpatterns += [
|
||||
# path('ckeditor/upload/', login_required(upload), name='ckeditor_upload'),
|
||||
# path('ckeditor/', include('ckeditor_uploader.urls')),
|
||||
#]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -2,7 +2,7 @@ from bootstrap_datepicker_plus import DatePickerInput
|
|||
from django import forms
|
||||
from django.forms import ModelForm
|
||||
from .models import News
|
||||
from ckeditor.widgets import CKEditorWidget
|
||||
#from ckeditor.widgets import CKEditorWidget
|
||||
|
||||
|
||||
class NewsAddNews(forms.ModelForm):
|
||||
|
|
@ -13,14 +13,15 @@ class NewsAddNews(forms.ModelForm):
|
|||
labels = {
|
||||
"name" : "Titel",
|
||||
"go_online_on" : "Veröffentlichen",
|
||||
"go_offline_on" : "Ins Archiv"
|
||||
"go_offline_on" : "Ins Archiv",
|
||||
"content" : "Inhalt"
|
||||
}
|
||||
fields = ['name', 'go_online_on', 'go_offline_on']
|
||||
fields = ['name', 'go_online_on', 'go_offline_on', 'content']
|
||||
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:
|
||||
|
|
@ -29,7 +30,4 @@ class NewsAddNewsEditor(forms.ModelForm):
|
|||
"content" : "Inhalt"
|
||||
}
|
||||
fields = ['content']
|
||||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
|
|
@ -3,14 +3,15 @@ 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 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')
|
||||
#content = RichTextUploadingField(blank=True, verbose_name='Inhalt')
|
||||
content = models.TextField(blank=True, verbose_name='Inhalt')
|
||||
|
||||
created_by = models.ForeignKey(User, on_delete=models.PROTECT)
|
||||
created_date = models.DateTimeField(default=datetime.datetime.now(), blank=True)
|
||||
|
|
|
|||
|
|
@ -7,12 +7,17 @@
|
|||
<form method="POST">
|
||||
{% csrf_token %}
|
||||
{{normalForm.media}}
|
||||
{{normalForm|crispy}}
|
||||
{{editorForm.media}}
|
||||
{{editorForm}}
|
||||
{{normalForm|crispy}}
|
||||
<hr>
|
||||
<button type="submit" class="btn btn-success" href="{% url 'news-add' %} ">News speichern</button>
|
||||
<a class="btn" href="{% url 'news-management' %} ">Abbrechen</a>
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#id_content').summernote({
|
||||
height: 400
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock content %}
|
||||
|
|
@ -7,12 +7,17 @@
|
|||
<form method="POST" id="taskareaform">
|
||||
{% csrf_token %}
|
||||
{{normalForm.media}}
|
||||
{{normalForm|crispy}}
|
||||
{{editorForm.media}}
|
||||
{{editorForm}}
|
||||
{{normalForm|crispy}}
|
||||
<hr>
|
||||
<button type="submit" class="btn btn-success" href="{% url 'news-update' news_id %} ">Aktualisieren</button>
|
||||
<a class="btn" href="{% url 'news-management' %} ">Abbrechen</a>
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#id_content').summernote({
|
||||
height: 400
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock content %}
|
||||
|
|
@ -3,7 +3,7 @@ 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 .forms import NewsAddNews
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from datetime import datetime
|
||||
from django.contrib import messages
|
||||
|
|
@ -31,14 +31,15 @@ class NewsAddNews(LoginRequiredMixin, CreateView):
|
|||
def NewsAdd(request):
|
||||
if request.method == 'POST':
|
||||
normalForm = NewsAddNews(request.POST, instance=request.user)
|
||||
editorForm = NewsAddNewsEditor(request.POST, instance=request.user)
|
||||
#editorForm = NewsAddNewsEditor(request.POST, instance=request.user)
|
||||
|
||||
if editorForm.is_valid() and normalForm.is_valid():
|
||||
#if editorForm.is_valid() and normalForm.is_valid():
|
||||
if normalForm.is_valid():
|
||||
normalForm.agency = request.user.profile.agency
|
||||
normalForm.created_by = request.user
|
||||
normalForm.last_modified_by = request.user
|
||||
normalForm.save()
|
||||
editorForm.save()
|
||||
#editorForm.save()
|
||||
new_news = News()
|
||||
new_news.agency = request.user.profile.agency
|
||||
new_news.created_by = request.user
|
||||
|
|
@ -48,7 +49,7 @@ def NewsAdd(request):
|
|||
new_news.last_modified_on = datetime.now()
|
||||
|
||||
new_news.name = normalForm.cleaned_data['name']
|
||||
new_news.content = editorForm.cleaned_data['content']
|
||||
new_news.content = normalForm.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']
|
||||
|
||||
|
|
@ -58,12 +59,12 @@ def NewsAdd(request):
|
|||
|
||||
else:
|
||||
normalForm = NewsAddNews(instance=request.user)
|
||||
editorForm = NewsAddNewsEditor(instance=request.user)
|
||||
#editorForm = NewsAddNewsEditor(instance=request.user)
|
||||
|
||||
|
||||
context = {
|
||||
'normalForm' : normalForm,
|
||||
'editorForm' : editorForm,
|
||||
#'editorForm' : editorForm,
|
||||
'active_link' : 'newsmanagement'
|
||||
}
|
||||
return render(request, 'news/news_addnews.html', context)
|
||||
|
|
@ -73,28 +74,28 @@ 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)
|
||||
#editorForm = NewsAddNewsEditor(request.POST, instance=news)
|
||||
|
||||
if editorForm.is_valid() and normalForm.is_valid():
|
||||
if 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.content = normalForm.cleaned_data['content']
|
||||
news.save()
|
||||
messages.success(request, f'News aktualisiert!')
|
||||
return redirect('/news')
|
||||
|
||||
else:
|
||||
normalForm = NewsAddNews(instance=news)
|
||||
editorForm = NewsAddNewsEditor(instance=news)
|
||||
#editorForm = NewsAddNewsEditor(instance=news)
|
||||
|
||||
|
||||
context = {
|
||||
'normalForm' : normalForm,
|
||||
'editorForm' : editorForm,
|
||||
#'editorForm' : editorForm,
|
||||
'active_link' : 'newsmanagement',
|
||||
'news_id' : news.pk,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,9 +77,6 @@ function connectorDefaults(connector) {
|
|||
connector.targetDecorator.shape = 'None';
|
||||
connector.type = 'Orthogonal';
|
||||
connector.style.strokeColor = 'gray';
|
||||
|
||||
console.log(connector);
|
||||
|
||||
return connector;
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -13,8 +13,9 @@ class StandardAddStandard(forms.ModelForm):
|
|||
"name" : "Titel",
|
||||
"area" : "Übergeordneter Bereich",
|
||||
"task" : "Aufgabenbereich",
|
||||
"content": "Inhalt"
|
||||
}
|
||||
fields = ['name', 'area', 'task']
|
||||
fields = ['name', 'area', 'task', 'content']
|
||||
'''
|
||||
|
||||
Hier werden die Elemente für die DropDowns erstellt, damit
|
||||
|
|
@ -59,8 +60,9 @@ class StandardUpdateStandard(forms.ModelForm):
|
|||
"name" : "Titel",
|
||||
"area" : "Übergeordneter Bereich",
|
||||
"task" : "Aufgabenbereich",
|
||||
"content": "Inhalt"
|
||||
}
|
||||
fields = ['name', 'area', 'task']
|
||||
fields = ['name', 'area', 'task', 'content']
|
||||
'''
|
||||
|
||||
Hier werden die Elemente für die DropDowns erstellt, damit
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from areas.models import Areas
|
|||
from tasks.models import Tasks
|
||||
import datetime
|
||||
from django.utils import timezone
|
||||
from ckeditor_uploader.fields import RichTextUploadingField
|
||||
#from ckeditor_uploader.fields import RichTextUploadingField
|
||||
|
||||
class Standards(models.Model):
|
||||
|
||||
|
|
@ -14,7 +14,8 @@ class Standards(models.Model):
|
|||
area = models.ForeignKey(Areas, on_delete=models.CASCADE)
|
||||
task = models.ForeignKey(Tasks, on_delete=models.CASCADE)
|
||||
name = models.CharField(max_length=200, blank=False, default="")
|
||||
content = RichTextUploadingField(blank=True, verbose_name='Inhalt')
|
||||
#content = RichTextUploadingField(blank=True, verbose_name='Inhalt')
|
||||
content = models.TextField(blank=True, verbose_name='Inhalt')
|
||||
|
||||
created_standard_by = models.ForeignKey(User, on_delete=models.PROTECT)
|
||||
created_standard_date = models.DateTimeField(default=datetime.datetime.now(), blank=True)
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@
|
|||
<form method="POST" id="taskareaform">
|
||||
{% csrf_token %}
|
||||
{{normalForm|crispy}}
|
||||
{{editorForm.media}}
|
||||
{{editorForm}}
|
||||
|
||||
|
||||
<p>Wenn ein Standard erstellt wurde, kann er nur von einer Person mit dem Recht <i>Standards bearbeiten und freischalten</i> veröffentlicht werden.</p>
|
||||
<hr>
|
||||
|
|
@ -32,5 +31,11 @@ $("#id_area").change(function () {
|
|||
}
|
||||
});
|
||||
});
|
||||
$(document).ready(function() {
|
||||
$('#id_content').summernote({
|
||||
height: 400
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock content %}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@
|
|||
<form method="POST" id="taskareaform">
|
||||
{% csrf_token %}
|
||||
{{normalForm|crispy}}
|
||||
{{editorForm.media}}
|
||||
{{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' standard_id %} ">Aktualisieren</button>
|
||||
|
|
@ -39,6 +38,10 @@ $("#id_area").change(function () {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#id_content').summernote({
|
||||
height: 400
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock content %}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ def StandardAdd(request):
|
|||
def StandardUpdate(request, id):
|
||||
standard = Standards.objects.get(pk=id)
|
||||
if request.method == 'POST':
|
||||
#normalForm = StandardUpdateStandard(request.POST, instance=standard)
|
||||
normalForm = StandardUpdateStandard(request.POST, instance=standard)
|
||||
editorForm = StandardUpdateStandardEditor(request.POST, instance=standard)
|
||||
|
||||
|
|
@ -108,6 +109,7 @@ def StandardUpdate(request, id):
|
|||
return redirect('/standards')
|
||||
|
||||
else:
|
||||
#normalForm = StandardUpdateStandard(instance=standard)
|
||||
normalForm = StandardUpdateStandard(instance=standard)
|
||||
editorForm = StandardUpdateStandardEditor(instance=standard)
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -28,6 +28,10 @@
|
|||
<!--<link href="{%static 'users/css/bootstrap.min.css' %}" rel="stylesheet">-->
|
||||
<link href='https://fonts.googleapis.com/css?family=Roboto&display=swap' rel='stylesheet' type='text/css'>
|
||||
|
||||
<!-- include summernote css/js -->
|
||||
<link href="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.12/summernote.css" rel="stylesheet">
|
||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.12/summernote.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body id="page-top">
|
||||
|
|
@ -315,6 +319,7 @@
|
|||
<!-- Page level custom scripts -->
|
||||
<!--<script src="js/demo/chart-area-demo.js"></script>-->
|
||||
<!--<script src="js/demo/chart-pie-demo.js"></script>-->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
|
|
@ -14,5 +14,12 @@
|
|||
</form>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#id_problem').summernote({
|
||||
height: 400
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock content %}
|
||||
|
||||
|
|
|
|||
|
|
@ -423,6 +423,7 @@ def GlobalSearch(request):
|
|||
final_results_st.append(tempele)
|
||||
i += 1
|
||||
'''
|
||||
|
||||
#return JsonResponse({'standards' : final_results_st})
|
||||
html = render_to_string('users/searchres.html', {'res_standard': res_standard, 'res_areas': res_areas, 'res_tasks': res_tasks, 'res_pers': res_pers})
|
||||
return HttpResponse(html)
|
||||
|
|
|
|||
Loading…
Reference in New Issue