Permalink
Browse files

Merge branch 'release/0.6.0'

  • Loading branch information...
2 parents 4878a78 + 946f1fd commit 3ee056332d353900efa62bdad79158ecbdd19c54 @zerok committed Jan 13, 2012
Showing with 21 additions and 14 deletions.
  1. +4 −1 README.rst
  2. +3 −2 flatblocks/admin.py
  3. +1 −0 flatblocks/forms.py
  4. +4 −3 flatblocks/models.py
  5. +3 −2 flatblocks/urls.py
  6. +5 −4 flatblocks/views.py
  7. +1 −2 setup.py
View
5 README.rst
@@ -165,10 +165,13 @@ the `django-better-chunks`_ fork (``django.contrib.site``- and i18n-support).
Releases
--------
-0.6.0 (incoming):
+0.6.0:
* South support
* Installation and upgrade instructions
+ Note: This is primarily a transitional release to get South in here and
+ open this project up for some database changes in the future.
+
0.5.1
* Removed rendering of the content attribute from the admin list by Michael Fladischer
* PyBabel compatibility by Michael Fladischer
View
5 flatblocks/admin.py
@@ -1,8 +1,9 @@
from django.contrib import admin
from flatblocks.models import FlatBlock
-
+
+
class FlatBlockAdmin(admin.ModelAdmin):
- ordering = ['slug',]
+ ordering = ['slug', ]
list_display = ('slug', 'header')
search_fields = ('slug', 'header', 'content')
View
1 flatblocks/forms.py
@@ -2,6 +2,7 @@
from flatblocks.models import FlatBlock
+
class FlatBlockForm(ModelForm):
class Meta:
model = FlatBlock
View
7 flatblocks/models.py
@@ -11,17 +11,18 @@ class FlatBlock(models.Model):
basically a piece of content with a given name (slug) and an optional
title (header) which you can, for example, use in a sidebar of a website.
"""
- slug = models.CharField(max_length=255, unique=True,
+ slug = models.CharField(max_length=255, unique=True,
verbose_name=_('Slug'),
help_text=_("A unique name used for reference in the templates"))
header = models.CharField(blank=True, null=True, max_length=255,
verbose_name=_('Header'),
help_text=_("An optional header for this content"))
- content = models.TextField(verbose_name=_('Content'), blank=True, null=True)
+ content = models.TextField(verbose_name=_('Content'), blank=True,
+ null=True)
def __unicode__(self):
return u"%s" % (self.slug,)
-
+
def save(self, *args, **kwargs):
super(FlatBlock, self).save(*args, **kwargs)
# Now also invalidate the cache used in the templatetag
View
5 flatblocks/urls.py
@@ -1,7 +1,8 @@
-from django.conf.urls.defaults import *
+from django.conf.urls.defaults import patterns, url
from django.contrib.admin.views.decorators import staff_member_required
from flatblocks.views import edit
urlpatterns = patterns('',
- url('^edit/(?P<pk>\d+)/$', staff_member_required(edit), name='flatblocks-edit')
+ url('^edit/(?P<pk>\d+)/$', staff_member_required(edit),
+ name='flatblocks-edit')
)
View
9 flatblocks/views.py
@@ -1,6 +1,7 @@
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
-from django.http import HttpResponseRedirect, HttpResponseForbidden, HttpResponse
+from django.http import HttpResponseRedirect, HttpResponseForbidden,\
+ HttpResponse
from django.utils.translation import ugettext as _
from flatblocks.models import FlatBlock
@@ -17,7 +18,7 @@ def edit(request, pk, modelform_class=FlatBlockForm, permission_check=None,
keyword-argument.
The other entry point helps you check permissions: Pass a simple function
- via the ``permission_check`` keyword-argument in order to check
+ via the ``permission_check`` keyword-argument in order to check
permissions on the flatblock-level::
def my_perm_check(request, flatblock):
@@ -33,7 +34,7 @@ def my_perm_check(request, flatblock):
The contract here is pretty simple: If the function returns False, the
view will return HttpResponseForbidden. Otherwise it will pass. So if you
want to do some fancy redirects if the permissions are wrong, return your
- own HttpResponse-object/-subclass.
+ own HttpResponse-object/-subclass.
If everything is alright with the permissions, simply return True.
"""
@@ -47,7 +48,7 @@ def my_perm_check(request, flatblock):
session_key = 'flatblock.origin.%d' % (int(pk), )
if request.method == 'POST':
- origin = request.session.get(session_key,
+ origin = request.session.get(session_key,
request.META.get('HTTP_REFERER', '/'))
form = modelform_class(request.POST, instance=flatblock)
if form.is_valid():
View
3 setup.py
@@ -7,7 +7,7 @@
setup(
name = 'django-flatblocks',
- version = '0.5.1',
+ version = '0.6.0',
description = 'django-flatblocks acts like django.contrib.flatpages but '
'for parts of a page; like an editable help box you want '
'show alongside the main content.',
@@ -31,4 +31,3 @@
include_package_data = True,
zip_safe = False,
)
-

0 comments on commit 3ee0563

Please sign in to comment.