Commit 08b1a533 authored by okhin's avatar okhin 🚴

Let's use CKEditor

parent 3dd67924
Pipeline #1133 failed with stage
in 41 seconds
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-13 16:42
from __future__ import unicode_literals
import ckeditor.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('campaign', '0008_auto_20170213_1232'),
]
operations = [
migrations.AlterField(
model_name='argumentary',
name='title',
field=ckeditor.fields.RichTextField(blank=True, max_length=255, null=True, verbose_name='title'),
),
migrations.AlterField(
model_name='argumentary',
name='title_de',
field=ckeditor.fields.RichTextField(blank=True, max_length=255, null=True, verbose_name='title'),
),
migrations.AlterField(
model_name='argumentary',
name='title_en',
field=ckeditor.fields.RichTextField(blank=True, max_length=255, null=True, verbose_name='title'),
),
migrations.AlterField(
model_name='argumentary',
name='title_fr',
field=ckeditor.fields.RichTextField(blank=True, max_length=255, null=True, verbose_name='title'),
),
migrations.AlterField(
model_name='campaign',
name='description',
field=ckeditor.fields.RichTextField(null=True),
),
migrations.AlterField(
model_name='campaign',
name='description_de',
field=ckeditor.fields.RichTextField(null=True),
),
migrations.AlterField(
model_name='campaign',
name='description_en',
field=ckeditor.fields.RichTextField(null=True),
),
migrations.AlterField(
model_name='campaign',
name='description_fr',
field=ckeditor.fields.RichTextField(null=True),
),
]
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.conf import settings from django.conf import settings
from ckeditor.fields import RichTextField
from picampaign.organization.models import Organization from picampaign.organization.models import Organization
from picampaign.contact.models import Contact from picampaign.contact.models import Contact
...@@ -10,7 +11,7 @@ class Campaign(models.Model): ...@@ -10,7 +11,7 @@ class Campaign(models.Model):
"""Campaign model, describe what have to be achieved""" """Campaign model, describe what have to be achieved"""
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
title = models.CharField(max_length=255) title = models.CharField(max_length=255)
description = models.TextField(null=True) description = RichTextField(null=True)
organization = models.ForeignKey(Organization, related_name='campaigns') organization = models.ForeignKey(Organization, related_name='campaigns')
start_date = models.DateField() start_date = models.DateField()
end_date = models.DateField() end_date = models.DateField()
...@@ -23,7 +24,7 @@ class Argumentary(models.Model): ...@@ -23,7 +24,7 @@ class Argumentary(models.Model):
"""Argumentary for a campaign""" """Argumentary for a campaign"""
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
campaign = models.ForeignKey(Campaign) campaign = models.ForeignKey(Campaign)
title = models.CharField(max_length=255, verbose_name=_('title'), null=True, blank=True) title = RichTextField(max_length=255, verbose_name=_('title'), null=True, blank=True)
text = models.TextField(null=True) text = models.TextField(null=True)
def __str__(self): def __str__(self):
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-13 16:07
from __future__ import unicode_literals
import ckeditor.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('organization', '0005_organization_website'),
]
operations = [
migrations.AlterField(
model_name='organization',
name='description',
field=ckeditor.fields.RichTextField(blank=True),
),
migrations.AlterField(
model_name='organization',
name='description_de',
field=ckeditor.fields.RichTextField(blank=True, null=True),
),
migrations.AlterField(
model_name='organization',
name='description_en',
field=ckeditor.fields.RichTextField(blank=True, null=True),
),
migrations.AlterField(
model_name='organization',
name='description_fr',
field=ckeditor.fields.RichTextField(blank=True, null=True),
),
]
from django.db import models from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
from ckeditor.fields import RichTextField
from picampaign.contact.models import Contact from picampaign.contact.models import Contact
...@@ -9,7 +11,7 @@ class Organization(models.Model): ...@@ -9,7 +11,7 @@ class Organization(models.Model):
sip_key = models.CharField(max_length=255) sip_key = models.CharField(max_length=255)
users = models.ManyToManyField(User, blank=True, users = models.ManyToManyField(User, blank=True,
related_name='organizations') related_name='organizations')
description = models.TextField(blank=True) description = RichTextField(blank=True)
logo = models.ImageField(upload_to='organization/logos/', blank=True) logo = models.ImageField(upload_to='organization/logos/', blank=True)
website = models.URLField(blank=True) website = models.URLField(blank=True)
......
...@@ -37,6 +37,7 @@ INSTALLED_APPS = ( ...@@ -37,6 +37,7 @@ INSTALLED_APPS = (
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'rest_framework', 'rest_framework',
'modeltranslation', 'modeltranslation',
'ckeditor',
'picampaign.contact', 'picampaign.contact',
'picampaign.campaign', 'picampaign.campaign',
'picampaign.organization', 'picampaign.organization',
...@@ -119,3 +120,16 @@ TEMPLATES = [ ...@@ -119,3 +120,16 @@ TEMPLATES = [
} }
}, },
] ]
CKEDITOR_CONFIGS = {
'default': {
'toolbar': 'Custom',
'toolbar_Custom': [
['Bold', 'Italic', 'Underline'],
['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Link', 'Unlink'],
['RemoveFormat', 'Source']
]
'allowed_content': 'a em strong ul li br du dl dt h3 h4 h5',
}
}
...@@ -13,11 +13,13 @@ requires = [ ...@@ -13,11 +13,13 @@ requires = [
'django-modeltranslation', 'django-modeltranslation',
'requests', 'requests',
'pillow', 'pillow',
'django-ckeditor',
'django-wysiwyg',
] ]
setup(name='picampaign', setup(name='picampaign',
namespace_packages=['picampaign'], namespace_packages=['picampaign'],
version='0.1.0', version='0.1.1',
description='PiPhone Campaign Manager.', description='PiPhone Campaign Manager.',
long_description=README, long_description=README,
classifiers=["Programming Language :: Python"], classifiers=["Programming Language :: Python"],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment