Skip to content

Commit be4db35

Browse files
committed
Revert to a less radical departure from FeinCMS 1.x
1 parent 200e5bd commit be4db35

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+672
-3
lines changed

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Releases
7979
releases/1.9
8080
releases/1.10
8181
releases/1.11
82+
releases/1.12
8283

8384

8485
Indices and tables

docs/releases/1.12.rst

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
==========================
2+
FeinCMS 1.12 release notes
3+
==========================
4+
5+
Welcome to FeinCMS 1.12!
6+
7+
.. warning::
8+
9+
This is a cleanup release. Lots of changes ahead!
10+
11+
12+
Simplification of import paths
13+
==============================
14+
15+
16+
Template content requires explicit list of templates
17+
====================================================
18+
19+
The template refactor in Django removed the ability to enumerate
20+
templates in template folders. Because of that templates must now
21+
be explicitly specified when creating the content type::
22+
23+
Page.create_content_type(TemplateContent, TEMPLATES=[
24+
('content/template/something1.html', 'something'),
25+
('content/template/something2.html', 'something else'),
26+
('base.html', 'makes no sense'),
27+
])
28+
29+
30+
The blog module has been completely removed
31+
============================================
32+
33+
34+
Backwards-incompatible changes
35+
==============================
36+
37+
* FeinCMS requires Django 1.7 or better.
38+
39+
* Django has removed comments support a long time ago, which meant
40+
that our bundled comments content in ``feincms.content.comments``
41+
was broken for some time. It has been completely removed.
42+
43+
* ``feincms.content.rss`` has been removed, use ``feincms-syndication``
44+
instead.
45+
46+
47+
Removal of deprecated features
48+
------------------------------
49+
50+
South is not supported anymore? Django 1.7 and better only?
51+
52+
``feincms.views.cbv`` has been removed. Use ``feincms.urls`` and
53+
``feincms.views`` directly instead.
54+
55+
56+
New deprecations
57+
================
58+
59+
* VideoContent, SectionContent, ContactForm?, old import paths
60+
* Point 1
61+
62+
63+
Notable features and improvements
64+
=================================
65+
66+
* Rich text cleaning using Tidy has been removed.
67+
68+
* FeinCMS no longer comes with its own copy of jQuery — it reuses Django's
69+
jQuery instead.
70+
71+
* Some support has been added for ``django-filer``.
72+
73+
Bugfixes
74+
========
75+
76+
* Bug fix 1
77+
78+
79+
Compatibility with Django and other apps
80+
========================================
81+
82+
FeinCMS 1.12 requires Django 1.7 or better.

feincms/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from __future__ import absolute_import, unicode_literals
22

3-
VERSION = (2, 0, 'a', 12)
4-
# __version__ = '.'.join(map(str, VERSION))
5-
__version__ = '2.0a12'
3+
VERSION = (1, 12, 0, 'pre')
4+
__version__ = '.'.join(map(str, VERSION))
65

76

87
class LazySettings(object):

feincms/content/application/__init__.py

