File: widgets.py

package info (click to toggle)
django-markupfield 1.2.1-2%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd-proposed-updates
  • size: 204 kB
  • sloc: python: 502; makefile: 10
file content (15 lines) | stat: -rw-r--r-- 463 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from django import forms
from django.contrib.admin.widgets import AdminTextareaWidget
from django.utils import six


class MarkupTextarea(forms.widgets.Textarea):

    def render(self, name, value, attrs=None):
        if value is not None and not isinstance(value, six.text_type):
            value = value.raw
        return super(MarkupTextarea, self).render(name, value, attrs)


class AdminMarkupTextareaWidget(MarkupTextarea, AdminTextareaWidget):
    pass