-
Notifications
You must be signed in to change notification settings - Fork 425
Use viewset.layout in the detail view #194
Comments
I'm working on this but my approach needs that you have to pass cheers! |
Yeah, that's the hard question. To have reasonable looking good detail view by default is the nice feature, but anyway it's supposed to be overridden in real projects. So it won't be good if the solution for this optional feature would overcomplicate the other part of the codebase. Currently the layout primitives Row/Column/Fieldset are too bound to the form rendering. From another side, getting a text representation for a model value is hard without a widget. So, there is no simple way to reuse a layout without form instance. But I don't think that the detail view should look exactly like a form but with all widgets disabled. That's is too crudy. Just a disabled text inputs would be enough for most cases. Your approach looks reasonable, as implementing a template pack that renders a form in a read-only state, without actually do the tricks on a python side.
This would be the really useful feature, in many scenarios beyond the frontend.detail view. It looks that only a few templates could be overridden. django-material lookup for the template according to a class inheritance mro. So the django-material have some code to get a field value for the list view. You can take a look what django have in We can move |
Hi,
Absolutely agree, thats why I want to replace field template with non-form elements (inputs, radios, etc). Take a look at the PoC: This is that's look like: |
Check the template selection code; it chooses the most specific template for the widget. If the template pack contains a single |
cool!
Are you sure about that? For an input field, it drops me the following:
|
ups, that's b/c we have It could be simply adjusted to |
Yeah, it worked. Thanks |
https://gitter.im/viewflow/django-material
The text was updated successfully, but these errors were encountered: