More than one placeholder on custom app

45 views
Skip to first unread message

Luke Crooks

unread,
Oct 31, 2013, 12:16:19 PM10/31/13
to django-cms...@googlegroups.com
With 3.0 I cannot seem to have two placeholders on the same model.

placeholder1 = PlaceholderField('placeholder1')
placeholder2 = PlaceholderField('placeholder2')


When I do, I get the error:

products.accessory: Accessor for field 'placeholder2' clashes with related field 'Placeholder.accessory_set'. Add a related_name argument to the definition for 'placeholder2'.

So I try and add a related name to one (or both)

placeholder1 = PlaceholderField('placeholder1')
placeholder2 = PlaceholderField('placeholder2', related_name="randomname")

"products.accessory: Reverse query name for field 'placeholder2' clashes with related field 'Placeholder.randomname'. Add a related_name argument to the definition for 'placeholder2'."

I seem to remember reading somewhere that related_name doesn't work with placeholders, so I tried using slots instead (and get the same error as 1st case, which makes sense):

def slot1(instance):
    return 'placeholder1'

def slot2(instance):
    return 'placeholder2'

placeholder1 = PlaceholderField(slot1)
placeholder2 = PlaceholderField(slot2)

products.accessory: Accessor for field 'placeholder2' clashes with related field 'Placeholder.accessory_set'. Add a related_name argument to the definition for 'placeholder2'.

Is anyone else able to confirm this? As before I start hacking away at the core code, I want to make sure it's just not me, thanks :-)

Luke Crooks

unread,
Oct 31, 2013, 12:29:11 PM10/31/13
to django-cms...@googlegroups.com
Forgot to mention I was using model inheritance, not that it should matter.

Sachit Adhikari

unread,
Dec 17, 2013, 2:18:31 AM12/17/13
to django-cms...@googlegroups.com
Do like this:

placeholder1 = PlaceholderField(related_name="slot1")
placeholder2 = PlaceholderField(related_name="slot2")
Reply all
Reply to author
Forward
0 new messages