Intuitive text editing for the Django Admin.
Project description
:warning: This project is in early development and has bugs, contribution is welcome.
# django-text
Intuitive text editing for the Django Admin.
## Installation
Install the package with pip.
```shell
$ pip install django-text
```
Add `text` to your installed packages.
```python
# settings.py
INSTALLED_APPS = (
# ...
'text',
)
```
Add `text.middleware.TextMiddleware` to your middleware.
```python
# settings.py
MIDDLEWARE = (
# ...
'text.middleware.TextMiddleware',
)
```
Run `migrate`.
```shell
$ python manage.py migrate
```
## Usage
### Template tags
Add `editable` tags to your templates. Beware this tag will show the name
of the text node if there is no corresponding text nodes in the database.
```html
<h1>{% editable header %}</h1>
<div class="content">
{% editable text_body %}
</div>
```
You can also use the `blockeditable` tag that let's you specify a default text
that will show up if there is no database entry.
```html
<div class="content">
<h1>
{% blockeditable header %}
Read My Awesome Text
{% endblockeditable %}
</h1>
{% blockeditable content %}
Put your default text here!
{% endblockeditable %}
</div>
```
The `blockeditable` tags works with translation tags inside of it. So if you already
have a translated site, you can wrap your content with this tag and only
add text nodes for some of the languages that you support.
### Content editing
![django-text in action](/docs/printscreen.png)
Now add text nodes with the corresponding names in the Django Admin. Currently raw text and [markdown](http://daringfireball.net/projects/markdown/) is supported.
Missing text nodes will be added to the database automatically when their
template tags are rendered. Blocktags will be added with their default
text and inline tags will be added with the name of the node as the text content.
To disable automatic updating of missing text nodes add the following to your settings.
```python
AUTOPOPULATE_TEXT = False
```
## License
Copyright (c) 2015 Anton Agestam. django-text is released under the MIT license.
See the LICENSE file for more information and licenses for bundled code.
# django-text
Intuitive text editing for the Django Admin.
## Installation
Install the package with pip.
```shell
$ pip install django-text
```
Add `text` to your installed packages.
```python
# settings.py
INSTALLED_APPS = (
# ...
'text',
)
```
Add `text.middleware.TextMiddleware` to your middleware.
```python
# settings.py
MIDDLEWARE = (
# ...
'text.middleware.TextMiddleware',
)
```
Run `migrate`.
```shell
$ python manage.py migrate
```
## Usage
### Template tags
Add `editable` tags to your templates. Beware this tag will show the name
of the text node if there is no corresponding text nodes in the database.
```html
<h1>{% editable header %}</h1>
<div class="content">
{% editable text_body %}
</div>
```
You can also use the `blockeditable` tag that let's you specify a default text
that will show up if there is no database entry.
```html
<div class="content">
<h1>
{% blockeditable header %}
Read My Awesome Text
{% endblockeditable %}
</h1>
{% blockeditable content %}
Put your default text here!
{% endblockeditable %}
</div>
```
The `blockeditable` tags works with translation tags inside of it. So if you already
have a translated site, you can wrap your content with this tag and only
add text nodes for some of the languages that you support.
### Content editing
![django-text in action](/docs/printscreen.png)
Now add text nodes with the corresponding names in the Django Admin. Currently raw text and [markdown](http://daringfireball.net/projects/markdown/) is supported.
Missing text nodes will be added to the database automatically when their
template tags are rendered. Blocktags will be added with their default
text and inline tags will be added with the name of the node as the text content.
To disable automatic updating of missing text nodes add the following to your settings.
```python
AUTOPOPULATE_TEXT = False
```
## License
Copyright (c) 2015 Anton Agestam. django-text is released under the MIT license.
See the LICENSE file for more information and licenses for bundled code.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-text-1.2.5.tar.gz
(86.6 kB
view details)
File details
Details for the file django-text-1.2.5.tar.gz
.
File metadata
- Download URL: django-text-1.2.5.tar.gz
- Upload date:
- Size: 86.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 251c343443bd453b7c9643e0e96c6d41dd843498809fd37e940426d2ac6e2b82 |
|
MD5 | 300c1213a4e4159230151b4a99256682 |
|
BLAKE2b-256 | 43caaa12d0f85a4585657cf0b14c8f20537f01f403f6f2800e152508e64ebb74 |