You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Django allows the user to attach additional css/js resources to a form or a widget.
Currently, FormCollections can have a Media class to provide additional resources for themselves to use, however they don't collect the media defined in their forms (and these forms' fields by extension).
I did this not-so-dirty fix in my project (based on the media method of the django Form class), which if I understand the codebase correctly would account for nested collections if this was the media property of the FormCollection class :
@propertydefmedia(self):
"""Return all media for forms in this collection"""media=Media()
forforminself.declared_holders.values():
media+=form.mediareturnmedia
This allows to only use {{ form_collection.media }} in the template, and not search for the collection's sub forms explicitly.
The text was updated successfully, but these errors were encountered:
In my projects, I actually always attempt to use the built-in or pilfered styles. But I get your point, this actually is something very useful. In my opinion however, this would be a valid use-case for a singleton available by the rendering view.
I'll need to have a deeper look, but I will find a solution. Thanks for the hint.
Django allows the user to attach additional css/js resources to a form or a widget.
Currently,
FormCollection
s can have aMedia
class to provide additional resources for themselves to use, however they don't collect the media defined in their forms (and these forms' fields by extension).I did this not-so-dirty fix in my project (based on the media method of the django
Form
class), which if I understand the codebase correctly would account for nested collections if this was the media property of theFormCollection
class :This allows to only use
{{ form_collection.media }}
in the template, and not search for the collection's sub forms explicitly.The text was updated successfully, but these errors were encountered: