As much as I like the feature, I think that tying a presentation
widget (html5 specific) attribute to the Model definition is not
right. Just like the help_text attribute which should belong inside
forms and not models, or the old Admin innerclass. I agree that it is
very handy, but it does not belong to the Models. It also seems a bit
arbitrary to just go for Placeholder and why not for the title
attribute or any other that may become popular?. Start going by this
route opens a door for any HTML attribute we want be part of the
models on the Models.
Why not use the widgets dict on a modelform's meta [1] definition to
indicate you want a
forms.CharField(widget=forms.TextInput({'placeholder': 'fill me'})) -
or even pack a set of widgets or fields with easier syntax on an app?
I agree with d0ugal's comment on the ticket, that it should be part of
the form-rendering branch.
On a separate note, if this ended up being accepted, it would be
needed for any field that gets rendered by any HTML widget that
supports the placeholder attribute, like IntegerField (and friends),
Textfield, URLField, DecimalField, DateField, etc.
[1]
https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#overriding-the-default-field-types-or-widgets
On Feb 11, 12:13 pm, j4nu5 <[email protected]> wrote:
> I have written a patch for ticket #16304 (https://
> code.djangoproject.com/ticket/16304).
>
> The ticket adds support for the HTML5 input placeholder attribute
> (WHAT Working Group placeholder description
> -http://www.whatwg.org/specs/web-apps/current-work/multipage/common-in...),
> in Forms as well as ModelForms.
>
> I was wondering if a larger undertaking can be taken to make Django
> HTML5 aware. Options may include support for new input types like tel,
> email etc. which currently are rendered simply as text and ModelForms/
> Forms have to manually override widgets to achieve desired results.
>
> Comments please.
>
> P.S. The submitted patch lacks tests. I could not figure out how to
> write tests for the UI. If that is acceptable, can core devs please
> accept the patch?
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en.