GithubHelp home page GithubHelp logo

feincms / feincms-elephantblog Goto Github PK

View Code? Open in Web Editor NEW
43.0 43.0 38.0 745 KB

A blog for FeinCMS

Home Page: feinheit.ch/labs/

License: BSD 3-Clause "New" or "Revised" License

Python 91.24% HTML 8.76%

feincms-elephantblog's Introduction

FeinCMS - An extensible Django-based CMS

When was the last time, that a pre-built software package you wanted to use got many things right, but in the end, you still needed to modify the core parts of the code just because it wasn't (easily) possible to customize the way, a certain part of the system behaved?

Django came to rescue all of us, who were not happy with either doing everything on our own or customizing another software package until it was impossible to update.

The biggest strength of a framework-like design is, that it tries not to have a too strong view of what the user should do. It should make some things easy, but just GET OUT OF THE WAY most of the time.

Just after discovering the benefits of a framework-like approach to software design, we fall back into the rewrite everything all the time mindset and build a CMS which has very strong views how content should be structured. One rich text area, a media library and some templates, and we have a simple CMS which will be good enough for many pages. But what if we want more? If we want to be able to add custom content? What if the user can't be trusted to resize images before uploading them? What if you'd like to add a gallery somewhere in between other content? What if the user should be able to administer not only the main content, but also a sidebar, the footer?

With FeinCMS, this does not sound too good to be true anymore. And it's not even complicated.

FeinCMS is an extremely stupid content management system. It knows nothing about content -- just enough to create an admin interface for your own page content types. It lets you reorder page content blocks using a drag-drop interface, and you can add as many content blocks to a region (f.e. the sidebar, the main content region or something else which I haven't thought of yet). It provides helper functions, which provide ordered lists of page content blocks. That's all.

Adding your own content types is extremely easy. Do you like markdown that much, that you'd rather die than using a rich text editor? Then add the following code to your project, and you can go on using the CMS without being forced to use whatever the developers deemed best:

from markdown2 import markdown
from feincms.module.page.models import Page
from django.db import models

class MarkdownPageContent(models.Model):
    content = models.TextField()

    class Meta:
        abstract = True

    def render(self, **kwargs):
        return markdown(self.content)

Page.create_content_type(MarkdownPageContent)

That's it. Not even ten code lines for your own page content type.

Getting started

Visit these sites

Repository branches

The FeinCMS repository on github has several branches. Their purpose and rewinding policies are described below.

  • maint: Maintenance branch for the second-newest version of FeinCMS.
  • main: Stable version of FeinCMS.

main and maint are never rebased or rewound.

  • next: Upcoming version of FeinCMS. This branch is rarely rebased if ever, but this might happen. A note will be sent to the official mailing list whenever next has been rebased.
  • pu or feature branches are used for short-lived projects. These branches aren't guaranteed to stay around and are not meant to be deployed into production environments.

feincms-elephantblog's People

Contributors

atomicspark avatar evansd avatar fabiangermann avatar georgemarshall avatar j00bar avatar j4mie avatar joshk avatar joshuajonah avatar l-monnier avatar matthiask avatar nilsfr avatar paramono avatar richardbolt avatar sbaechler avatar schuerpf avatar uruz avatar vencax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

feincms-elephantblog's Issues

AttributeError: type object 'Entry' has no attribute 'register_response_processor'

I've taken the examples from the doc: http://feincms-elephantblog.readthedocs.org/en/latest/installation.html

When I try to run feincms-elephantblog 0.3.0 with feincms 1.7.2 I'm getting the error "AttributeError: type object 'Entry' has no attribute 'register_response_processor'".

Is this to do with the depreciation warning here? https://github.com/feincms/feincms/blob/master/docs/deprecation.rst#id2

Request and response processors have to be imported from :mod:`feincms.module.page.processors`. Additionally, they must be registered individually by using register_request_processor and register_response_processor.

Here's the stacktrace:

]$ python manage.py runserver
Validating models...

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x1150190>>
Traceback (most recent call last):
  File "/home/edward/python/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 91, in inner_run
    self.validate(display_num_errors=True)
  File "/home/edward/python/lib/python2.7/site-packages/django/core/management/base.py", line 266, in validate
    num_errors = get_validation_errors(s, app)
  File "/home/edward/python/lib/python2.7/site-packages/django/core/management/validation.py", line 30, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/home/edward/python/lib/python2.7/site-packages/django/db/models/loading.py", line 158, in get_app_errors
    self._populate()
  File "/home/edward/python/lib/python2.7/site-packages/django/db/models/loading.py", line 64, in _populate
    self.load_app(app_name, True)
  File "/home/edward/python/lib/python2.7/site-packages/django/db/models/loading.py", line 88, in load_app
    models = import_module('.models', app_name)
  File "/home/edward/python/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/edward/Projects/MyProject/core/models.py", line 35, in <module>
    'elephantblog.extensions.blogping',
  File "/home/edward/python/lib/python2.7/site-packages/feincms/extensions.py", line 107, in register_extensions
    cls._extensions.append(LegacyExtension(cls, extension=extension))
  File "/home/edward/python/lib/python2.7/site-packages/feincms/extensions.py", line 119, in __init__
    self.handle_model()
  File "/home/edward/python/lib/python2.7/site-packages/feincms/extensions.py", line 148, in handle_model
    self.extension(self.model, self)
  File "/home/edward/python/lib/python2.7/site-packages/feincms/module/extensions/datepublisher.py", line 94, in register
    cls.register_response_processor(datepublisher_response_processor)
