PlaceholderAdmin throws <lambda> () takes exactly 1 argument (2 given)
I wrote a django-cms plugin that has its own model with one PlaceholderField. When I add PlaceholderAdmin for the model admin, I get this on the admin site:
Exception Type: TemplateSyntaxError
Exception Value:
Caught TypeError while rendering: <lambda>() takes exactly 1 argument (2 given)
Exception Location: <blablapath>/python2.6/site-packages/cms/forms/widgets.py in render, line 199
I was looking for a solution and found only some problems with the django-cms example, which did not start without uncommenting any path in urls.py, so I assume this could be a problem with the urls, especially that I do the magic in my URLs The question arises: what conditions should be in place for django-cms url? Any ideas? Any solutions? Has anyone had this problem before?
, PlaceholderAdminField .
:
from cms.admin.placeholderadmin import PlaceholderAdmin
from cms.models.fields import PlaceholderField
class MyModel(models.Model):
name = models.CharField(max_length=100)
sidebar = PlaceholderField('sidebar')
class MyAdmin(PlaceholderAdmin):
""" Put your usual admin stuff here. If you use fieldset,
include the sidebar as its own tuple """
fieldsets = (
(None, {
'fields': ('name',),
}),
('Sidebar', {
'classes': ('plugin-holder', 'plugin-holder-nopage'),
'fields': ('sidebar',)
}),
)
admin.site.register(MyModel, MyAdmin)
Ok. . , , , , ;). :
def formfield_for_dbfield(self, db_field, **kwargs):
...
which replaced one text box with the TinyMCE editor. When I deleted the whole method, the problem disappeared. If I have time later, perhaps I will try to delve into it a little deeper. I'm still not sure if this is the only problem. I have a hunch that this could also be something with data, because I filled the placeholder with a text plugin from the code.
Hope this helps.