Bartek pisze:
> Hi all
> When I loop over sys.modules in templatetags/pobierz.py there's
> django.templatetags.photologue, so probably that's why "from
> photologue.models import Gallery" throws ImportException - there's  not
> models in django.templatetags.photologue
> 
> Anyway in sys.modules there's photologue.models as well.
> Is there any way to import models from photologue?
I found solution myself today which is:

localphotologue=sys.modules['photologue.models']
gals=localphotologue.Gallery.objects.all().order_by('?')[:4]


Is this the correct, pythonic way?


-- 
Bartosz Radwan
jid: bar...@sq9mev.info
spamtrap: http://sq9mev.info/spamtrap.html


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