diff options
author | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2011-04-25 17:46:57 (GMT) |
---|---|---|
committer | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2011-04-25 17:46:57 (GMT) |
commit | f08a6076ed4a0fdfdc0281ff4a8cac5bbd157c8c (patch) | |
tree | bb6b9252d895389da00119b1ea21c187cff1d3a7 | |
parent | de9cd4602927cd08385544b9470420c933122bba (diff) |
integrated TinyMCE.
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | program/models.py | 6 | ||||
-rw-r--r-- | requirements.txt | 1 | ||||
-rw-r--r-- | settings.py | 11 | ||||
-rw-r--r-- | urls.py | 6 |
5 files changed, 20 insertions, 5 deletions
@@ -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: @@ -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<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}) + ) |