AttributeError: type object 'Entry' has no attribute 'register_response_processor'

MultiValueDictKeyError at /admin/elephantblog/entry/add/

Get exception:

MultiValueDictKeyError at /admin/elephantblog/entry/add/

"Key 'template_key' not found in ..................................................................................

when add new entry with following model:

Entry.register_templates({
       'key': 'base',
       'title': _('Blog template'),
        'path': 'entry_detail.html',
        'regions': (
            ('main', _('Main content area')),
            ('sidebar', _('Sidebar'), 'inherited')),
        }
    )

`entry.first_image` and `entry.first_richtext` parameters not available in the `ArchiveIndexView`

Context

Environment
Django==1.11
FeinCMS==1.13.1
feincms-elephantblog==1.1.0
Url
/
View
ArchiveIndexView
Template
entry_archive.html

Description

The first_image and first_richtext parameters are not available in the ArchiveIndexView As a result, they do not render in the entry_archive.html template. However, the content can still be accessed via the mediafilecontent_set and richtextcontent_set parameters. Therefore, the following does work:

{% if entry.mediafilecontent_set.first %}{{ entry.mediafilecontent_set.first.render }{% endif %}
{% if entry.richtextcontent_set.first %}{{ entry.richtextcontent_set.first.render }}{% endif %}

Please verify and update accordingly. Thank you for your time.

satadev

missing detail in documentation: import gettext as _

in the documentation the example for models.py lacks the import for gettext or gettext_lazy

so, to solve this, just add either:

from django.utils.translation import gettext_lazy as _

or

from django.utils.translation import gettext as _

refer to django documentation about which to choose.

Urls not working on initial setup when using as Application Content with FeinCMS

This is a problem me and a coworker of mine both faced on separate projects using ElephantBlog as Application Content with FeinCMS. It seems that neither method of registering elephantblog works correctly. The two methods i've tried are:

Page.create_content_type(ApplicationContent, APPLICATIONS=(
    ('elephantblog', _('Blog'), {'urls': 'elephantblog.urls'}),
))

and,

Page.create_content_type(ApplicationContent, APPLICATIONS=(
    ('elephantblog.urls', _('Blog')),
))

When using the first example the absolute urls for entries are not generated (this is with the recommended absolute url overrides in the settings file fyi). In the second case nothing will show up on my blog page and previewing entries from the admin will give a 404.

The only way I've gotten it to work is by using one of these then switching it to the other. But from a fresh install neither work as expected.

Wrong Python package name in the installation instructions.

I get the following error when trying to install ElephantBlog:

pip install django-elephantblog
Downloading/unpacking django-elephantblog
  Could not find any downloads that satisfy the requirement django-elephantblog
No distributions at all found for django-elephantblog

Changing it to pip install feincms-elephantblog seems to work. Just a slight oversight in documentation? If so, I have a patch ready for submission.

tags extension registering problem

It's registered like that:
Entry.register_extensions('feincms.module.extensions.datepublisher', 'elephantblog.extensions.tags',)

File "/Users/macio/.virtualenvs/rocket_cms/lib/python2.7/site-packages/feincms/extensions.py", line 74, in register_extensions
    '%r is an invalid extension.' % extension)
