Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: What are the elements returned by the get method in widgets.get('list') in jinja2 templates? #2273

Open
ejm4567 opened this issue Oct 3, 2024 · 1 comment

Comments

@ejm4567
Copy link

ejm4567 commented Oct 3, 2024

This is a question about how the following code in the template appbuilder/general/model/list.html works.

In the example quickhowto2 the template list_contacts.html has:

{% block list_list scoped %}
        Text before the list
        {{ super() }}
{% endblock %}

There is an extends command at the top of that template which extends the list.html template, referenced above.
In list.html there is:

    {% block list_list scoped %}
        <div>
            {{ widgets.get('list')()|safe }}
        </div>
    {% endblock %}

In the views.py file for quickhowto2 the widgets MyListWidget or MyListWidgetOverride are used. Both of those classes have as the parent class ListWidget. It's not clear to me where the "list" that MyListWidget and/or ListWidget comes from.

Would it be correct to assume that the "list" being requested via widgets.get are in a sense a "row" of a form?
Or is it something else ?

Any clarification/tips on how the above code is intended to work would be greatly appreciated!

@Yoyasp
Copy link
Contributor

Yoyasp commented Oct 4, 2024

I'll check later when im behind my computer. But if my memory serve correctly the widget that is specified in the model/view is used. The default for this is the ListWidget (if the data used is fitting the widget)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants