def handle(self, *args, **kwargs): # make sure we're at project root chdir_dmd() logger.info("Exporting all DataRecord to: {}" .format(settings.ALL_EXPORT_PATH)) qs = get_records() nb_records = qs.count() get_csv_for(qs, save_to=settings.ALL_EXPORT_PATH) logger.info("Exporting all DataRecord (XLS 1sheet/indicator) to {}" .format(settings.ALL_EXPORT_XLSX_PATH)) export_to_spreadsheet(qs, save_to=settings.ALL_EXPORT_XLSX_PATH) Metadata.update('nb_records', nb_records) logger.info("All done")
def handle(self, *args, **kwargs): # make sure we're at project root chdir_dmd() logger.info("Exporting all DataRecord to: {}".format( settings.ALL_EXPORT_PATH)) qs = get_records() nb_records = qs.count() get_csv_for(qs, save_to=settings.ALL_EXPORT_PATH) logger.info( "Exporting all DataRecord (XLS 1sheet/indicator) to {}".format( settings.ALL_EXPORT_XLSX_PATH)) export_to_spreadsheet(qs, save_to=settings.ALL_EXPORT_XLSX_PATH) Metadata.update('nb_records', nb_records) logger.info("All done")
def data_export(request, *args, **kwargs): context = {'page': 'export'} export = Metadata.get_or_none('nb_records') if export is not None: context.update({ 'nb_records': int(export.value), 'export_date': export.updated_on, 'export_fname': settings.ALL_EXPORT_FNAME, 'export_xlsx_fname': settings.ALL_EXPORT_XLSX_FNAME, }) return render(request, kwargs.get('template_name', 'export.html'), context)
def data_export(request, *args, **kwargs): context = {"page": "export"} export = Metadata.get_or_none("nb_records") if export is not None: context.update( { "nb_records": int(export.value), "export_date": export.updated_on, "export_fname": settings.ALL_EXPORT_FNAME, "export_xlsx_fname": settings.ALL_EXPORT_XLSX_FNAME, } ) return render(request, kwargs.get("template_name", "export.html"), context)