From f08a6076ed4a0fdfdc0281ff4a8cac5bbd157c8c Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Mon, 25 Apr 2011 19:46:57 +0200 Subject: integrated TinyMCE. diff --git a/TODO b/TODO index b43be36..9b3c626 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,2 @@ -* integrate tinyMCE into admin site * integrate open ID * integrate Disqus diff --git a/program/models.py b/program/models.py index 08ca76b..764cfbf 100644 --- a/program/models.py +++ b/program/models.py @@ -3,6 +3,8 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.db import models from django.utils.translation import ugettext_lazy as _ +from tinymce import models as tinymce_models + from datetime import date, datetime, time, timedelta from dateutil.relativedelta import relativedelta from dateutil.rrule import rrule @@ -87,7 +89,7 @@ class Show(models.Model): slug = models.CharField(_("Slug"), max_length=255, unique=True) image = models.ImageField(_("Image"), blank=True, null=True, upload_to='show_images') short_description = models.CharField(_("Short description"), max_length=64) - description = models.TextField(_("Description")) + description = tinymce_models.HTMLField(_("Description")) email = models.EmailField(_("E-Mail"), blank=True, null=True) website = models.URLField(_("Website"), blank=True, null=True) cba_series_id = models.IntegerField(_("CBA series ID"), blank=True, null=True) @@ -284,7 +286,7 @@ class Note(models.Model): timeslot = models.OneToOneField(TimeSlot, verbose_name=_("Time slot")) owner = models.ForeignKey(User, related_name='notes', verbose_name=_("Owner")) title = models.CharField(_("Title"), max_length=128) - content = models.TextField(_("Content")) + content = tinymce_models.HTMLField(_("Content")) status = models.IntegerField(_("Status"), choices=STATUS_CHOICES, default=1) cba_entry_id = models.IntegerField(_("CBA entry ID"), blank=True, null=True) start = models.DateTimeField(editable=False) diff --git a/requirements.txt b/requirements.txt index 32201d5..4cd78de 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,5 +3,6 @@ MySQL-python==1.2.3 PIL==1.1.7 PyYAML==3.09 django-haystack==1.1.0 +django-tinymce==1.5.1a1 pysolr==2.0.13 python-dateutil==1.5 diff --git a/settings.py b/settings.py index 1bffc07..8bd5995 100644 --- a/settings.py +++ b/settings.py @@ -26,8 +26,8 @@ SITE_ID = 1 USE_I18N = True USE_L10N = True -MEDIA_ROOT = '' -MEDIA_URL = '' +MEDIA_ROOT = os.path.join(PROJECT_DIR, 'site_media') +MEDIA_URL = '/site_media/' ADMIN_MEDIA_PREFIX = '/media/' @@ -62,6 +62,7 @@ INSTALLED_APPS = ( 'django.contrib.admin', 'program', 'haystack', + 'tinymce', ) HAYSTACK_SITECONF = 'search_sites' @@ -69,6 +70,12 @@ HAYSTACK_SEARCH_ENGINE = 'solr' HAYSTACK_SOLR_URL = 'http://localhost:8988/solr' HAYSTACK_ID_FIELD = 'docid' +TINYMCE_DEFAULT_CONFIG = { + 'plugins' : 'contextmenu', + 'theme': 'advanced', + 'theme_advanced_toolbar_location': 'top', +} + try: from local_settings import * except ImportError: diff --git a/urls.py b/urls.py index 5b99676..38c611e 100644 --- a/urls.py +++ b/urls.py @@ -1,3 +1,4 @@ +from django.conf import settings from django.conf.urls.defaults import include, patterns from django.contrib import admin @@ -6,4 +7,9 @@ admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), (r'^program/', include('program.urls')), + (r'^tinymce/', include('tinymce.urls')), ) +if settings.DEBUG: + urlpatterns += patterns('', + (r'^site_media/(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}) + ) -- cgit v0.10.2