Re: custom templatetags and problem with importing photologue.models - namespace collision?
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 -~--~~~~--~~--~--~---
custom templatetags and problem with importing photologue.models - namespace collision?
Hi all I've experienced problems with import photologue.models into my templatetag module. 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? It seems solution is easy, but I spent some time on it and got confused... All I want to do is inclusion tag that renders some objects from my models in flatpages... I've done it with my own models, the only problem is photologue. Thanks in advance. -- 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 -~--~~~~--~~--~--~---