<commit_before># Django import data

**Django import data** is a command-line tool for importing XML and HTML data to django models via XSLT mapping.

Source code is located here - [https://github.com/lev-veshnyakov/django-import-data](https://github.com/lev-veshnyakov/django-import-data).

## Basic features

Django import data can take any XML or HTML source file or URL as an input and save entities from it to the django models without need to modify an existing code.

It also supports saving of a related data in form one-to-many and many-to-many.

## Dependencies

It uses [lxml](http://lxml.de) library for all xml manipulations.

## Installation

First you need to install dependencies for lxml library:

```bash
sudo apt-get install libxml2-dev libxslt-dev python-dev
```

Then install django-import-data using pip:

```bash
pip install django-import-data
```

If you want the latest version you can install it from Github:

```bash
pip install git+https://github.com/lev-veshnyakov/django-import-data
```

## Usage

**Django import data** is a management command-line tool, that can be used from the code as well.

Too see the list of console commands type:

```bash
python manage.py help
```

In the output you will find data_import section like below:

```bash
[data_import]
    process_xslt<commit_msg>Change index.md<commit_after># Django import data

**Django import data** is a command-line tool for importing XML and HTML data to django models via XSLT mapping.

Source code is located here - [https://github.com/lev-veshnyakov/django-import-data](https://github.com/lev-veshnyakov/django-import-data).

## Basic features

Django import data can take any XML or HTML source file or URL as an input and save entities from it to the django models without need to modify an existing code.

It also supports saving of a related data in form one-to-many and many-to-many.

## Dependencies

It uses [lxml](http://lxml.de) library for all xml manipulations.

## Installation

First you need to install dependencies for lxml library:

```bash
sudo apt-get install libxml2-dev libxslt-dev python-dev
```

Then install django-import-data using pip:

```bash
pip install django-import-data
```

If you want the latest version you can install it from Github:

```bash
pip install git+https://github.com/lev-veshnyakov/django-import-data
```

Add import_data to INSTALLED_APPS:

```python
INSTALLED_APPS = [
    ...
    'import_data',
]
```

## Usage

**Django import data** is a management command-line tool, that can be used from the code as well.

Too see the list of console commands type:

```bash
python manage.py help
```

In the output you will find data_import section like below:

```bash
[data_import]
    process_xslt
{'fraction_non_alphanumeric': 0.09177330895795247, 'fraction_numerical': 0.0007312614259597807, 'mean_word_length': 4.162264150943396, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2521633', 'n_tokens_mistral': 850, 'n_tokens_neox': 798, 'n_words': 347}