Opened 9 years ago

Closed 9 years ago

#5517 closed (invalid)

[newforms-admin] allow defining media on base forms

Reported by: Petr Marhoun <petr.marhoun@…> Owned by: nobody
Component: Forms Version: newforms-admin
Severity: Keywords: media, form_for_model, nfa-someday
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I think it should be possible to define media on base form. Example from the attached patch:

>>> class FormWithMedia(BaseForm):
...     class Media:
...         js = ['form.js']
...         css = {'all': ['form.css']}
>>> CategoryFormWithMedia = form_for_model(Category, form=FormWithMedia)
>>> f = CategoryFormWithMedia()
>>> print f.media
<link href="form.css" type="text/css" media="all" rel="stylesheet" />
<script type="text/javascript" src="form.js"></script>

Attachments (1)

media-for-base-forms.diff (2.6 KB) - added by Petr Marhoun <petr.marhoun@…> 9 years ago.

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by Petr Marhoun <petr.marhoun@…>

Attachment: media-for-base-forms.diff added

comment:1 Changed 9 years ago by Simon G <dev@…>

Summary: [newforms-admin] - media for base forms[newforms-admin] allow defining media on base forms
Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 9 years ago by jkocherhans

Keywords: nfa-someday added

This seems reasonable enough to me, but I haven't really used the Media code yet. Russ is probably in the best position to make the call on this. Tagging as nfa-someday for now.

comment:3 Changed 9 years ago by jkocherhans

Resolution: invalid
Status: newclosed

I don't think this is valid since the addition of ModelForms. form_for_model is deprecated.

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