Exemple #1
0
 def _get_sortcrits(self, content_type, scrits=[]):        
     self.fnum += 1
     r = Report(name='test%d' % self.fnum, content_type=content_type)
     r.save()        
     for pos, sc in enumerate(scrits):
         SortCriterium(report=r, index=pos, fieldname=sc[0], order=sc[1]).save()
     return r                
Exemple #2
0
 def _get_filter(self, content_type, fcrits=[], as_parameter=False):
     """
     shortcut to get filter easily
     """
     self.fnum += 1
     r = Report(name='test%d' % self.fnum, content_type=content_type)        
     r.save()        
     for fc in fcrits:
         if len(fc)==6:
             FilterCriterium(report=r, type=fc[0], operator=fc[1], fieldname=fc[2], as_param=fc[3], value=fc[4], value_hi=fc[5]).save()
         else:                
             FilterCriterium(report=r, type=fc[0], operator=fc[1], fieldname=fc[2], as_param=fc[3], value=fc[4]).save()
     
     return r
Exemple #3
0
 def setUp(self):
     create_library()
     r = Report(name='books', content_type=ContentType.objects.get_for_model(Book))
     r.save()