Skip to main content

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


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.0.tar.gz (432.3 kB view details)

Uploaded Source

Built Distribution

django_mirror-0.1.0-py3-none-any.whl (533.6 kB view details)

Uploaded Python 3

File details

Details for the file django-mirror-0.1.0.tar.gz.

File metadata

  • Download URL: django-mirror-0.1.0.tar.gz
  • Upload date:
  • Size: 432.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9

File hashes

Hashes for django-mirror-0.1.0.tar.gz
Algorithm Hash digest
SHA256 af824ce079cae2c010fae57ffcafce312f12d76cfca46c421f78136cae08aaf6
MD5 8ef88428d57f2edf7d856dad776df16d
BLAKE2b-256 ad0ba93ab7e365f2946f3e914c74cfd4e30d4ad0d5ae02fd75f5aaf60b57bfe8

See more details on using hashes here.

Provenance

File details

Details for the file django_mirror-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: django_mirror-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 533.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9

File hashes

Hashes for django_mirror-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 def03c6e64eed71aa7758cc3d5ee5f9820a527d945563855b51b8332f1a3e688
MD5 e64130298ab51f1d1087f31cfe2dea52
BLAKE2b-256 07a3910dffb8d0866e6369edca77b9e6f3c701fd6a81412795baed6f7ed4fc3c

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page