feincms/feincms — Issue #249: Broken change_view in Django 1.4b
Author: alexgula
Created: 2012-02-23 11:55:17+00:00
State: open

In a recent build of Django change_view method signature was changed from

```python
def change_view(self, request, object_id, extra_context=None):
```

to

```python
def change_view(self, request, object_id, form_url='', extra_context=None):
```

If just reflect this change in admin/item_editor.py and page/models.py like this

```python
def change_view(self, request, object_id, form_url='', extra_context=None):
# Recognize frontend editing requests
# This is done here so that the developer does not need to add
# additional entries to # urls.py or something...
res = FRONTEND_EDITING_MATCHER.search(object_id)
if res:
return self._frontend_editing_view(
request, res.group(1), res.group(2), res.group(3))

context = {}
context.update(self.get_extra_context(request))
context.update(extra_context or {})
return super(ItemEditor, self).change_view(request, object_id, form_url, context)
```

and

```python
def change_view(self, request, object_id, form_url='', extra_context=None):
try:
return super(PageAdmin, self).change_view(request, object_id, form_url, extra_context)
except PermissionDenied:
from django.contrib import messages
messages.add_message(request, messages.ERROR, _("You don't have the necessary permissions to edit this object"))
return HttpResponseRedirect(reverse('admin:page_page_changelist'))
```

, it would break Django 1.3 code, I suspect.

I'm not sure if there is an idiomatic way to overcome this except using *args and **kwargs and somewhat complicated logic to extract parameters.