Hallöchen!

Bastian Kuberek writes:

> [...]
>
> What I need is to be able to query the Widget class and get back
> subclasses based on their type:
>
>>>> widgets = Widget.objects.all()
>>>> print widgets
> [<LineChart: 1>,<LineChart: 2>,<LineChart: 3>,<BarChart: 4>,<lineChart: 
> 5>,<ScatterChart: 6>]

We do this very reliably with
http://djangosnippets.org/snippets/2091/ but I find
https://github.com/carljm/django-model-utils/blob/master/README.rst
very interesting, too.

This is a frequently-requested feature with many implementations,
yet there is no canonical solution in Django, unfortunately.

Tschö,
Torsten.

-- 
Torsten Bronger    Jabber ID: torsten.bron...@jabber.rwth-aachen.de
                                  or http://bronger-jmp.appspot.com

-- 
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 
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