示例#1
0
    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")
示例#2
0
    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")
示例#3
0
文件: raw_data.py 项目: yeleman/dmd
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)
示例#4
0
文件: raw_data.py 项目: yeleman/dmd
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)