diff --git a/core/models.py b/core/models.py index 91fe8e85..19d8b86b 100755 --- a/core/models.py +++ b/core/models.py @@ -5,6 +5,7 @@ from regluit.utils import crypto from datetime import timedelta from decimal import Decimal from notification import models as notification +from ckeditor.fields import RichTextField from django.db import models from django.db.models import Q, get_model @@ -177,8 +178,8 @@ class Campaign(models.Model): LICENSE_CHOICES = CCLicense.CCCHOICES created = models.DateTimeField(auto_now_add=True) name = models.CharField(max_length=500, null=True, blank=False) - description = models.TextField(null=True, blank=False) - details = models.TextField(null=True, blank=True) + description = RichTextField(null=True, blank=False) + details = RichTextField(null=True, blank=True) target = models.DecimalField(max_digits=14, decimal_places=2, null=True, blank=False) license = models.CharField(max_length=255, choices = LICENSE_CHOICES, default='CC BY-NC-ND') left = models.DecimalField(max_digits=14, decimal_places=2, null=True, blank=False) diff --git a/frontend/forms.py b/frontend/forms.py index 1eae6d56..d33a998b 100644 --- a/frontend/forms.py +++ b/frontend/forms.py @@ -221,8 +221,6 @@ def getManageCampaignForm ( instance, data=None, *args, **kwargs ): model = Campaign fields = 'description', 'details', 'license', 'target', 'deadline', 'paypal_receiver', 'edition' widgets = { - 'description': forms.Textarea(attrs={'cols': 80, 'rows': 20}), - 'details': forms.Textarea(attrs={'cols': 80, 'rows': 5}), 'deadline': SelectDateWidget, } diff --git a/frontend/templates/manage_campaign.html b/frontend/templates/manage_campaign.html index 2d8644f2..b276f23b 100644 --- a/frontend/templates/manage_campaign.html +++ b/frontend/templates/manage_campaign.html @@ -109,6 +109,7 @@ Please fix the following before launching your campaign:
{% csrf_token %} + {{ form.media }}

Select the edition

Please choose the edition that most closely matches the edition to be unglued:

diff --git a/requirements.pip b/requirements.pip index 82e6bde9..4570e060 100644 --- a/requirements.pip +++ b/requirements.pip @@ -27,3 +27,4 @@ pyasn1 pycrypto django-maintenancemode django-smtp-ssl +django-ckeditor diff --git a/settings/common.py b/settings/common.py index 56d357ca..23053eb9 100644 --- a/settings/common.py +++ b/settings/common.py @@ -28,6 +28,14 @@ MEDIA_ROOT = '' # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" MEDIA_URL = '' +CKEDITOR_UPLOAD_PATH = '' +CKEDITOR_RESTRICT_BY_USER = True +CKEDITOR_CONFIGS = { + 'default': { + 'width': 700, + }, +} + # Absolute path to the directory static files should be collected to. # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. @@ -125,7 +133,7 @@ INSTALLED_APPS = ( 'regluit.frontend.templatetags', 'regluit.payment.templatetags', 'notification', - + 'ckeditor', # this must appear *after* django.frontend or else it overrides the # registration templates in frontend/templates/registration 'django.contrib.admin', diff --git a/settings/just.py b/settings/just.py index a52f8e2a..05f2d051 100644 --- a/settings/just.py +++ b/settings/just.py @@ -129,6 +129,7 @@ LOGGING = { } STATIC_ROOT = '/var/www/static' +CKEDITOR_UPLOAD_PATH = '/var/www/static/media/' IS_PREVIEW = False diff --git a/settings/please.py b/settings/please.py index 7eaaf7ba..b5738930 100644 --- a/settings/please.py +++ b/settings/please.py @@ -118,6 +118,7 @@ LOGGING = { } STATIC_ROOT = '/var/www/static' +CKEDITOR_UPLOAD_PATH = '/var/www/static/media/' IS_PREVIEW = False diff --git a/settings/prod.py b/settings/prod.py index 823dbde3..94627192 100644 --- a/settings/prod.py +++ b/settings/prod.py @@ -131,6 +131,7 @@ LOGGING = { } STATIC_ROOT = '/var/www/static' +CKEDITOR_UPLOAD_PATH = '/var/www/static/media/' # decide which of the period tasks to add to the schedule #CELERYBEAT_SCHEDULE['send_test_email'] = SEND_TEST_EMAIL_JOB diff --git a/urls.py b/urls.py index 32493f5e..39f96633 100755 --- a/urls.py +++ b/urls.py @@ -21,4 +21,5 @@ urlpatterns = patterns('', url(r'^admin/', include(admin_site.urls)), (r'^comments/', include('django.contrib.comments.urls')), (r'^notification/', include(notification.urls)), + (r'^ckeditor/', include('ckeditor.urls')), )