Skip to content
This repository has been archived by the owner on Dec 9, 2019. It is now read-only.

Commit

Permalink
Merge branch 'release/0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
zerok committed Jan 13, 2012
2 parents 4878a78 + 946f1fd commit 3ee0563
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 14 deletions.
5 changes: 4 additions & 1 deletion README.rst
Expand Up @@ -165,10 +165,13 @@ the `django-better-chunks`_ fork (``django.contrib.site``- and i18n-support).
Releases Releases
-------- --------


0.6.0 (incoming): 0.6.0:
* South support * South support
* Installation and upgrade instructions * 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 0.5.1
* Removed rendering of the content attribute from the admin list by Michael Fladischer * Removed rendering of the content attribute from the admin list by Michael Fladischer
* PyBabel compatibility by Michael Fladischer * PyBabel compatibility by Michael Fladischer
Expand Down
5 changes: 3 additions & 2 deletions flatblocks/admin.py
@@ -1,8 +1,9 @@
from django.contrib import admin from django.contrib import admin
from flatblocks.models import FlatBlock from flatblocks.models import FlatBlock



class FlatBlockAdmin(admin.ModelAdmin): class FlatBlockAdmin(admin.ModelAdmin):
ordering = ['slug',] ordering = ['slug', ]
list_display = ('slug', 'header') list_display = ('slug', 'header')
search_fields = ('slug', 'header', 'content') search_fields = ('slug', 'header', 'content')


Expand Down
1 change: 1 addition & 0 deletions flatblocks/forms.py
Expand Up @@ -2,6 +2,7 @@


from flatblocks.models import FlatBlock from flatblocks.models import FlatBlock



class FlatBlockForm(ModelForm): class FlatBlockForm(ModelForm):
class Meta: class Meta:
model = FlatBlock model = FlatBlock
Expand Down
7 changes: 4 additions & 3 deletions flatblocks/models.py
Expand Up @@ -11,17 +11,18 @@ class FlatBlock(models.Model):
basically a piece of content with a given name (slug) and an optional 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. 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'), verbose_name=_('Slug'),
help_text=_("A unique name used for reference in the templates")) help_text=_("A unique name used for reference in the templates"))
header = models.CharField(blank=True, null=True, max_length=255, header = models.CharField(blank=True, null=True, max_length=255,
verbose_name=_('Header'), verbose_name=_('Header'),
help_text=_("An optional header for this content")) 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): def __unicode__(self):
return u"%s" % (self.slug,) return u"%s" % (self.slug,)

def save(self, *args, **kwargs): def save(self, *args, **kwargs):
super(FlatBlock, self).save(*args, **kwargs) super(FlatBlock, self).save(*args, **kwargs)
# Now also invalidate the cache used in the templatetag # Now also invalidate the cache used in the templatetag
Expand Down
5 changes: 3 additions & 2 deletions 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 django.contrib.admin.views.decorators import staff_member_required
from flatblocks.views import edit from flatblocks.views import edit


urlpatterns = patterns('', 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')
) )
9 changes: 5 additions & 4 deletions flatblocks/views.py
@@ -1,6 +1,7 @@
from django.shortcuts import render_to_response, get_object_or_404 from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext 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 django.utils.translation import ugettext as _


from flatblocks.models import FlatBlock from flatblocks.models import FlatBlock
Expand All @@ -17,7 +18,7 @@ def edit(request, pk, modelform_class=FlatBlockForm, permission_check=None,
keyword-argument. keyword-argument.
The other entry point helps you check permissions: Pass a simple function 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:: permissions on the flatblock-level::
def my_perm_check(request, flatblock): def my_perm_check(request, flatblock):
Expand All @@ -33,7 +34,7 @@ def my_perm_check(request, flatblock):
The contract here is pretty simple: If the function returns False, the The contract here is pretty simple: If the function returns False, the
view will return HttpResponseForbidden. Otherwise it will pass. So if you view will return HttpResponseForbidden. Otherwise it will pass. So if you
want to do some fancy redirects if the permissions are wrong, return your 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. If everything is alright with the permissions, simply return True.
""" """
Expand All @@ -47,7 +48,7 @@ def my_perm_check(request, flatblock):


session_key = 'flatblock.origin.%d' % (int(pk), ) session_key = 'flatblock.origin.%d' % (int(pk), )
if request.method == 'POST': if request.method == 'POST':
origin = request.session.get(session_key, origin = request.session.get(session_key,
request.META.get('HTTP_REFERER', '/')) request.META.get('HTTP_REFERER', '/'))
form = modelform_class(request.POST, instance=flatblock) form = modelform_class(request.POST, instance=flatblock)
if form.is_valid(): if form.is_valid():
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Expand Up @@ -7,7 +7,7 @@


setup( setup(
name = 'django-flatblocks', name = 'django-flatblocks',
version = '0.5.1', version = '0.6.0',
description = 'django-flatblocks acts like django.contrib.flatpages but ' description = 'django-flatblocks acts like django.contrib.flatpages but '
'for parts of a page; like an editable help box you want ' 'for parts of a page; like an editable help box you want '
'show alongside the main content.', 'show alongside the main content.',
Expand All @@ -31,4 +31,3 @@
include_package_data = True, include_package_data = True,
zip_safe = False, zip_safe = False,
) )

0 comments on commit 3ee0563

Please sign in to comment.