django.core.exceptions.ImproperlyConfigured:
 <function register at 0x1065c3c08> is an invalid extension.

elephantblog does not support tiny_mce customization while feincms does

Hey all,

I added a SyntaxHighlighter plugin to my tiny_mce. It's working fine on feincms pages, but it somehow strips the tags away in elephantblog entries. I installed the version 0.3 (i guess) which i was told to in another issue. Any ideas how to fix this?

In additon there seemed to be a little bug concerning language filtering in the models.py instead of language__starts_with language was used in the comparison. I already fixed this.

Thanks in advance!
Best,
Simon

'tuple' object has no attribute 'extend'

I'm running feincms 1.7.4 and feincms-elephantblog 0.3.0.

On first run I'm getting the error 'tuple' object has no attribute 'extend'

Stacktrace:

Environment:


Request Method: GET
Request URL: http://localhost:8000/

Django Version: 1.5.1
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'south',
 'feincms',
 'mptt',
 'feincms.module.page',
 'feincms.module.medialibrary',
 'elephantblog',
 'core')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/home/edward/python/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  103.                     resolver_match = resolver.resolve(request.path_info)
File "/home/edward/python/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
  319.             for pattern in self.url_patterns:
File "/home/edward/python/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns
  347.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/edward/python/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module
  342.             self._urlconf_module = import_module(self.urlconf_name)
File "/home/edward/python/lib/python2.7/site-packages/django/utils/importlib.py" in import_module
  35.     __import__(name)
File "/home/edward/Projects/MyProject/MyProject/urls.py" in <module>
  7. admin.autodiscover()
File "/home/edward/python/lib/python2.7/site-packages/django/contrib/admin/__init__.py" in autodiscover
  29.             import_module('%s.admin' % app)
File "/home/edward/python/lib/python2.7/site-packages/django/utils/importlib.py" in import_module
  35.     __import__(name)
File "/home/edward/python/lib/python2.7/site-packages/elephantblog/admin.py" in <module>
  28. admin.site.register(models.Entry, models.EntryAdmin)
File "/home/edward/python/lib/python2.7/site-packages/django/contrib/admin/sites.py" in register
  101.                 self._registry[model] = admin_class(model, self)
File "/home/edward/python/lib/python2.7/site-packages/feincms/admin/item_editor.py" in __init__
  63.         super(ItemEditor, self).__init__(model, admin_site)
File "/home/edward/python/lib/python2.7/site-packages/feincms/extensions.py" in __init__
  182.         self.initialize_extensions()
File "/home/edward/python/lib/python2.7/site-packages/feincms/extensions.py" in initialize_extensions
  188.                 extension.handle_modeladmin(self)
File "/home/edward/python/lib/python2.7/site-packages/feincms/module/extensions/translations.py" in handle_modeladmin
  212.             modeladmin.add_extension_options('language', 'translation_of')
File "/home/edward/python/lib/python2.7/site-packages/feincms/extensions.py" in add_extension_options
  200.                 self.fieldsets[1][1]['fields'].extend(f)

Exception Type: AttributeError at /
Exception Value: 'tuple' object has no attribute 'extend'

If I refresh the page I get this error: There are duplicate field(s) in EntryAdmin.fieldsets

Stacktrace:

Environment:


Request Method: GET
Request URL: http://localhost:8000/

Django Version: 1.5.1
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'south',
 'feincms',
 'mptt',
 'feincms.module.page',
 'feincms.module.medialibrary',
 'elephantblog',
 'core')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/home/edward/python/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  103.                     resolver_match = resolver.resolve(request.path_info)
