django - Find visible plugins with multiple templates and static placeholders -


is there way check if plugin visible (published) anywhere in page? have multiple pages different templates each. these templates have different static placeholders have different plugins.

the problem plugins present on templates not activated , therefore don't want in query.

is there method show plugins visible on published pages? same question: there method show plugins appear on activated templates?

thank in advance.

edit: want because trying fill search database i.e. index.

there method on page model called is_published;

def is_published(self, language, force_reload=false):     return self.get_title_obj(language, false, force_reload=force_reload).published 

and can find page given cmsplugin object attached through it's placeholder.

so on filter of plugin do;

draft_objects = myplugin.objects.filter(placeholder__page__publisher_is_draft=true) live_objects = myplugin.objects.filter(placeholder__page__publisher_is_draft=false) 

as further example, have image gallery plugin added via 'gallery' placeholder. each gallery detail view offers links other image galleries associated same page;

# filter list of other galleries don't galleries # attached other pages. more_galleries = [     g g in galleries if (         g.placeholder.slot == u'gallery' ,         unicode(g.placeholder.page.id) == page_id     ) ] 

i'm not entirely sure mean 'activated templates' if mean templates in use on page, you'd have filter pages given template name first before filtering plugins based on pages. sounds complicated (big sql queries) & you'd need explain what/why you're wanting that.

edit

if it's search want - check out aldryn search search app written django cms devs.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -