Repository
Download the module from:
http://gitlab.csn.uchile.cl/dpineda/csv2json
CSV to JSON
This module is a conversor from csv data to json.
The main goal is create a json file for Django models.
The csv must have the same fields as the django model
The fields related to another models uses the natural key. So every model must have a natural_key method.
The third argument
How to Install
Using pip
pip install django_csv2json
From the repository
python setup.py install
How to use
This modules dispose a class CSV2JSON, that requires a origin folder, a destiniy folder and a list of files. Every element from this list must be a dictionary with the keys "{model, file, field, opts}".
Also, there are a command to use on the command line.
csv2json --origin "./csn" --destiny "./json" --file_json "./files.json"
For help, type
csv2json --help
Campos de files.json
Debe contener un campo models con los modelos de Django que contengan campos en el csv, determinar sus llaves.
Debe contener el archivo file csv.
Debe contener el field del cual se transforma un slug (un string formateado a sencillo)
Debe contener un dciccionario con las opciones o formato específico a cada campo.
Debe incluirse un diccionario (vacío) o que contenga el cambio en el nombre de los campos de csv al modelo django.
fields = ["models", "file", "field", "opts", "switch"]
files = [
dict(zip(fields,({'organization.kindoforganization':{"logo","name","acronim", "url"}},
'kindoforganization.csv', 'name',
{"description": read_file}, {}))),
dict(zip(fields,({'organization.organizationinfo':{"name","description","url_wiki"}},
'organization.csv',
'name', {"kind": add_list}, {}))),
]
kwargs = {
'files': files,
'origin': './csv',
'destiny': './json'
}
CSV2JSON(**kwargs)
Metadata
Release files for django-csv2json 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django_csv2json-0.3.2.tar.gz | 10.2 kB | Without provenance | Details |
Release files / django_csv2json-0.3.2.tar.gz
| Download URL | django_csv2json-0.3.2.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8e84e95b295094ccc3e7caf5006dc7697cad955d090b08d5578f281781f92d9
|
|
BLAKE2b-256 checksum How to use checksums |
e4281f071a60210b1c1410a06b41fb212c50a93bbfc0ff1827d5937792c85d7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.8.3
|
Security for django-csv2json 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.