File "/home/edward/python/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
  319.             for pattern in self.url_patterns:
File "/home/edward/python/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns
  347.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/edward/python/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module
  342.             self._urlconf_module = import_module(self.urlconf_name)
File "/home/edward/python/lib/python2.7/site-packages/django/utils/importlib.py" in import_module
  35.     __import__(name)
File "/home/edward/Projects/MyProject/MyProject/urls.py" in <module>
  7. admin.autodiscover()
File "/home/edward/python/lib/python2.7/site-packages/django/contrib/admin/__init__.py" in autodiscover
  29.             import_module('%s.admin' % app)
File "/home/edward/python/lib/python2.7/site-packages/django/utils/importlib.py" in import_module
  35.     __import__(name)
File "/home/edward/python/lib/python2.7/site-packages/elephantblog/admin.py" in <module>
  28. admin.site.register(models.Entry, models.EntryAdmin)
File "/home/edward/python/lib/python2.7/site-packages/django/contrib/admin/sites.py" in register
  98.                 validate(admin_class, model)
File "/home/edward/python/lib/python2.7/site-packages/django/contrib/admin/validation.py" in validate
  25.     validate_base(cls, model)
File "/home/edward/python/lib/python2.7/site-packages/django/contrib/admin/validation.py" in validate_base
  300.             raise ImproperlyConfigured('There are duplicate field(s) in %s.fieldsets' % cls.__name__)

Exception Type: ImproperlyConfigured at /
Exception Value: There are duplicate field(s) in EntryAdmin.fieldsets

makemigrations fails with SystemCheckError

Hey, I'm playing with elephantblog and also I'm new to FeinCMS. While following the documentation I'm now stuck with this error:

(rblog) usr:~$ python manage.py makemigrations
SystemCheckError: System check identified some issues:

ERRORS:
elephantblog.MediaFileContent.mediafile: (fields.E300) Field defines a relation with model 'MediaFile', which is either not installed, or is abstract.

while I'm trying to solve it, any hints are appreciated ๐Ÿ˜„

it's a fresh project with just an app app added and in the models.py the content as mentioned in the documention, so:

from django.utils.translation import gettext_lazy as _
from feincms.content.richtext.models import RichTextContent
from feincms.content.medialibrary.models import MediaFileContent
import feincms_cleanse

from elephantblog.models import Entry

Entry.register_extensions(
    "feincms.module.extensions.datepublisher",
    "feincms.module.extensions.translations",
    "elephantblog.extensions.blogping",
)
Entry.register_regions(("main", _("Main content area")))

Entry.create_content_type(
    RichTextContent, cleanse=feincms_cleanse.cleanse_html, regions=("main",)
)

Entry.create_content_type(MediaFileContent, TYPE_CHOICES=(("default", _("default")),))

entry.first_richtext works only with RichTextContent

entry.first_richtext does not work if i use the contenttype other than RichTextContent

from redactor.fields import RedactorField
from elephantblog.models import Entry

class Content(models.Model):
    content = RedactorField(u'content', null=True, blank=True)
    class Meta:
        abstract = True
    def render(self, **kwargs):
        return self.content

Entry.create_content_type(Content, regions=('main',))

See pull #49

EntryFeed returns TypeError: argument of type 'property' is not iterable

After upgrading to Django 1.5 and FeinCMS 1.7.4, feeds does not seem to work.

Traceback:

File ".../site-packages/django/core/handlers/base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File ".../site-packages/django/contrib/syndication/views.py", line 43, in __call__
    feedgen = self.get_feed(obj, request)

  File ".../site-packages/django/contrib/syndication/views.py", line 148, in get_feed
    for item in self.__get_dynamic_attr('items', obj):

  File ".../site-packages/django/contrib/syndication/views.py", line 83, in __get_dynamic_attr
    return attr()
  File ".../site-packages/elephantblog/feeds.py", line 27, in items
    if 'translations' in getattr(Entry, '_feincms_extensions', ()):

TypeError: argument of type 'property' is not iterable

