django-cms 2.4.rc1 PlaceholderField & TranslatableModel

33 views
Skip to first unread message

Razi Alsayyed

unread,
Apr 15, 2013, 3:49:56 PM4/15/13
to django-cms...@googlegroups.com
I have a TranslatableModel "django-hvad" like the following:

class News(TranslatableModel):
       
    pub_date = models.DateTimeField('Publish Date')
    published = models.BooleanField()
    featured = models.BooleanField()   
    translations = TranslatedFields(
        title = models.CharField(max_length=255),   
    )
    content = PlaceholderField('content_placeholder')

    def __unicode__(self):
        return self.title
       
I am trying to register this model in admin site but I do not know how. I tried:

admin.site.register(NewsItem, PlaceholderAdmin)

It works as expected except for the title field (it does not show up in the form)

I also tried:

admin.site.register(NewsItem, TranslatableAdmin)

I got an error:
Request Method: GET
Request URL: http://212.14.233.81:8000/en/admin/articles/news/1/
Django Version: 1.5.1
Exception Type: TypeError
Exception Value:
<lambda>() takes exactly 1 argument (2 given)
Exception Location: /home/razi/Development/Django1.5/src/cms/cms/forms/widgets.py in render, line 201

anyone know how to achieve this ? "having a translatedfield + placehoderfield in the admin site

Patrick Lauber

unread,
Apr 15, 2013, 4:57:34 PM4/15/13
to django-cms...@googlegroups.com
Have you tried with hvad 0.2 or from git? There where some changes to it that made it possible but we are still waiting for a release for 0.3.

And you need both… Placeholder Admin and TranslatableAdmin:

class MultilingualAdmin(TranslatableAdmin, PlaceholderAdmin):
pass

admin.site.register(News, MultilingualAdmin)

cheers

Pat
> --
> You received this message because you are subscribed to the Google Groups "django-cms-developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-cms-devel...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Reply all
Reply to author
Forward
0 new messages