I found the (obvious) solution:

        def __init__(self, *args, **kwargs):
                super(Page, self).__init__(*args, **kwargs)
                subclasses = {
                        'blog' : BlogPage,
                        'log' : LogPage,
                        'index' : Page,
                }
                self.__class__ = subclasses[self.page_type.name]

Thanks,
Jan

On 18 Mai, 21:40, janedenone <janeden...@googlemail.com> wrote:
> Hi,
>
> I'd like to use proxy models to define different properties for
> different kinds of pages in my Django CMS. Which proxy model/class an
> object belongs to is based on a certain field's value. Before querying
> the database, my view cannot know which proxy model to use for
> instantiation.
>
> What is the preferred way to choose (and apply) the right proxy model
> after retrieving the object?
>
> - Jan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to