예제 #1
0
파일: views.py 프로젝트: odtvince/udata
def discussions_csv(org):
    datasets = Dataset.objects.filter(organization=str(org.id))
    discussions = [Discussion.objects.filter(subject=dataset)
                   for dataset in datasets]
    # Turns a list of lists into a flat list.
    adapter = IssuesOrDiscussionCsvAdapter(itertools.chain(*discussions))
    return csv.stream(adapter, '{0}-discussions'.format(org.slug))
예제 #2
0
def discussions_csv(org):
    datasets = Dataset.objects.filter(organization=str(org.id))
    discussions = [DatasetDiscussion.objects.filter(subject=dataset)
                   for dataset in datasets]
    # Turns a list of lists into a flat list.
    adapter = IssuesOrDiscussionCsvAdapter(itertools.chain(*discussions))
    return csv.stream(adapter, '{0}-discussions'.format(org.slug))
예제 #3
0
def organizations_csv():
    params = multi_to_dict(request.args)
    # redirect to EXPORT_CSV dataset if feature is enabled and no filter is set
    exported_models = current_app.config.get('EXPORT_CSV_MODELS', [])
    if not params and 'organization' in exported_models:
        return redirect(get_export_url('organization'))
    params['facets'] = False
    organizations = search.iter(Organization, **params)
    return csv.stream(OrganizationCsvAdapter(organizations), 'organizations')
예제 #4
0
파일: views.py 프로젝트: opendatateam/udata
def organizations_csv():
    params = multi_to_dict(request.args)
    # redirect to EXPORT_CSV dataset if feature is enabled and no filter is set
    exported_models = current_app.config.get('EXPORT_CSV_MODELS', [])
    if not params and 'organization' in exported_models:
        return redirect(get_export_url('organization'))
    params['facets'] = False
    organizations = search.iter(Organization, **params)
    return csv.stream(OrganizationCsvAdapter(organizations), 'organizations')
예제 #5
0
파일: views.py 프로젝트: opendatateam/udata
def reuses_csv():
    params = multi_to_dict(request.args)
    # redirect to EXPORT_CSV dataset if feature is enabled and no filter is set
    exported_models = current_app.config.get('EXPORT_CSV_MODELS', [])
    if not params and 'reuse' in exported_models:
        return redirect(get_export_url('reuse'))
    params['facets'] = False
    reuses = search.iter(Reuse, **params)
    return csv.stream(ReuseCsvAdapter(reuses), 'reuses')
예제 #6
0
def reuses_csv():
    params = multi_to_dict(request.args)
    # redirect to EXPORT_CSV dataset if feature is enabled and no filter is set
    exported_models = current_app.config.get('EXPORT_CSV_MODELS', [])
    if not params and 'reuse' in exported_models:
        return redirect(get_export_url('reuse'))
    params['facets'] = False
    reuses = search.iter(Reuse, **params)
    return csv.stream(ReuseCsvAdapter(reuses), 'reuses')
예제 #7
0
파일: views.py 프로젝트: opendatateam/udata
def datasets_csv():
    params = multi_to_dict(request.args)
    # redirect to EXPORT_CSV dataset if feature is enabled and no filter is set
    exported_models = current_app.config.get('EXPORT_CSV_MODELS', [])
    if not params and 'dataset' in exported_models:
        return redirect(get_export_url('dataset'))
    params['facets'] = False
    datasets = search.iter(Dataset, **params)
    adapter = csv.get_adapter(Dataset)
    return csv.stream(adapter(datasets), 'datasets')
예제 #8
0
def datasets_csv():
    params = multi_to_dict(request.args)
    # redirect to EXPORT_CSV dataset if feature is enabled and no filter is set
    exported_models = current_app.config.get('EXPORT_CSV_MODELS', [])
    if not params and 'dataset' in exported_models:
        return redirect(get_export_url('dataset'))
    params['facets'] = False
    datasets = search.iter(Dataset, **params)
    adapter = csv.get_adapter(Dataset)
    return csv.stream(adapter(datasets), 'datasets')
예제 #9
0
파일: views.py 프로젝트: odtvince/udata
def datasets_resources_csv(org):
    datasets = search.iter(Dataset, organization=str(org.id))
    adapter = ResourcesCsvAdapter(datasets)
    return csv.stream(adapter, '{0}-datasets-resources'.format(org.slug))
예제 #10
0
def from_nested():
    qs = Fake.objects
    return csv.stream(NestedAdapter(qs))
예제 #11
0
파일: views.py 프로젝트: rfResearch/udata
def datasets_resources_csv(org):
    datasets = search.iter(Dataset, organization=str(org.id))
    adapter = ResourcesCsvAdapter(datasets)
    return csv.stream(adapter, '{0}-datasets-resources'.format(org.slug))
예제 #12
0
파일: views.py 프로젝트: odtvince/udata
def datasets_csv():
    params = multi_to_dict(request.args)
    params['facets'] = False
    datasets = search.iter(Dataset, **params)
    adapter = csv.get_adapter(Dataset)
    return csv.stream(adapter(datasets), 'datasets')
예제 #13
0
파일: views.py 프로젝트: ndebeiss/udata
def datasets_csv():
    params = multi_to_dict(request.args)
    params['facets'] = False
    datasets = search.iter(Dataset, **params)
    adapter = csv.get_adapter(Dataset)
    return csv.stream(adapter(datasets), 'datasets')
