This package allows you to store and render Markdown content effortlessly, making it ideal for applications that require rich text input from users.
Project description
Django Markdown Model
Django Markdown Model is a Python project that provides a simple way to integrate a Markdown field into your Django models. This package allows you to store and render Markdown content effortlessly, making it ideal for applications that require rich text input from users.
Features
- MarkdownField: Easily store and manage Markdown content in your Django models.
- Simple Integration: Quick setup and integration into existing Django projects.
- Flexible Rendering: Supports various Markdown renderers for displaying content.
Installation
You can install this package via pip:
pip install django-markdown-model
Usage
To use this package in your Django project, follow these steps:
- Add django_markdown_model to your INSTALLED_APPS in your Django settings:
INSTALLED_APPS = [
...
'django_markdown_model',
]
- Create your models using MarkdownField:
from django.db import models
from django_markdown_model.fields import MarkdownField
class MyModel(models.Model):
title = models.CharField(max_length=200)
content = MarkdownField()
def __str__(self):
return self.title
- Use Abstract Model MarkdownModel:
from django.db import models
from django_markdown_model.fields import MarkdownField
class MyModel(MarkdownModel):
pass
-
Render Markdown in your templates:
Use a Markdown renderer (like markdown2 or mistune) to display the content:
<h1>{{ my_model.title }}</h1>
<div>{{ my_model.content|safe }}</div>
Example
See the examples/ directory for a complete example of how to use this package in a Django project.
Running Tests
Tests are under development.
Contributing
Contributions are welcome! Please submit a pull request or open an issue.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
Built Distribution
File details
Details for the file django-markdown-model-1.0.tar.gz
.
File metadata
- Download URL: django-markdown-model-1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 984b81552d0b23ee8ec00eeea8707ac2ba9ceec60858ac75cd1cea382962078e |
|
MD5 | ebd14f450bbbb1e9eaa92ec91bac6807 |
|
BLAKE2b-256 | f8a09c6e3e2fd5e4e3c2630db721fd85e2fdef8db3cf9f881d15cc4af23853c9 |
File details
Details for the file django_markdown_model-1.0-py3-none-any.whl
.
File metadata
- Download URL: django_markdown_model-1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43e27c3b0a2723ad0a8df49a7e94164cfd1109bef8a9a3cc6b4e819e8d75e55a |
|
MD5 | 8186ceb8fb929bdfe0cc9ccd8d48be3f |
|
BLAKE2b-256 | e506ce762faf11e4e3b5ac6c74f6a713213d5253c0857fbe0363dc2c6eb0b792 |