Esempio n. 1
0
    def get_query(self, *args, **kw):
        code = leading_item = req_code = year = equivs = None
        if len(args) == 1:
            code = args[0]
        elif len(args) == 2:
            code, year = args
        elif len(args) == 3:
            code, year, equivs = args

        if '-' in code:
            transfer_id = code
            self.single = True
            code = None
        if year is not None:
            year = int(year)
            if code is not None:
                if equivs is not None:
                    equiv_code = "E%s/%s" % (year, code)
                    lines = ChangeGroup.query(
                        ChangeGroup.equiv_code == equiv_code).order(
                            -ChangeGroup.date)
                else:
                    lines = ChangeGroup.query(
                        ChangeGroup.prefixes == code,
                        ChangeGroup.year == year).order(-ChangeGroup.date)
            else:
                lines = ChangeGroup.query(
                    ChangeGroup.transfer_ids == transfer_id,
                    ChangeGroup.year == year).order(-ChangeGroup.date)
        else:
            lines = ChangeGroup.query(
                ChangeGroup.prefixes == code).order(-ChangeGroup.date)
        return lines
Esempio n. 2
0
    def get_query(self,*args,**kw):
        code = leading_item = req_code = year = equivs = None
        if len(args) == 1:
            code = args[0]
        elif len(args) == 2:
            code, year = args
        elif len(args) == 3:
            code, year, equivs = args

        if '-' in code:
            transfer_id = code
            self.single = True
            code = None
        if year is not None:
            year = int(year)
            if code is not None:
                if equivs is not None:
                    equiv_code = "E%s/%s" % (year,code)
                    lines = ChangeGroup.query(ChangeGroup.equiv_code==equiv_code).order(-ChangeGroup.date)
                else:
                    lines = ChangeGroup.query(ChangeGroup.prefixes==code,ChangeGroup.year==year).order(-ChangeGroup.date)
            else:
                lines = ChangeGroup.query(ChangeGroup.transfer_ids==transfer_id,ChangeGroup.year==year).order(-ChangeGroup.date)
        else:
            lines = ChangeGroup.query(ChangeGroup.prefixes==code).order(-ChangeGroup.date)
        return lines
Esempio n. 3
0
 def get_query(self, *args, **kw):
     lines = ChangeGroup.query(
         ChangeGroup.pending == True).order(-ChangeGroup.date)
     return lines
Esempio n. 4
0
 def get_query(self,*args,**kw):
     lines = ChangeGroup.query(ChangeGroup.pending==True).order(-ChangeGroup.date)
     return lines