Alex Gaynor wrote:
> 
> 
> On Tue, Feb 24, 2009 at 2:10 PM, Jay Deiman <j...@splitstreams.com 
> <mailto:j...@splitstreams.com>> wrote:
> 
> 
>     Jay Deiman wrote:
>      > The example of the "Comparison" Model in the second link is, at first
>      > glance, *exactly* what I am looking to do.  I think I'm going to
>     dig in
>      > tomorrow and experiment with this configuration, but it looks
>     like this
>      > will be perfect for my needs.
> 
>     Indeed, that example is exactly what I need.  On a somewhat related
>     note, is there a way to reflectively get the names of all my defined
>     models within a particular app?  For example, say I have the following
>     set up:
> 
>     project: proj1
>     app (within proj1): app1
> 
>     and in the models.py file in app1, I have
> 
>     class Mod1(models.Model):
>     ...
> 
>     class Mod2(models.Model):
>     ...
> 
>     So, is there a clean way of getting all the defined classes via
>     proj1.app1.models?  I know I could just use dir(), but that gives me
>     other stuff beyond just the models defined just within that file.
> 
>     Jay
> 
>     --
>     Jay Deiman
> 
>     \033:wq!
> 
> 
> 
> Note that the following uses what is technically an internal:
> from django.db.models.loading import cache
> module = cache.get_app('app_name')
> list_of_models = cache.get_models(module)
> 
> Alex

That is perfect!  Thanks Alex.

Jay

-- 
Jay Deiman

\033:wq!

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