On Nov 12, 3:52 pm, Ivan Sagalaev <[EMAIL PROTECTED]> wrote:
> Container
> |
> +---- Thing ---- ImageThing
> |
> +---- Thing ---- TextThing
>
> In code this will look like this:
[...]
> Then you can add a fancy methods to Thing that will return its typed
> counterpart (sorta "polymorphism"):
>
> class Thing(models.Model):
> ...
> def data(self):
> return getattr(self, 'image_thing', None) or \
> getattr(self, 'text_thing', None) or \
> getattr(self, 'another_thing')
>
> def __str__(self):
> return str(self.data())
This is a very neat idea.
Two questions arise for me as a Django newbie:
- How do I convince django.contrib.admin to edit "*thing" contents
inline?
- What's the preferred method to implement a tree view for the
resulting structure in admin (for example in the sidebar on the right)?
Regards,
/k
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---