Whitespace-only changes.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# flake8: noqa
2+
from __future__ import absolute_import, unicode_literals
3+
4+
import warnings
5+
6+
from feincms.apps import *
7+
8+
warnings.warn(
9+
'Import ApplicationContent and friends from feincms.apps.',
10+
DeprecationWarning, stacklevel=2)
11+
12+
13+
def cycle_app_reverse_cache(*args, **kwargs):
14+
warnings.warn(
15+
'cycle_app_reverse_cache does nothing and will be removed in'
16+
' a future version of FeinCMS.',
17+
DeprecationWarning, stacklevel=2,
18+
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# flake8: noqa
2+
from __future__ import absolute_import, unicode_literals
3+
4+
import warnings
5+
6+
warnings.warn(
7+
'The contactform content has been deprecated. Use form-designer instead.',
8+
DeprecationWarning, stacklevel=2)
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
"""
2+
Simple contact form for FeinCMS. The default form class has name, email,
3+
subject and content fields, content being the only one which is not required.
4+
You can provide your own comment form by passing an additional
5+
``form=YourClass`` argument to the ``create_content_type`` call.
6+
"""
7+
8+
from __future__ import absolute_import, unicode_literals
9+
10+
from django import forms
11+
from django.core.mail import send_mail
12+
from django.db import models
13+
from django.http import HttpResponseRedirect
14+
from django.template import RequestContext
15+
from django.template.loader import render_to_string
16+
from django.utils.translation import ugettext_lazy as _
17+
18+
19+
class ContactForm(forms.Form):
20+
name = forms.CharField(label=_('name'))
21+
email = forms.EmailField(label=_('email'))
22+
subject = forms.CharField(label=_('subject'))
23+
24+
content = forms.CharField(
25+
widget=forms.Textarea, required=False,
26+
label=_('content'))
27+
28+
29+
class ContactFormContent(models.Model):
30+
form = ContactForm
31+
32+
email = models.EmailField()
33+
subject = models.CharField(max_length=200)
34+
35+
class Meta:
36+
abstract = True
37+
verbose_name = _('contact form')
38+
verbose_name_plural = _('contact forms')
39+
40+
@classmethod
41+
def initialize_type(cls, form=None):
42+
if form:
43+
cls.form = form
44+
45+
def process(self, request, **kwargs):
46+
if request.GET.get('_cf_thanks'):
47+
self.rendered_output = render_to_string(
48+
'content/contactform/thanks.html',
49+
context_instance=RequestContext(request))
50+
return
51+
52+
if request.method == 'POST':
53+
form = self.form(request.POST)
54+
55+
if form.is_valid():
56+
send_mail(
57+
form.cleaned_data['subject'],
58+
render_to_string('content/contactform/email.txt', {
59+
'data': form.cleaned_data,
60+
}),
61+
form.cleaned_data['email'],
62+
[self.email],
63+
fail_silently=True,
64+
)
65+
66+
return HttpResponseRedirect('?_cf_thanks=1')
67+
else:
68+
initial = {'subject': self.subject}
69+
if request.user.is_authenticated():
70+
initial['email'] = request.user.email
71+
initial['name'] = request.user.get_full_name()
72+
73+
form = self.form(initial=initial)
74+
75+
self.rendered_output = render_to_string(
76+
'content/contactform/form.html', {
77+
'content': self,
78+
'form': form,
79+
},
80+
context_instance=RequestContext(request))
81+
82+
def render(self, **kwargs):
83+
return getattr(self, 'rendered_output', '')

feincms/content/file/__init__.py

Whitespace-only changes.

feincms/content/file/models.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""
2+
Simple file inclusion content: You should probably use the media library
3+
instead.
4+
"""
5+
6+
from __future__ import absolute_import, unicode_literals
7+
8+
import os
9+
10+
from django.db import models
11+
from django.template.loader import render_to_string
12+
from django.utils.translation import ugettext_lazy as _
13+
14+
from feincms import settings
15+
16+
17+
class FileContent(models.Model):
18+
# You should probably use
19+
# `feincms.content.medialibrary.models.MediaFileContent` instead.
20+
21+
title = models.CharField(max_length=200)
22+
file = models.FileField(
23+
_('file'), max_length=255,
24+
upload_to=os.path.join(settings.FEINCMS_UPLOAD_PREFIX, 'filecontent'))
25+
26+
class Meta:
27+
abstract = True
28+
verbose_name = _('file')
29+
verbose_name_plural = _('files')
30+
31+
def render(self, **kwargs):
32+
return render_to_string(
33+
[
34+
'content/file/%s.html' % self.region,
35+
'content/file/default.html',
36+
],
37+
{'content': self},
38+
context_instance=kwargs.get('context'),
39+
)

feincms/content/image/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)