def get_queryset(self): search = self.request.GET.get('s', '') query = Content.objects.all() if search != '': words = primitivize_string(search).split(" ") for w in words: query = query.filter(primitive__contains=w) return query
def get_queryset(self): search = self.request.GET.get('s', '') query = Guide.objects.all() if search != '': words = primitivize_string(search).split(" ") for w in words: query = query.filter( Q(primitive__contains=w) | Q(items__exercise__primitive__contains=w) | Q(items__content__primitive__contains=w)) byuser = self.request.query_params.get('byuser', None) if byuser is not None: if byuser == 'me': query = query.filter(author=self.request.user.teacher) else: query = query.filter(author_id__exact=byuser) if self.action in ('list', ): query = [ x for x in query if x.not_priv_or_related(self.request.user) ] return query
def make_primitive(self): return primitivize_string(" ".join([str(self.unit), str(self.author), self.briefing]))
def make_primitive(self): return primitivize_string(" ".join( [str(self.subject), str(self.author), self.title, self.brief]))
def make_primitive(self): texts = self.parse_text() return primitivize_string(" ".join([ str(self.unit), str(self.author), self.title, self.summary, texts ]))