Skip to main content
Help us improve Python packaging – donate today!

A django app that allows the easy addition of Stack Overflow's 'PageDown' markdown editor to a django form field

Project Description

Django Pagedown

A django app that allows the easy addition of [Stack Overflow's "Pagedown" Markdown editor]( to a django form field, whether in a custom app or the Django Admin


![Screenshot of Django Admin with Pagedown initialised]( "A screenshot of Pagedown in Django's admin")


#### Installation ####

1. Get the code: `pip install django-pagedown`
2. Add `pagedown` to your `INSTALLED_APPS`
3. Make sure to collect the static files: `python collectstatic --noinput`

Note that this package will install a cloned copy (git submodule)of the Pagedown library from [](

If you don't like (or are having problems with) PyPi, you can alternatively install:

- Via pip from GitHub: `pip install -e`
- Manually clone from Github:
- `git clone`
- `cd django-pagedown`
- `git submodule update --init`


#### Usage ####

**Inside the Django Admin:**

If you want to use the pagedown editor in a django admin field, there are numerous possible approaches:

To use it in **all** `TextField`'s in you admin form:

from pagedown.widgets import AdminPagedownWidget
from django.db import models

class FooModelAdmin(models.ModelAdmin):
formfield_overrides = {
models.TextField: {'widget': AdminPagedownWidget },

Alternatively, to only use it on particular fields, first create a form (in ``):

from pagedown.widgets import AdminPagedownWidget
from django import forms
from models import FooModel

class FooModelForm(forms.ModelForm):
a_text_field = forms.CharField(widget=AdminPagedownWidget())
another_text_field = forms.CharField(widget=AdminPagedownWidget())

class Meta:
model = FooModel

and in your ``:

from forms import FooModelForm
from models import FooModel
from django.contrib import admin

class FooModelAdmin(admin.ModelAdmin):
form = FooModelForm, FooModelAdmin)

**Outside the Django Admin:**

To use the widget outside of the django admin, first create a form similar to the above but using the basic `PagedownWidget`:

from pagedown.widgets import PagedownWidget
from django import forms
from models import FooModel

class FooModelForm(forms.ModelForm):
a_text_field = forms.CharField(widget=PagedownWidget())
another_text_field = forms.CharField(widget=PagedownWidget())

class Meta:
model = FooModel

Then define your urls/views:

from forms import FooModelForm
from django.views.generic import FormView
from django.conf.urls import patterns, url

urlpatterns = patterns('',
url(r'^$', FormView.as_view(

then create the template and load the javascipt and css required to create the editor:

{{ }}
<form ...>
{{ form }}

#### Notes ####

* There are two widgets, `AdminPageDownWidget` and `PageDownWidget`. The only difference is that `AdminPageDownWidget` includes extra CSS to make the preview area and input pretty in the django admin. If you are using the editor for your own app, you will need to supply CSS to do this.

Release history Release notifications

History Node


History Node


History Node


History Node


This version
History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-pagedown-0.0.5.tar.gz (53.5 kB) Copy SHA256 hash SHA256 Source None Oct 9, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page