Opened 8 years ago

Closed 4 years ago

#10317 closed New feature (wontfix)

New Feature: django.contrib.markup.fields.MarkupField

Reported by: James Turk Owned by: James Turk
Component: contrib.markup Version: master
Severity: Normal Keywords: markup forms
Cc: Carl Meyer Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no


I recently published a snippet of something I've wanted in Django for a long time, a MarkupField that handles conversion to HTML on save and an accessor that calls mark_safe.

My implementation is at (Credit where credit is due, I also borrowed the method of detecting which markup libraries are installed from a slightly less featured version

Jacob commented on Twitter that he'd like to see this as well and to submit a ticket.

I'll put together the appropriate / documentation / tests and should have a candidate patch up soon.

Attachments (1)

markupfield-with-docs.diff (9.3 KB) - added by James Turk 8 years ago.
markupfield implementation and markup docs changes (now with extra options)

Download all attachments as: .zip

Change History (16)

comment:1 Changed 8 years ago by James Turk

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

comment:2 Changed 8 years ago by dc

I think it must be possible to use any custom markup with this field. Maybe not hardcode markup checks but accept markup func as arg for example?

comment:3 Changed 8 years ago by Alex Gaynor

One thing I don't like about that implementation is the need to have several attributes on the model, just having a complex obj that stored all of them on 1 attr would be preferable I think.

comment:4 in reply to:  3 Changed 8 years ago by James Turk

dc & Alex: I've replied to your critiques and opened up discussion on django-developers:

Changed 8 years ago by James Turk

Attachment: markupfield-with-docs.diff added

markupfield implementation and markup docs changes (now with extra options)

comment:5 Changed 8 years ago by anonymous

Has patch: set
Needs tests: set

comment:6 Changed 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:7 Changed 8 years ago by Jacob

Triage Stage: UnreviewedDesign decision needed

comment:8 Changed 8 years ago by Carl Meyer

Cc: Carl Meyer added

comment:9 Changed 7 years ago by James Turk

I am now maintaining django-markupfield in a github repository at it is not the exact version debated on the list as I personally did not find that useful (though I do see how this version is too special of a case to fit into django core)

Should the design decision on this come down in favor of something akin to what I am now maintaining externally I would be more than happy to do the integration necessary to produce a patch that moves MarkupField into django.contrib.markup

comment:10 Changed 7 years ago by Carl Meyer

I forgot about this during 1.2 feature proposal, but FWIW I have a fork of James' repo which I've simplified/modified to more or less match the API outlined by James and others in the django-dev thread. I'm using it happily as an external app and don't have any particular itch to see it in core, but if a MarkupField is wanted in core I'd be happy to transform it into a patch and make any needed changes.

comment:11 Changed 7 years ago by Carl Meyer

Um, yeah. The first James there is James Turk, the second is James Bennett. Disambiguation FTW.

comment:12 Changed 6 years ago by Gabriel Hurley

Component: Contrib appscontrib.markup

comment:13 Changed 6 years ago by Chris Beaven

Severity: Normal
Type: New feature

comment:14 Changed 5 years ago by Aymeric Augustin

Easy pickings: unset
Needs documentation: set
Patch needs improvement: set
Triage Stage: Design decision neededAccepted
UI/UX: unset

This has been stuck in DDN for a long time. It's a small amount of code and it would be a reasonable addition to django.contrib.markup.

comment:15 Changed 4 years ago by Claude Paroz

Resolution: wontfix
Status: newclosed

contrib.markup has been deprecated (#18504) and will be removed in Django 1.6. Closing as obsolete.

Note: See TracTickets for help on using tickets.
Back to Top