예제 #14
0
파일: views.py 프로젝트: ndebeiss/udata
def organizations_csv():
    params = multi_to_dict(request.args)
    params['facets'] = False
    organizations = search.iter(Organization, **params)
    return csv.stream(OrganizationCsvAdapter(organizations), 'organizations')
예제 #15
0
파일: test_csv.py 프로젝트: odtvince/udata
def from_nested():
    qs = Fake.objects
    return csv.stream(NestedAdapter(qs))
예제 #16
0
def from_list():
    return csv.stream(list(Fake.objects))
예제 #17
0
def supplied_datasets_resources_csv(org):
    datasets = Dataset.objects.filter(supplier=str(org.id))
    adapter = ResourcesCsvAdapter(datasets)
    return csv.stream(adapter,
                      '{0}-supplied-datasets-resources'.format(org.slug))
예제 #18
0
파일: test_csv.py 프로젝트: odtvince/udata
def from_queryset():
    qs = Fake.objects
    assert isinstance(qs, db.BaseQuerySet)
    return csv.stream(qs)
예제 #19
0
파일: views.py 프로젝트: revolunet/udata
def tags_csv():
    adapter = TagCsvAdapter(Tag.objects.order_by('-total'))
    return csv.stream(adapter, 'tags')
예제 #20
0
파일: views.py 프로젝트: odtvince/udata
def organizations_csv():
    params = multi_to_dict(request.args)
    params['facets'] = False
    organizations = search.iter(Organization, **params)
    return csv.stream(OrganizationCsvAdapter(organizations), 'organizations')
예제 #21
0
파일: views.py 프로젝트: odtvince/udata
def resources_csv():
    params = multi_to_dict(request.args)
    params['facets'] = False
    datasets = search.iter(Dataset, **params)
    return csv.stream(ResourcesCsvAdapter(datasets), 'resources')
예제 #22
0
def with_basename():
    cls = csv.get_adapter(Fake)
    adapter = cls(Fake.objects)
    return csv.stream(adapter, 'test')
예제 #23
0
파일: views.py 프로젝트: anukat2015/udata
def tags_csv():
    adapter = TagCsvAdapter(Tag.objects.order_by('-total'))
    return csv.stream(adapter, 'tags')
예제 #24
0
def from_adapter():
    cls = csv.get_adapter(Fake)
    adapter = cls(Fake.objects)
    return csv.stream(adapter)
예제 #25
0
파일: views.py 프로젝트: opendatalu/udata
def datasets_csv(org):
    datasets = search.iter(Dataset, organization=str(org.id))
    adapter = DatasetCsvAdapter(datasets)
    return csv.stream(adapter, "{0}-datasets".format(org.slug))
예제 #26
0
def from_queryset():
    qs = Fake.objects
    assert isinstance(qs, db.BaseQuerySet)
    return csv.stream(qs)
예제 #27
0
파일: test_csv.py 프로젝트: odtvince/udata
def from_list():
    return csv.stream(list(Fake.objects))
예제 #28
0
파일: views.py 프로젝트: ndebeiss/udata
def resources_csv():
    params = multi_to_dict(request.args)
    params['facets'] = False
    datasets = search.iter(Dataset, **params)
    return csv.stream(ResourcesCsvAdapter(datasets), 'resources')
예제 #29
0
파일: views.py 프로젝트: noirbizarre/udata
def supplied_datasets_resources_csv(org):
    datasets = Dataset.objects.filter(supplier=str(org.id))
    adapter = ResourcesCsvAdapter(datasets)
    return csv.stream(adapter,
                      '{0}-supplied-datasets-resources'.format(org.slug))
예제 #30
0
파일: views.py 프로젝트: ndebeiss/udata
def reuses_csv():
    params = multi_to_dict(request.args)
    params['facets'] = False
    reuses = search.iter(Reuse, **params)
    return csv.stream(ReuseCsvAdapter(reuses), 'reuses')
예제 #31
0
def supplied_datasets_resources_csv(org):
    datasets = search.iter(Dataset, supplier=str(org.id))
    adapter = ResourcesCsvAdapter(datasets)
    return csv.stream(adapter,
                      '{0}-supplied-datasets-resources'.format(org.slug))
예제 #32
0
파일: test_csv.py 프로젝트: odtvince/udata
def with_basename():
    cls = csv.get_adapter(Fake)
    adapter = cls(Fake.objects)
    return csv.stream(adapter, 'test')
예제 #33
0
파일: views.py 프로젝트: odtvince/udata
def reuses_csv():
    params = multi_to_dict(request.args)
    params['facets'] = False
    reuses = search.iter(Reuse, **params)
    return csv.stream(ReuseCsvAdapter(reuses), 'reuses')
예제 #34
0
파일: test_csv.py 프로젝트: odtvince/udata
def from_adapter():
    cls = csv.get_adapter(Fake)
    adapter = cls(Fake.objects)
    return csv.stream(adapter)
예제 #35
0
파일: views.py 프로젝트: guillo-w/udata
def supplied_datasets_resources_csv(org):
    datasets = search.iter(Dataset, supplier=str(org.id))
    adapter = ResourcesCsvAdapter(datasets)
    return csv.stream(adapter, '{0}-supplied-datasets-resources'.format(org.slug))