def render(self, context, instance, placeholder):
entries = Entry.published.all()<EOL>if instance.categories.count():<EOL><INDENT>cats = instance.categories.all()<EOL>if instance.subcategories:<EOL><INDENT>cats = itertools.chain(cats, *[c.get_descendants()<EOL>for c in cats])<EOL><DEDENT>entries = entries.filter(categories__in=cats)<EOL><DEDENT>if instance.authors.count():<EOL><INDENT>entries = entries.filter(authors__in=instance.authors.all())<EOL><DEDENT>if instance.tags.count():<EOL><INDENT>entries = TaggedItem.objects.get_union_by_model(<EOL>entries, instance.tags.all())<EOL><DEDENT>if instance.featured is not None:<EOL><INDENT>entries = entries.filter(featured=instance.featured)<EOL><DEDENT>entries = entries.distinct()<EOL>if instance.offset:<EOL><INDENT>entries = entries[instance.offset:]<EOL><DEDENT>if instance.number_of_entries:<EOL><INDENT>entries = entries[:instance.number_of_entries]<EOL><DEDENT>context = super(CMSLatestEntriesPlugin, self).render(<EOL>context, instance, placeholder)<EOL>context['<STR_LIT>'] = entries<EOL>return context<EOL>
Update the context with plugin's data