django-blog-zinnia / cmsplugin-zinnia

Bridge between django-blog-zinnia and django-cms
BSD 3-Clause "New" or "Revised" License
53 stars 46 forks source link

Content Field with Editor is missing #39

Closed thomaswoeckinger closed 9 years ago

thomaswoeckinger commented 9 years ago

When try to create an new entry all fields are shown but the editor for the content is missing!

I'm using following versions in my djangocms

argparse (1.2.1) beautifulsoup4 (4.3.2) cmsplugin-filer (0.10) cmsplugin-zinnia (0.6) dj-database-url (0.3.0) Django (1.6.8) django-appconf (0.6) django-autocomplete-light (1.4.14) django-blog-zinnia (0.14.2) django-ckeditor-updated (4.4.4) django-classy-tags (0.5.1) django-cms (3.0.6) django-contrib-comments (1.5) django-filer (0.9.7) django-mptt (0.6.1) django-polymorphic (0.6) django-reversion (1.8.5) django-sekizai (0.7) django-tagging (0.3.3) django-tinymce (1.5.3) django-xmlrpc (0.1.5) djangocms-admin-style (0.2.2) djangocms-column (1.5) djangocms-file (0.1) djangocms-flash (0.1) djangocms-googlemap (0.2) djangocms-inherit (0.1) djangocms-installer (0.5.4) djangocms-link (1.5) djangocms-picture (0.1) djangocms-style (1.4) djangocms-teaser (0.1) djangocms-text-ckeditor (2.4.1) djangocms-video (0.1) easy-thumbnails (2.2) html5lib (0.999) imagestore (2.7.7) lxml (3.4.0) Pillow (2.6.1) pip (1.5.6) psycopg2 (2.5.4) pyparsing (2.0.3) pytz (2014.7) setuptools (3.6) six (1.8.0) sorl-thumbnail (11.12) South (1.0.1) wsgiref (0.1.2) zinnia-wysiwyg-ckeditor (1.1)

My configuration

TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', 'django.template.loaders.eggs.Loader' )

MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.doc.XViewMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'cms.middleware.user.CurrentUserMiddleware', 'cms.middleware.page.CurrentPageMiddleware', 'cms.middleware.toolbar.ToolbarMiddleware', 'cms.middleware.language.LanguageCookieMiddleware' )

TEMPLATE_CONTEXT_PROCESSORS = ( 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', 'django.core.context_processors.i18n', 'django.core.context_processors.debug', 'django.core.context_processors.request', 'django.core.context_processors.media', 'django.core.context_processors.csrf', 'django.core.context_processors.tz', 'sekizai.context_processors.sekizai', 'django.core.context_processors.static', 'cms.context_processors.cms_settings', 'zinnia.context_processors.version', 'imagestore.context_processors.imagestore_processor' )

TEMPLATE_DIRS = ( os.path.join(BASE_DIR, 'suzi', 'templates'), )

INSTALLED_APPS = ( 'djangocms_admin_style', 'djangocms_text_ckeditor', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.admin', 'django.contrib.sites', 'django.contrib.sitemaps', 'django.contrib.staticfiles', 'django.contrib.messages', 'django_comments', 'mptt', 'menus', 'south', 'sekizai', 'djangocms_style', 'djangocms_column', 'djangocms_file', 'djangocms_flash', 'djangocms_googlemap', 'djangocms_inherit', 'djangocms_link', 'djangocms_picture', 'djangocms_teaser', 'djangocms_video', 'reversion', 'filer', 'easy_thumbnails', 'cmsplugin_filer_file', 'cmsplugin_filer_folder', 'cmsplugin_filer_link', 'cmsplugin_filer_image', 'cmsplugin_filer_teaser', 'cmsplugin_filer_video', 'tagging', 'zinnia', 'zinnia_ckeditor', 'cms', 'cmsplugin_zinnia', 'imagestore', 'imagestore.imagestore_cms', 'autocomplete_light', 'sorl.thumbnail', 'suzi' )

LANGUAGES = (

Customize this

('de', gettext('de')),
('en', gettext('en')),

)

CMS_LANGUAGES = {

Customize this

'default': {
    'public': True,
    'hide_untranslated': False,
    'redirect_on_fallback': True,
},
1: [
    {
        'public': True,
        'code': 'de',
        'hide_untranslated': False,
        'name': gettext('de'),
        'redirect_on_fallback': True,
    },
    {
        'public': True,
        'code': 'en',
        'hide_untranslated': False,
        'name': gettext('en'),
        'redirect_on_fallback': True,
    },
],

}

CMS_TEMPLATES = (

Customize this

('page.html', 'Page'),
('feature.html', 'Page with Feature')

)THUMBNAIL_HIGH_RESOLUTION = True

THUMBNAIL_PROCESSORS = ( 'easy_thumbnails.processors.colorspace', 'easy_thumbnails.processors.autocrop',

'easy_thumbnails.processors.scale_and_crop',

'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters'

)

SOUTH_MIGRATION_MODULES = { 'zinnia': 'suzi.migrations.zinnia', }

ZINNIA_ENTRY_BASE_MODEL = 'cmsplugin_zinnia.placeholder.EntryPlaceholder'

CMS_PERMISSION = True

CMS_PLACEHOLDER_CONF = {}

Fantomas42 commented 9 years ago

If you use the EntryPlaceholder, you can only add content to the entries once they are created. This is a known limitation coming from the CMS.

thomaswoeckinger commented 9 years ago

But there is still no content error if this entry is opened after creation! Where can i find the page (URL) where the editor is shown?

Fantomas42 commented 9 years ago

Oh I forgot, since CMS 3.0, you cannot edit placeholder in the admin. You must now add content into the entries from the front office.

thomaswoeckinger commented 9 years ago

Is this possible by adding a plugin to the page or using the zinnia base template?

Fantomas42 commented 9 years ago

The default templates should do the trick. You go on a blog page, activate the edition, you now you can add plugins into the content of your entry.

thomaswoeckinger commented 9 years ago

Thx i will give it a try

thomaswoeckinger commented 9 years ago

It seems to be impossible, because the triggered pages are always from the admin view of the CMS where the editor is not shown.

I tried admin site and urls followed by ?edit (there is no difference)

Is it possible to get the original dashboard or admin site from the zinnia beside the CMS admin sites

bittner commented 9 years ago

Awesome! Front-end editing only, that's the way to go! :+1:

Fantomas42 commented 9 years ago

Is it possible to get the original dashboard or admin site from the zinnia beside the CMS admin sites

Nope, django-cms override the admin templates for his own usage.

It seems to be impossible, because the triggered pages are always from the admin view of the CMS where the editor is not shown.

I tried admin site and urls followed by ?edit (there is no difference)

I just give a try on the front edit, and everything works fine. Here my process:

Regards

thomaswoeckinger commented 9 years ago

Its working now, but anyway this should not work that way. This is far away from usability.

Anyway thx a lot for your help

Fantomas42 commented 9 years ago

Its working now, but anyway this should not work that way. This is far away from usability.

I agree !

bittner commented 9 years ago

The process of adding an entry with the EntryPlaceholder (as described by @Fantomas42 above) works, but it entails a few unpleasant side-effects.

Django Version: 1.7.5
Python Version: 2.7.3
Installed Applications: zinnia, cmsplugin_zinnia

Exception Type: TypeError at /de/admin/zinnia/entry/
Exception Value: argument of type 'NoneType' is not iterable
Traceback:
...
File "/path/to/venv/lib/python2.7/site-packages/django/contrib/admin/templatetags/admin_list.py" in result_list
  316.             'results': list(results(cl))}
File "/path/to/venv/lib/python2.7/site-packages/django/contrib/admin/templatetags/admin_list.py" in results
  292.             yield ResultList(None, items_for_result(cl, res, None))
File "/path/to/venv/lib/python2.7/site-packages/django/contrib/admin/templatetags/admin_list.py" in __init__
  283.         super(ResultList, self).__init__(*items)
File "/path/to/venv/lib/python2.7/site-packages/django/contrib/admin/templatetags/admin_list.py" in items_for_result
  198.             f, attr, value = lookup_field(field_name, result, cl.model_admin)
File "/path/to/venv/lib/python2.7/site-packages/django/contrib/admin/utils.py" in lookup_field
  276.             value = attr(obj)
File "/path/to/venv/lib/python2.7/site-packages/zinnia/admin/entry.py" in get_title
  79.             {'title': entry.title, 'word_count': entry.word_count}
File "/path/to/venv/lib/python2.7/site-packages/zinnia/models_bases/entry.py" in word_count
  228.         return len(strip_tags(self.html_content).split())
File "/path/to/venv/lib/python2.7/site-packages/django/utils/functional.py" in wrapper
  214.             return func(*args, **kwargs)
File "/path/to/venv/lib/python2.7/site-packages/django/utils/html.py" in strip_tags
  174.     while '<' in value and '>' in value:

Couldn't we

  1. add a, say, Text plugin to any new blog entry by default, maybe with an ellipsis (...) as temporary content
  2. provide edit controls for entry title, story image, tags, publish date, etc. on the frontend
  3. connect the "published" / "draft" state to the django-CMS "draft" / "live" state somehow, mimicking the same behavior as django-CMS?

That would make Zinnia a fully frontend-capable blogging engine.

bittner commented 9 years ago

Can we reopen this issue or should I open a new issue for improving the user experience when using the EntryPlaceholder?

Fantomas42 commented 9 years ago

A new issue is better.

bittner commented 9 years ago

Update: The exception above occurs only when you have existing blog entries with Zinnia's native Entry model. When you migrate to the EntryPlaceholder model the reference to a placeholder for content remains unset (foreign key content_placeholder_id is null) in all existing entries. And the Admin doesn't seem to like that a lot.

Note this was not the case with django-CMS 2.4. You could have switched back and forth from and to the EntryPlaceholder. Looks like a job for issue #47.