This package marries Django with CodeMirror
Project description
This package marries Django with CodeMirror.
rationale
You can enable vim mode :)
usage
installation
This is a standard Python 3 package without dependencies (apart from Django itself) offered at the Cheese Shop:
# usually inside a virtual environment pip install django-mirror
And then you have to add django_mirror to the INSTALLED_APPS setting of your Django project.
widget
To django-mirror textarea is provided as a form widget:
from django import forms from django_mirror.widgets import MirrorTextarea class CommentForm(forms.Form): text = forms.CharField(widget=MirrorTextarea(mode='markdown'))
admin
To use the django-mirror textarea widget in the admin panel you can subclass the respective model form. But you can also use the admin mixin provided by the library:
from django.contrib import admin from django_mirror.admin import MirrorAdmin from weblog.models import Comment @admin.register(Comment) class CommentAdmin(MirrorAdmin, admin.ModelAdmin): mirror_fields = ('comment',) # default options mirror_fields = ( # with custom options ('comment', { 'mode': 'markdown', }) )
uploads
licence
GPL. You can do what you want with this code as long as you let others do the same.
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-mirror-0.1.1.tar.gz
(432.4 kB
view hashes)
Built Distribution
django_mirror-0.1.1-py3-none-any.whl
(533.6 kB
view hashes)
Close
Hashes for django_mirror-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fd4a55f35d629f03c185f0f9a6ba5102ea62433269b46149e8e98472d26ce8a |
|
MD5 | d71237630ea68d2564759372c3bb62d5 |
|
BLAKE2b-256 | 309892e98c66b83bd8711333016d80e4a578e6395decb8c2420e6a4933966d9f |