Opened 6 years ago

Closed 3 years ago

#10317 closed New feature (wontfix)

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

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

Description

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 http://www.djangosnippets.org/snippets/1332/ (Credit where credit is due, I also borrowed the method of detecting which markup libraries are installed from a slightly less featured version http://www.djangosnippets.org/snippets/1169/)

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

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

Attachments (1)

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

Download all attachments as: .zip

Change History (16)

comment:1 Changed 6 years ago by jamesturk

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 6 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 follow-up: Changed 6 years ago by Alex

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 6 years ago by jamesturk

dc & Alex: I've replied to your critiques and opened up discussion on django-developers: http://groups.google.com/group/django-developers/browse_thread/thread/c9124d565c17f972

Changed 6 years ago by jamesturk

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

comment:5 Changed 6 years ago by anonymous

  • Has patch set
  • Needs tests set

comment:6 Changed 6 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:7 Changed 6 years ago by jacob

  • Triage Stage changed from Unreviewed to Design decision needed

comment:8 Changed 6 years ago by carljm

  • Cc carljm added

comment:9 Changed 6 years ago by jamesturk

I am now maintaining django-markupfield in a github repository at http://github.com/jamesturk/django-markupfield/ 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 6 years ago by carljm

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 6 years ago by carljm

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

comment:12 Changed 4 years ago by gabrielhurley

  • Component changed from Contrib apps to contrib.markup

comment:13 Changed 4 years ago by SmileyChris

  • Severity set to Normal
  • Type set to New feature

comment:14 Changed 4 years ago by aaugustin

  • Easy pickings unset
  • Needs documentation set
  • Patch needs improvement set
  • Triage Stage changed from Design decision needed to Accepted
  • 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 3 years ago by claudep

  • Resolution set to wontfix
  • Status changed from new to closed

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