Disculpame si formo desorden aqui pero es que no se a lo mejor la solucion esta aqui, esta clase que pongo tambien es para los reportes en Excel y es donde viene el metodo AddQuerySet(). No se si esta informacion es util, a lo mejor si.
Código Python:
Ver originalclass BaseReport(BaseDump):
"""
Abstract BaseReport Class used by various reports
"""
def __init__(self):
super(BaseReport, self).__init__()
self.grids = {}
self.current_sheet = None
self.current_x = self.current_y = 0
self.report_style = ReportStyle()
self.sheetcount = 0
self.formatter = {}
def add_one_instance(self,inst,orientation,addheader=False):
"""
Deprecated. Votovox is using this.
"""
self.addQuerySet(inst,orientation,addheader)
def addQuerySet(self,inst,orientation,addheader=False):
self.grids[self.current_sheet] = Grid()
self.current_x = self.current_y = 0
self.report_style.set_orientation(orientation)
headersadded = False
for i in inst:
if addheader and not headersadded:
self.django_dump_obj(i,headers=True)
headersadded = True
self.django_dump_obj(i)
@accepts(object,object)
def addFormatter(self,formatter):
self.formatter[self.current_sheet] = formatter
def getFormatter(self):
return self.formatter
formatters = {}
def __get_format(self,key):
if self.formatters.has_key(key):
return self.formatters[key]
elif self.formatters.has_key("DEFAULT"):
return self.formatters["DEFAULT"]
return u''
@accepts(object,Item)
def get_format(self,item):
format = self.__get_format(item.get_type())
if callable(format):
return format(item)
return format
def addSheet(self,name=None):
self.sheetcount += 1
if name == None:
name = "Untitled Sheet #%s" % self.sheetcount
self.current_sheet = name
self.filters[self.current_sheet] = {}
self.formatter[self.current_sheet] = {}