<commit_before># django-conman

[![Coverage Status](https://img.shields.io/coveralls/meshy/django-conman.svg)](https://coveralls.io/r/meshy/django-conman) [![Build Status](https://travis-ci.org/meshy/django-conman.svg?branch=master)](https://travis-ci.org/meshy/django-conman) [![Requirements Status](https://requires.io/github/meshy/django-conman/requirements.svg?branch=master)](https://requires.io/github/meshy/django-conman/requirements/?branch=master)


A CONtent MANagement system for Django. (Get it?)

Sponsored by [Incuna](http://incuna.com/).

## Requirements

Tested against:
- Python 3.4, 3.5, 3.6
- Django >=1.10

Requires (should be automatically installed if using `pip`):
- `django-polymorphic`

## Install

```bash
# From PyPI...
pip install django-conman

# ...or from source
pip install -e git+https://github.com/meshy/django-conman.git#egg=conman
```

## Configure
```python
# settings.py
INSTALLED_APPS += ['conman.routes']

# urls.py
urlpatterns = [
    # All other URLS should go above this catch-all.
    url(r'', include('conman.routes.urls')),
]
```

## Basic custom app
```python
# models.py
class ExampleRoute(conman.routes.models.Route):
    # Your data/fields here
    ...
    view = ExampleRouteDetail.as_view()

# views.py
class ExampleRouteDetail(django.views.generic.DetailView):
    def get_object(self):
        return self.kwargs['route']
```<commit_msg>Simplify and explain example in README<commit_after># django-conman

[![Coverage Status](https://img.shields.io/coveralls/meshy/django-conman.svg)](https://coveralls.io/r/meshy/django-conman) [![Build Status](https://travis-ci.org/meshy/django-conman.svg?branch=master)](https://travis-ci.org/meshy/django-conman) [![Requirements Status](https://requires.io/github/meshy/django-conman/requirements.svg?branch=master)](https://requires.io/github/meshy/django-conman/requirements/?branch=master)


A CONtent MANagement system for Django. (Get it?)

Sponsored by [Incuna](http://incuna.com/).

## Requirements

Tested against:
- Python 3.4, 3.5, 3.6
- Django >=1.10

Requires (should be automatically installed if using `pip`):
- `django-polymorphic`

## Install

```bash
# From PyPI...
pip install django-conman

# ...or from source
pip install -e git+https://github.com/meshy/django-conman.git#egg=conman
```

## Configure
```python
# settings.py
INSTALLED_APPS += ['conman.routes']

# urls.py
urlpatterns = [
    # All other URLS should go above this catch-all.
    url(r'', include('conman.routes.urls')),
]
```

## Basic custom app

In the following example, `MyRoute.trusted_content` contains HTML that is safe
to be rendered directly into a template. Only use [`|safe`][django-safe] with
extreme caution in your own projects.

```python
# my_template.html
{{ route.trusted_content|safe }}


# views.py
from django.shortcuts import render

def my_view(request, route):
    return render('my_template.html', {'route': route})


# models.py
from conman.routes.models import Route
from . import views

class MyRoute(Route):
    trusted_content = models.TextField()

    view = views.my_view
```

A more complex example might use a rich text field such as the `HTMLField` from
[djagno-tinymce][django-tinymce], and be careful to sanitise the HTML with
[bleach][bleach].

[django-safe]: https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#safe
[django-tinymce]: https://github.com/aljosa/django-tinymce
[bleach]: https://github.com/mozilla/bleach
{'fraction_non_alphanumeric': 0.1579100145137881, 'fraction_numerical': 0.005805515239477504, 'mean_word_length': 4.576051779935275, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 17, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '2782931', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1166, 'n_words': 250}