I never worked with translations, so I'm not sure what's going on here.

Any other information you might want?

Cheers!

Filter entries by language

While adopting feincms.translations.TranslatedObjectMixin, feincms.translations.Translation to my models it's easy for me to list them and pick proper translation with object.translation and then for example object.translation.title. I always had proper translation.

How to do the same with Elephantblog? I've registered 'navigation' translations extension: I can edit translations. But when i get object_list in template it's collection of all entries disregarding language.

outdated documentation: include urls

since django 2.x the urls config has a new way without the need to use regex.

while it's compatible to the old variant, for me the simplest solution to include elephantblog urls was:

from django.urls import path, include
from elephantblog import urls as elephanturls

urlpatterns += [path("blog/", include(elephanturls))]

Error when not using FeinCMS's medialibrary

The utils.py file has an error, when not using FeinCMS's medialibrary. One way to solve this, is to add try/except.

try:
    for content in Entry.mediafilecontent_set.related.model.objects.filter(
            parent__in=entry_dict.keys(),
            mediafile__type='image').reverse().select_related('mediafile'):
        entry_dict[content.parent_id].first_image = content
except AttributeError:
    pass

Import Error: cannot import name 'SortedDict'

Hello,

With Django 1.9, when running the page extension, I got the following error:

Import Error: cannot import name 'SortedDict'

This error is discussed here: jazzband/django-tinymce#114

The solution would be to replace on line 4 of file feincms-elephantblog/elephantblog/navigation_extensions/common.py:

from django.utils.datastructures import SortedDict

by

from collections import OrderedDict as SortedDict

Entry default author

Why is it made so unusable that one should set Entry author if he's logged in?

Getting "Entry object has no attribute get_ancestors" if Entry is empty

I found quite a silly bug related to interopability of feincms and elephantblog.

If you create an empty elephantblog entry (by "empty" I mean with no content types added to it), then the following error will appear:

'Entry' object has no attribute 'get_ancestors'
(Line in question)

Although it's not something critical, since website administrators are unlikely to create a post with no content blocks, still, if somebody does that by accident, it's a little annoying.

I wonder how to fix this issue? Wrap get_ancestors in try/except, and catch the potential error? Or do something on elephant_blog side?

Is this project still alive?

after adding a bunch of new Issues, I noticed that the last issues were from 2016.
So, is this project still alive and used?

thx

admin: entry save form has weird content in the action parameter, prevents saving

Very odd issue that I'm having trouble tracking down. In my app's admin, I can create new entries, but when I try to save (edit and submit) them, I run into an issue. For some reason, the action field on the form is filled with some object data:

<form enctype="multipart/form-data" action="{'available_templates': (), 'TINYMCE_JS_URL': '/media/tinymce/jscripts/tiny_mce/tiny_mce.js', 'TINYMCE_CONTENT_CSS_URL': None, 'FEINCMS_FRONTEND_EDITING': True, 'FEINCMS_JQUERY_NO_CONFLICT': False, 'content_types': [(<django.utils.functional.__proxy__ object at 0x1088fed50>, 'richtextcontent'), (u'Entry Photo', 'entryphotocontent'), (u'File', 'entryfilecontent'), (<django.utils.functional.__proxy__ object at 0x1089dde90>, 'mediafilecontent')], 'FEINCMS_CONTENT_FIELDSET_NAME': 'FEINCMS_CONTENT', 'has_parent_attribute': False, 'model': <class 'elephantblog.models.Entry'>, 'TINYMCE_LINK_LIST_URL': None}" method="post" id="entry_form"><div style='display:none'>

Do you know what could be causing this? I'm having a huge problem understanding how to track this down. If I manually (with WebInspector) remove the contents of the action, then everything works perfectly again.

Entry().published_on default value issue

The "published_on" field in the Entry() class, has the default set to be "datetime.now()". This causes an issue, that sets the default "published_on" value to be the datetime that the class was evaluated, instead of getting the current datetime each time a new Entry() is added. (See related issue on stackoverflow: http://bit.ly/zaJY8f)

To fix this issue, change "default=datetime.now()" to "default=datetime.now"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.