Need help with django-pagedown?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

507 Stars 75 Forks BSD 3-Clause "New" or "Revised" License 252 Commits 4 Opened issues


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

Services available


Need anything else?

Contributors list

Django Pagedown

Add Stack Overflow's "Pagedown" Markdown editor to your Django Admin or custom form.

Screenshot of Django Admin with Pagedown initialised


Version >= 2.0.0 of

requires Django 2.1.0 or above (previous versions should support Django all the way back to around 1.1).


  1. Get the code:
    pip install django-pagedown
  2. Add
    to your
  3. Collect the static files:
    python collectstatic


The widget can be used both inside the django admin or independendly.

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

    's in your admin form:
    from django.contrib import admin
    from django.db import models

    from pagedown.widgets import AdminPagedownWidget

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

  • To only use it on particular fields, first create a form (in
    from django import forms

    from pagedown.widgets import AdminPagedownWidget

    from music.models import Album

    class AlbumForm(forms.ModelForm): name = forms.CharField(widget=AdminPagedownWidget()) description = forms.CharField(widget=AdminPagedownWidget())

    class Meta:
        model = Album
        fields = "__all__"

    and in your
    from django.contrib import admin

    from forms import FooModelForm from models import FooModel

    @admin.register(FooModel) class FooModelAdmin(admin.ModelAdmin): form = FooModelForm fields = "all"

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

from django import forms

from pagedown.widgets import PagedownWidget

from music.models import Album

class AlbumForm(forms.ModelForm): name = forms.CharField(widget=PagedownWidget()) description = forms.CharField(widget=PagedownWidget())

class Meta:
    model = Album
    fields = ["name", "description"]

Then define your urls/views:

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

from music.forms import AlbumForm

urlpatterns = patterns('', url(r'^$', FormView.as_view(template_name="baz.html", form_class=AlbumForm)),)

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

    {{ }}

    </pre><form ...>
        {{ form }}

Customizing the Widget

If you want to customize the widget, the easiest way is to simply extend it:

from pagedown.widgets import PagedownWidget

class MyNewWidget(PagedownWidget): template_name = '/custom/template.html'

class Media:
    css = {
        'all': ('custom/stylesheets.css',)
    js = ('custom/javascript.js',)

Rendering Markdown

was deprecated in Django 1.5 meaning you can no longer use the
filter in your template by default.

@wkcd has a good example of how to overcome by installing

{% extends 'base.html' %}
{% load markdown_deux_tags %}


{{ entry.body|markdown }}


Image Uploads

You can enable image uploads, allowing your users to upload new images to the server and have them automatically inserted into the Pagedown widget (instead of just adding image URLs):

Screenshot of Django Admin with image upload enabled

To do so:

  1. Make sure you have set a
    so that uploads will be propertly saved
  2. Add
    to your settings
  3. Include the pagedown paths in your
    so that the upload endpoint is available
 # ...
 urlpatterns = [
     path('', include('pagedown.urls')),
     # ...

This will add the URL

endpoint to your project. You can see the default view that handles the upload here

The following options are available via your settings to tweak how the image upload works:

    can be used to change the path within your media root (default is
    can be used to limit the extensions allowed for upload (default is
    can be used to ensure all uploads are stored in a uniquely named subfolder, e.g.
    (default is

Check out the

script to see how the upload is being performed on the client side.


You can see a fully-fledged example of the widget in


We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.