Browse Source

Pongo bien el enlace dentro del sitio. Añado tinymce

Celestino Rey 4 months ago
parent
commit
6a683be4ae
4 changed files with 34 additions and 1 deletions
  1. 2 1
      src/eventos/forms.py
  2. 29 0
      src/gestion_reservas/settings.py
  3. 2 0
      src/gestion_reservas/urls.py
  4. 1 0
      src/requirements.txt

+ 2 - 1
src/eventos/forms.py

@@ -1,5 +1,6 @@
 from django import forms
 from django.contrib.auth import get_user_model
+from tinymce.widgets import TinyMCE
 
 from .models import Evento
 from .models import ListaEspera
@@ -116,7 +117,7 @@ class MensajeCorreoForm(forms.Form):
 
     mensaje = forms.CharField(
         label="Mensaje",
-        widget=forms.Textarea(attrs={'class': 'form-control', 'rows': 25, 'style': 'min-height: 400px;'}),
+        widget=TinyMCE(attrs={'cols': 80, 'rows': 25}),
         required=True
     )
 

+ 29 - 0
src/gestion_reservas/settings.py

@@ -54,6 +54,7 @@ INSTALLED_APPS = [
     'reymotausers',
 
     'rest_framework',
+    'tinymce',
 ]
 
 MIDDLEWARE = [
@@ -241,3 +242,31 @@ LOGGING = {
         },
     },
 }
+
+TINYMCE_DEFAULT_CONFIG = {
+    'height': 360,
+    'width': 1120,
+    'cleanup_on_startup': True,
+    'custom_undo_redo_levels': 20,
+    'selector': 'textarea',
+    'plugins': '''
+            textcolor save link image media preview codesample contextmenu
+            table code lists fullscreen insertdatetime nonbreaking
+            contextmenu directionality searchreplace wordcount visualblocks
+            visualchars code fullscreen autolink lists charmap print hr
+            anchor pagebreak
+            ''',
+    'toolbar1': '''
+            fullscreen preview bold italic underline | fontselect,
+            fontsizeselect | forecolor backcolor | alignleft alignright |
+            aligncenter alignjustify | indent outdent | bullist numlist table |
+            | link image media | codesample |
+            ''',
+    'toolbar2': '''
+            visualblocks visualchars |
+            charmap hr pagebreak nonbreaking anchor | code |
+            ''',
+    'contextmenu': 'formats | link image',
+    'menubar': True,
+    'statusbar': True,
+}

+ 2 - 0
src/gestion_reservas/urls.py

@@ -33,6 +33,8 @@ urlpatterns = [
     path("accounts/", include("accounts.urls")),  # new
     path("accounts/", include("django.contrib.auth.urls")),
 
+    path('tinymce/', include('tinymce.urls')),  # TinyMCE URLs
+
     path('', views.principal, name='principal'),
     path('entorno/', views.ver_variables_entorno, name='ver_variables_entorno'),
     path('ayuda/', views.ayuda, name='ayuda'),

+ 1 - 0
src/requirements.txt

@@ -25,3 +25,4 @@ weasyprint==68.0
 webencodings==0.5.1
 zopfli==0.4.0
 whitenoise
+django-tinymce==4.1.0