Debian Codegraph @

flask_peewee/templates/admin/models/base_forms.html

raw
1 {% extends "admin/models/base.html" %}
2
3 {% block extra_script %}
4 {{ super() }}
5 <script>
6 document.addEventListener('DOMContentLoaded', function() {
7 {% if model_admin.foreign_key_lookups %}
8 {% for field_name, search in model_admin.foreign_key_lookups.items() %}
9 new Admin.ModelAdminRawIDField('{{ field_name }}').init({% if instance and instance._pk and form.data[field_name] %}'{{ form.data[field_name]|string }}'{% endif %});
10 {% endfor %}
11 {% endif %}
12 });
13 </script>
14 {% endblock %}