Пример #1
0
    def handle(self, *apps, **options):
        """
        Handle the command
        """
        if not 1 <= len(apps) <= 2:
            print "Syntax : sesqlshortquery <query> [<order>]"
            sys.exit(1)

        query = eval(apps[0])
        order = len(apps) == 2 and eval(apps[1]) or None
        
        print shortquery(query, order).objs
Пример #2
0
    def handle(self, *apps, **options):
        """
        Handle the command
        """
        if not 1 <= len(apps) <= 2:
            print "Syntax : sesqlshortquery <query> [<order>]"
            sys.exit(1)

        query = eval(apps[0])
        order = len(apps) == 2 and eval(apps[1]) or None

        print shortquery(query, order).objs
Пример #3
0
 def handle_short(self):
     """
     Handle a short query
     """
     query = random.choice(self.queries)
     res = shortquery(query[1])
     return query[0] + " : %d results" % len(res)
Пример #4
0
 def get_context_data(self, **kwargs):
     q = self.request.GET.get('q')
     maps = []
     if q:
         maps = shortquery(Q(classname='Map') & Q(fulltext__containswords=q))
         maps = self.paginate(maps)
     kwargs.update({
         'maps': maps,
         'q': q
     })
     return kwargs