Texte riche pour commentaire étudiant

This commit is contained in:
Claude Paroz 2019-02-06 17:32:31 +01:00
parent 703c217ec2
commit 5bb1679527
5 changed files with 22 additions and 2 deletions

View file

@ -92,6 +92,7 @@ INSTALLED_APPS = (
'django.contrib.staticfiles',
'django.contrib.admin',
'django_summernote',
'tabimport',
'stages',
'candidats',
@ -106,6 +107,19 @@ ALLOWED_HOSTS = ['localhost', 'stages.pierre-coullery.ch']
# candidats admin shows confirmation_date readonly field twice.
SILENCED_SYSTEM_CHECKS = ['admin.E012']
SUMMERNOTE_CONFIG = {
'summernote': {
'toolbar': [
# [groupName, [list of button]]
['style', ['bold', 'italic', 'underline', 'clear']],
['font', ['strikethrough']],
['fontsize', ['fontsize']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
]
}
}
FABRIC_HOST = 'gestion.pierre-coullery.ch'
FABRIC_USERNAME = ''

View file

@ -2,7 +2,7 @@ import os
from django.conf import settings
from django.contrib import admin
from django.urls import path, re_path
from django.urls import include, path, re_path
from django.views.generic import RedirectView
from django.views.static import serve
@ -75,6 +75,7 @@ urlpatterns = [
path('availability/<int:pk>/summary/', views.AvailabilitySummaryView.as_view()),
path('corporation/<int:pk>/contacts/', views.CorpContactJSONView.as_view()),
path('summernote/', include('django_summernote.urls')),
# Serve bulletins by Django to allow LoginRequiredMiddleware to apply
path('media/bulletins/<path:path>', serve,
{'document_root': os.path.join(settings.MEDIA_ROOT, 'bulletins'), 'show_indexes': False}

View file

@ -3,3 +3,4 @@ tabimport>=0.4.0
openpyxl==2.4.9
xlrd
reportlab
django-summernote==0.8.11.4

View file

@ -5,6 +5,7 @@ from django.db.models.deletion import Collector
from django.forms import inlineformset_factory
from django.urls import reverse
from django_summernote.widgets import SummernoteWidget
from tabimport import FileFactory, UnsupportedFileFormat
from .models import Corporation, Period, Section, Student, StudentFile
@ -120,6 +121,9 @@ class StudentCommentForm(forms.ModelForm):
class Meta:
model = Student
fields = ('mc_comment',)
widgets = {
'mc_comment': SummernoteWidget,
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

View file

@ -3,7 +3,7 @@
{% block extrastyle %}{{ block.super }}
<style>
span.label { font-weight: bold; }
span.label, form label { font-weight: bold; }
div.block { width: 45%; display: inline-block; vertical-align: top; }
textarea { width: 90%; }
button.button { padding: 10px 15px; }