django-unfold 0.38.0__tar.gz → 0.40.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- django_unfold-0.40.0/PKG-INFO +69 -0
- django_unfold-0.40.0/README.md +44 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/pyproject.toml +5 -5
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/admin.py +4 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/guardian/templates/unfold/guardian/user_form.html +3 -3
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/forms.py +12 -9
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/sites.py +12 -0
- django_unfold-0.40.0/src/unfold/static/admin/js/admin/RelatedObjectLookups.js +295 -0
- django_unfold-0.40.0/src/unfold/static/unfold/css/styles.css +1 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/js/app.js +3 -1
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/app_list.html +1 -1
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/change_form.html +8 -1
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/change_list.html +8 -0
- django_unfold-0.40.0/src/unfold/templates/admin/edit_inline/stacked.html +87 -0
- django_unfold-0.40.0/src/unfold/templates/admin/edit_inline/tabular.html +161 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/login.html +2 -0
- django_unfold-0.40.0/src/unfold/templates/unfold/components/button.html +4 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/components/card.html +1 -1
- django_unfold-0.40.0/src/unfold/templates/unfold/components/progress.html +21 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/components/separator.html +1 -1
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/app_list.html +2 -2
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/welcomemsg.html +1 -1
- django_unfold-0.38.0/PKG-INFO +0 -70
- django_unfold-0.38.0/README.md +0 -45
- django_unfold-0.38.0/src/unfold/static/unfold/css/styles.css +0 -1
- django_unfold-0.38.0/src/unfold/templates/admin/edit_inline/stacked.html +0 -94
- django_unfold-0.38.0/src/unfold/templates/admin/edit_inline/tabular.html +0 -169
- django_unfold-0.38.0/src/unfold/templates/unfold/components/button.html +0 -3
- django_unfold-0.38.0/src/unfold/templates/unfold/components/progress.html +0 -21
- {django_unfold-0.38.0 → django_unfold-0.40.0}/LICENSE.md +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/__init__.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/apps.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/checks.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/__init__.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/filters/__init__.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/filters/admin.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/filters/apps.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/filters/forms.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/filters/static/unfold/filters/css/nouislider.min.css +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/filters/static/unfold/filters/js/DateTimeShortcuts.js +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/filters/static/unfold/filters/js/admin-numeric-filter.js +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/filters/static/unfold/filters/js/nouislider.min.js +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/filters/static/unfold/filters/js/wNumb.min.js +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/filters/templates/unfold/filters/filters_date_range.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/filters/templates/unfold/filters/filters_datetime_range.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/filters/templates/unfold/filters/filters_field.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/filters/templates/unfold/filters/filters_numeric_range.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/filters/templates/unfold/filters/filters_numeric_single.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/filters/templates/unfold/filters/filters_numeric_slider.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/forms/__init__.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/forms/apps.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/forms/static/unfold/forms/css/trix.css +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/forms/static/unfold/forms/js/trix.config.js +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/forms/static/unfold/forms/js/trix.js +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/forms/templates/unfold/forms/array.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/forms/templates/unfold/forms/helpers/toolbar.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/forms/templates/unfold/forms/wysiwyg.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/forms/widgets.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/guardian/__init__.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/guardian/apps.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/guardian/templates/admin/guardian/model/change_form.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/guardian/templates/admin/guardian/model/field.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_group.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/guardian/templates/admin/guardian/model/obj_perms_manage_user.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/guardian/templates/unfold/guardian/group_form.html +2 -2
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/__init__.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/apps.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/forms.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/templates/admin/import_export/base.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/templates/admin/import_export/change_form.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/templates/admin/import_export/change_list_export.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/templates/admin/import_export/change_list_export_item.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/templates/admin/import_export/change_list_import_export.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/templates/admin/import_export/change_list_import_item.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/templates/admin/import_export/export.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/templates/admin/import_export/import.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/templates/admin/import_export/import_confirm.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/templates/admin/import_export/import_errors.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/templates/admin/import_export/import_form.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/templates/admin/import_export/import_preview.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/templates/admin/import_export/import_validation.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/import_export/templates/admin/import_export/resource_fields_list.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/inlines/__init__.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/inlines/admin.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/inlines/apps.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/inlines/checks.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/inlines/forms.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/simple_history/__init__.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/simple_history/apps.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/simple_history/templates/simple_history/object_history.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/simple_history/templates/simple_history/object_history_form.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/simple_history/templates/simple_history/object_history_list.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/contrib/simple_history/templates/simple_history/submit_line.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/dataclasses.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/decorators.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/exceptions.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/fields.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/settings.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/css/simplebar.css +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/fonts/inter/Inter-Bold.woff2 +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/fonts/inter/Inter-Medium.woff2 +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/fonts/inter/Inter-Regular.woff2 +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/fonts/inter/Inter-SemiBold.woff2 +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/fonts/inter/styles.css +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/fonts/material-symbols/Material-Symbols-Outlined.woff2 +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/fonts/material-symbols/styles.css +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/js/alpine.anchor.js +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/js/alpine.js +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/js/alpine.persist.js +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/js/chart.js +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/js/htmx.js +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/js/select2.init.js +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/static/unfold/js/simplebar.js +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/styles.css +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/actions.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/app_index.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/auth/user/add_form.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/auth/user/change_password.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/base.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/base_site.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/change_form_object_tools.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/change_list_object_tools.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/change_list_results.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/date_hierarchy.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/delete_confirmation.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/delete_selected_confirmation.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/filter.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/includes/fieldset.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/includes/object_delete_summary.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/index.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/nav_sidebar.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/object_history.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/pagination.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/search_form.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/admin/submit_line.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/auth/widgets/read_only_password_hash.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/registration/logged_out.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/registration/password_change_done.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/registration/password_change_form.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/change_list_filter.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/components/chart/bar.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/components/chart/line.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/components/container.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/components/flex.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/components/icon.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/components/navigation.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/components/table.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/components/text.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/components/title.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/account_links.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/actions_row.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/add_link.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/app_list_default.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/attrs.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/boolean.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/breadcrumb_item.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/display_header.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/display_label.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/field.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/field_readonly.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/field_readonly_value.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/fieldset_row.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/fieldsets_tabs.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/form_errors.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/form_label.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/header.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/help_text.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/history.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/label.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/messages/error.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/messages/errornote.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/messages/info.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/messages.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/navigation.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/pagination_current_item.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/pagination_ellipsis.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/search.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/search_results.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/site_icon.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/site_logo.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/submit.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/tab_action.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/tab_list.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/theme_switch.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/helpers/userlinks.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/layouts/base.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/layouts/base_simple.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/layouts/skeleton.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/widgets/clearable_file_input.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/widgets/clearable_file_input_small.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/widgets/date.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/widgets/foreign_key_raw_id.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/widgets/radio.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/widgets/radio_option.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/widgets/range.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/widgets/related_widget_wrapper.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/widgets/split_datetime.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/widgets/split_datetime_vertical.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/widgets/split_money.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/widgets/textarea.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/widgets/textarea_expandable.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/widgets/time.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templates/unfold/widgets/url.html +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templatetags/__init__.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templatetags/unfold.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/templatetags/unfold_list.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/typing.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/utils.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/views.py +0 -0
- {django_unfold-0.38.0 → django_unfold-0.40.0}/src/unfold/widgets.py +0 -0
@@ -0,0 +1,69 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: django-unfold
|
3
|
+
Version: 0.40.0
|
4
|
+
Summary: Modern Django admin theme for seamless interface development
|
5
|
+
Home-page: https://unfoldadmin.com
|
6
|
+
License: MIT
|
7
|
+
Keywords: django,admin,tailwind,theme
|
8
|
+
Requires-Python: >=3.8
|
9
|
+
Classifier: Environment :: Web Environment
|
10
|
+
Classifier: Framework :: Django
|
11
|
+
Classifier: Intended Audience :: Developers
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
13
|
+
Classifier: Operating System :: OS Independent
|
14
|
+
Classifier: Programming Language :: Python
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
21
|
+
Requires-Dist: django (>=3.2)
|
22
|
+
Project-URL: Repository, https://github.com/unfoldadmin/django-unfold
|
23
|
+
Description-Content-Type: text/markdown
|
24
|
+
|
25
|
+

|
26
|
+
|
27
|
+
## Unfold Django Admin Theme
|
28
|
+
|
29
|
+
[](https://pypi.org/project/django-unfold/)
|
30
|
+
[](https://github.com/unfoldadmin/django-unfold/actions?query=workflow%3Arelease)
|
31
|
+

|
32
|
+

|
33
|
+
|
34
|
+
Unfold is a theme for Django admin that incorporates common best practices for building full-fledged admin areas. It is designed to work on top of the default administration provided by Django.
|
35
|
+
|
36
|
+
- **Documentation:** Full docs are available at [unfoldadmin.com](https://unfoldadmin.com?utm_medium=github&utm_source=unfold).
|
37
|
+
- **Unfold:** Demo site is available at [unfoldadmin.com](https://unfoldadmin.com?utm_medium=github&utm_source=unfold).
|
38
|
+
- **Formula:** Repository with demo implementation at [github.com/unfoldadmin/formula](https://github.com/unfoldadmin/formula?utm_medium=github&utm_source=unfold).
|
39
|
+
- **Turbo:** Django & Next.js boilerplate implementing Unfold at [github.com/unfoldadmin/turbo](https://github.com/unfoldadmin/turbo?utm_medium=github&utm_source=unfold).
|
40
|
+
|
41
|
+
## Are you using Unfold and need help?
|
42
|
+
|
43
|
+
Have you decided to start using Unfold but don’t have time to make the switch from the native Django admin? [Get in touch with us](https://unfoldadmin.com/consulting?utm_medium=github&utm_source=unfold) and let’s supercharge your development with our expertise.
|
44
|
+
|
45
|
+
## Features
|
46
|
+
|
47
|
+
- **Visual**: Provides a new user interface based on the Tailwind CSS framework.
|
48
|
+
- **Sidebar:** Simplifies the creation of sidebar navigation with icons, collapsibles, and more.
|
49
|
+
- **Dark mode:** Supports both light and dark mode versions.
|
50
|
+
- **Actions:** Offers multiple ways to define actions within different parts of the admin interface.
|
51
|
+
- **Filters:** Custom dropdowns, numeric, datetime, and text fields.
|
52
|
+
- **Dashboard:** Includes helpers for creating custom dashboard pages.
|
53
|
+
- **Components:** Reusable UI components such as cards, buttons, and charts.
|
54
|
+
- **WYSIWYG widget:** Built-in support for WYSIWYG (Trix).
|
55
|
+
- **Array widget:** Built-in widget for `django.contrib.postgres.fields.ArrayField`.
|
56
|
+
- **Inline tabs:** Groups inlines into tab navigation in the change form.
|
57
|
+
- **Model tabs:** Allows defining custom tab navigation for models.
|
58
|
+
- **Fieldset tabs:** Merges multiple fieldsets into tabs in the change form.
|
59
|
+
- **Environment label**: Distinguishes between environments by displaying a label.
|
60
|
+
- **Nonrelated inlines**: Displays nonrelated models as inlines in the change form.
|
61
|
+
- **Favicons**: Built-in support for configuring various site favicons.
|
62
|
+
- **Colors:** Allows customization of the default color scheme.
|
63
|
+
- **Changeform modes:** Displays fields in compressed mode in the change form.
|
64
|
+
- **Parallel admin**: Supports [running the default admin](https://unfoldadmin.com/blog/migrating-django-admin-unfold/?utm_medium=github&utm_source=unfold) alongside Unfold.
|
65
|
+
- **Third party packages:** Default support for multiple popular applications.
|
66
|
+
- **Configuration:** Most basic options can be changed in `settings.py`.
|
67
|
+
- **Dependencies:** Fully based on `django.contrib.admin`.
|
68
|
+
- **VS Code**: Project configuration and development container included.
|
69
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
## Unfold Django Admin Theme
|
4
|
+
|
5
|
+
[](https://pypi.org/project/django-unfold/)
|
6
|
+
[](https://github.com/unfoldadmin/django-unfold/actions?query=workflow%3Arelease)
|
7
|
+

|
8
|
+

|
9
|
+
|
10
|
+
Unfold is a theme for Django admin that incorporates common best practices for building full-fledged admin areas. It is designed to work on top of the default administration provided by Django.
|
11
|
+
|
12
|
+
- **Documentation:** Full docs are available at [unfoldadmin.com](https://unfoldadmin.com?utm_medium=github&utm_source=unfold).
|
13
|
+
- **Unfold:** Demo site is available at [unfoldadmin.com](https://unfoldadmin.com?utm_medium=github&utm_source=unfold).
|
14
|
+
- **Formula:** Repository with demo implementation at [github.com/unfoldadmin/formula](https://github.com/unfoldadmin/formula?utm_medium=github&utm_source=unfold).
|
15
|
+
- **Turbo:** Django & Next.js boilerplate implementing Unfold at [github.com/unfoldadmin/turbo](https://github.com/unfoldadmin/turbo?utm_medium=github&utm_source=unfold).
|
16
|
+
|
17
|
+
## Are you using Unfold and need help?
|
18
|
+
|
19
|
+
Have you decided to start using Unfold but don’t have time to make the switch from the native Django admin? [Get in touch with us](https://unfoldadmin.com/consulting?utm_medium=github&utm_source=unfold) and let’s supercharge your development with our expertise.
|
20
|
+
|
21
|
+
## Features
|
22
|
+
|
23
|
+
- **Visual**: Provides a new user interface based on the Tailwind CSS framework.
|
24
|
+
- **Sidebar:** Simplifies the creation of sidebar navigation with icons, collapsibles, and more.
|
25
|
+
- **Dark mode:** Supports both light and dark mode versions.
|
26
|
+
- **Actions:** Offers multiple ways to define actions within different parts of the admin interface.
|
27
|
+
- **Filters:** Custom dropdowns, numeric, datetime, and text fields.
|
28
|
+
- **Dashboard:** Includes helpers for creating custom dashboard pages.
|
29
|
+
- **Components:** Reusable UI components such as cards, buttons, and charts.
|
30
|
+
- **WYSIWYG widget:** Built-in support for WYSIWYG (Trix).
|
31
|
+
- **Array widget:** Built-in widget for `django.contrib.postgres.fields.ArrayField`.
|
32
|
+
- **Inline tabs:** Groups inlines into tab navigation in the change form.
|
33
|
+
- **Model tabs:** Allows defining custom tab navigation for models.
|
34
|
+
- **Fieldset tabs:** Merges multiple fieldsets into tabs in the change form.
|
35
|
+
- **Environment label**: Distinguishes between environments by displaying a label.
|
36
|
+
- **Nonrelated inlines**: Displays nonrelated models as inlines in the change form.
|
37
|
+
- **Favicons**: Built-in support for configuring various site favicons.
|
38
|
+
- **Colors:** Allows customization of the default color scheme.
|
39
|
+
- **Changeform modes:** Displays fields in compressed mode in the change form.
|
40
|
+
- **Parallel admin**: Supports [running the default admin](https://unfoldadmin.com/blog/migrating-django-admin-unfold/?utm_medium=github&utm_source=unfold) alongside Unfold.
|
41
|
+
- **Third party packages:** Default support for multiple popular applications.
|
42
|
+
- **Configuration:** Most basic options can be changed in `settings.py`.
|
43
|
+
- **Dependencies:** Fully based on `django.contrib.admin`.
|
44
|
+
- **VS Code**: Project configuration and development container included.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "django-unfold"
|
3
|
-
version = "0.
|
3
|
+
version = "0.40.0"
|
4
4
|
description = "Modern Django admin theme for seamless interface development"
|
5
5
|
license = "MIT"
|
6
6
|
readme = "README.md"
|
@@ -27,13 +27,13 @@ python = ">=3.8"
|
|
27
27
|
django = ">=3.2"
|
28
28
|
|
29
29
|
[tool.poetry.group.test.dependencies]
|
30
|
-
pytest = "^
|
31
|
-
pytest-django = "^4.
|
32
|
-
tox = "^4.
|
30
|
+
pytest = "^8.3"
|
31
|
+
pytest-django = "^4.9"
|
32
|
+
tox = "^4.21"
|
33
33
|
|
34
34
|
|
35
35
|
[tool.poetry.group.dev.dependencies]
|
36
|
-
python-semantic-release = "^8.7
|
36
|
+
python-semantic-release = "^8.7"
|
37
37
|
|
38
38
|
[tool.ruff]
|
39
39
|
fix = true
|
@@ -235,6 +235,10 @@ class ModelAdmin(ModelAdminMixin, BaseModelAdmin):
|
|
235
235
|
list_filter_submit = False
|
236
236
|
list_fullwidth = False
|
237
237
|
list_disable_select_all = False
|
238
|
+
list_before_template = None
|
239
|
+
list_after_template = None
|
240
|
+
change_form_before_template = None
|
241
|
+
change_form_after_template = None
|
238
242
|
compressed_fields = False
|
239
243
|
readonly_preprocess_fields = {}
|
240
244
|
warn_unsaved_form = False
|
@@ -38,10 +38,10 @@
|
|
38
38
|
|
39
39
|
{% for perm in model_perms %}
|
40
40
|
<td class="align-middle flex border-t border-gray-200 font-normal px-3 py-2 text-left before:flex before:capitalize before:content-[attr(data-label)] before:items-center before:mr-auto first:border-t-0 lg:before:hidden lg:first:border-t lg:py-3 lg:table-cell dark:border-gray-800" data-label="{{ perm.name }}">
|
41
|
-
{% if perm.codename in
|
42
|
-
{% include "unfold/helpers/boolean.html" with value=False %}
|
43
|
-
{% else %}
|
41
|
+
{% if perm.codename in user_perms %}
|
44
42
|
{% include "unfold/helpers/boolean.html" with value=True %}
|
43
|
+
{% else %}
|
44
|
+
{% include "unfold/helpers/boolean.html" with value=False %}
|
45
45
|
{% endif %}
|
46
46
|
</td>
|
47
47
|
{% endfor %}
|
@@ -10,9 +10,14 @@ from django.contrib.admin.forms import (
|
|
10
10
|
from django.contrib.auth.forms import (
|
11
11
|
AdminPasswordChangeForm as BaseAdminPasswordChangeForm,
|
12
12
|
)
|
13
|
+
from django.contrib.auth.models import User
|
14
|
+
|
15
|
+
try:
|
16
|
+
from django.contrib.auth.forms import AdminUserCreationForm as BaseUserCreationForm
|
17
|
+
except ImportError:
|
18
|
+
from django.contrib.auth.forms import UserCreationForm as BaseUserCreationForm
|
13
19
|
from django.contrib.auth.forms import ReadOnlyPasswordHashWidget
|
14
20
|
from django.contrib.auth.forms import UserChangeForm as BaseUserChangeForm
|
15
|
-
from django.contrib.auth.forms import UserCreationForm as BaseUserCreationForm
|
16
21
|
from django.http import HttpRequest
|
17
22
|
from django.utils.safestring import mark_safe
|
18
23
|
from django.utils.translation import gettext_lazy as _
|
@@ -66,11 +71,10 @@ class AuthenticationForm(AdminAuthenticationForm):
|
|
66
71
|
class UserCreationForm(BaseUserCreationForm):
|
67
72
|
def __init__(
|
68
73
|
self,
|
69
|
-
request: Optional[HttpRequest] = None,
|
70
74
|
*args,
|
71
75
|
**kwargs,
|
72
76
|
) -> None:
|
73
|
-
super().__init__(
|
77
|
+
super().__init__(*args, **kwargs)
|
74
78
|
|
75
79
|
self.fields["password1"].widget = UnfoldAdminPasswordInput(
|
76
80
|
attrs={"autocomplete": "new-password"}
|
@@ -88,11 +92,10 @@ class UserCreationForm(BaseUserCreationForm):
|
|
88
92
|
class UserChangeForm(BaseUserChangeForm):
|
89
93
|
def __init__(
|
90
94
|
self,
|
91
|
-
request: Optional[HttpRequest] = None,
|
92
95
|
*args,
|
93
96
|
**kwargs,
|
94
97
|
) -> None:
|
95
|
-
super().__init__(
|
98
|
+
super().__init__(*args, **kwargs)
|
96
99
|
self.fields["password"].widget = UnfoldReadOnlyPasswordHashWidget()
|
97
100
|
|
98
101
|
self.fields["password"].help_text = _(
|
@@ -109,19 +112,19 @@ class UserChangeForm(BaseUserChangeForm):
|
|
109
112
|
class AdminPasswordChangeForm(BaseAdminPasswordChangeForm):
|
110
113
|
def __init__(
|
111
114
|
self,
|
112
|
-
|
115
|
+
user: User,
|
113
116
|
*args,
|
114
117
|
**kwargs,
|
115
118
|
) -> None:
|
116
|
-
super().__init__(
|
119
|
+
super().__init__(user, *args, **kwargs)
|
117
120
|
|
118
121
|
self.fields["password1"].widget.attrs["class"] = " ".join(INPUT_CLASSES)
|
119
122
|
self.fields["password2"].widget.attrs["class"] = " ".join(INPUT_CLASSES)
|
120
123
|
|
121
124
|
|
122
125
|
class AdminOwnPasswordChangeForm(BaseAdminOwnPasswordChangeForm):
|
123
|
-
def __init__(self, *args, **kwargs) -> None:
|
124
|
-
super().__init__(
|
126
|
+
def __init__(self, user: User, *args, **kwargs) -> None:
|
127
|
+
super().__init__(user, *args, **kwargs)
|
125
128
|
|
126
129
|
self.fields["old_password"].widget.attrs["class"] = " ".join(INPUT_CLASSES)
|
127
130
|
self.fields["new_password1"].widget.attrs["class"] = " ".join(INPUT_CLASSES)
|
@@ -7,8 +7,18 @@ from django.core.validators import EMPTY_VALUES
|
|
7
7
|
from django.http import HttpRequest, HttpResponse
|
8
8
|
from django.template.response import TemplateResponse
|
9
9
|
from django.urls import URLPattern, path, reverse, reverse_lazy
|
10
|
+
from django.utils.decorators import method_decorator
|
10
11
|
from django.utils.functional import lazy
|
11
12
|
from django.utils.module_loading import import_string
|
13
|
+
from django.views.decorators.cache import never_cache
|
14
|
+
|
15
|
+
try:
|
16
|
+
from django.contrib.auth.decorators import login_not_required
|
17
|
+
except ImportError:
|
18
|
+
|
19
|
+
def login_not_required(func: Callable) -> Callable:
|
20
|
+
return func
|
21
|
+
|
12
22
|
|
13
23
|
from .dataclasses import Favicon
|
14
24
|
from .settings import get_config
|
@@ -178,6 +188,8 @@ class UnfoldAdminSite(AdminSite):
|
|
178
188
|
},
|
179
189
|
)
|
180
190
|
|
191
|
+
@method_decorator(never_cache)
|
192
|
+
@login_not_required
|
181
193
|
def login(
|
182
194
|
self, request: HttpRequest, extra_context: Optional[Dict[str, Any]] = None
|
183
195
|
) -> HttpResponse:
|
@@ -0,0 +1,295 @@
|
|
1
|
+
/*global SelectBox, interpolate*/
|
2
|
+
// Handles related-objects functionality: lookup link for raw_id_fields
|
3
|
+
// and Add Another links.
|
4
|
+
"use strict";
|
5
|
+
{
|
6
|
+
const $ = django.jQuery;
|
7
|
+
let popupIndex = 0;
|
8
|
+
const relatedWindows = [];
|
9
|
+
|
10
|
+
function dismissChildPopups() {
|
11
|
+
relatedWindows.forEach(function (win) {
|
12
|
+
if (!win.closed) {
|
13
|
+
win.dismissChildPopups();
|
14
|
+
win.close();
|
15
|
+
}
|
16
|
+
});
|
17
|
+
}
|
18
|
+
|
19
|
+
function setPopupIndex() {
|
20
|
+
if (document.getElementsByName("_popup").length > 0) {
|
21
|
+
const index = window.name.lastIndexOf("__") + 2;
|
22
|
+
popupIndex = parseInt(window.name.substring(index));
|
23
|
+
} else {
|
24
|
+
popupIndex = 0;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
function addPopupIndex(name) {
|
29
|
+
return name + "__" + (popupIndex + 1);
|
30
|
+
}
|
31
|
+
|
32
|
+
function removePopupIndex(name) {
|
33
|
+
return name.replace(new RegExp("__" + (popupIndex + 1) + "$"), "");
|
34
|
+
}
|
35
|
+
|
36
|
+
function showAdminPopup(triggeringLink, name_regexp, add_popup) {
|
37
|
+
const name = addPopupIndex(triggeringLink.id.replace(name_regexp, ""));
|
38
|
+
const href = new URL(triggeringLink.href);
|
39
|
+
if (add_popup) {
|
40
|
+
href.searchParams.set("_popup", 1);
|
41
|
+
}
|
42
|
+
const win = window.open(
|
43
|
+
href,
|
44
|
+
name,
|
45
|
+
"height=768,width=1024,resizable=yes,scrollbars=yes"
|
46
|
+
);
|
47
|
+
relatedWindows.push(win);
|
48
|
+
win.focus();
|
49
|
+
return false;
|
50
|
+
}
|
51
|
+
|
52
|
+
function showRelatedObjectLookupPopup(triggeringLink) {
|
53
|
+
return showAdminPopup(triggeringLink, /^lookup_/, true);
|
54
|
+
}
|
55
|
+
|
56
|
+
function dismissRelatedLookupPopup(win, chosenId) {
|
57
|
+
const name = removePopupIndex(win.name);
|
58
|
+
const elem = document.getElementById(name);
|
59
|
+
if (elem.classList.contains("vManyToManyRawIdAdminField") && elem.value) {
|
60
|
+
elem.value += "," + chosenId;
|
61
|
+
} else {
|
62
|
+
document.getElementById(name).value = chosenId;
|
63
|
+
}
|
64
|
+
const index = relatedWindows.indexOf(win);
|
65
|
+
if (index > -1) {
|
66
|
+
relatedWindows.splice(index, 1);
|
67
|
+
}
|
68
|
+
win.close();
|
69
|
+
}
|
70
|
+
|
71
|
+
function showRelatedObjectPopup(triggeringLink) {
|
72
|
+
return showAdminPopup(triggeringLink, /^(change|add|delete)_/, false);
|
73
|
+
}
|
74
|
+
|
75
|
+
function updateRelatedObjectLinks(triggeringLink) {
|
76
|
+
const $this = $(triggeringLink);
|
77
|
+
const siblings = $this.nextAll(
|
78
|
+
".view-related, .change-related, .delete-related"
|
79
|
+
);
|
80
|
+
if (!siblings.length) {
|
81
|
+
return;
|
82
|
+
}
|
83
|
+
const value = $this.val();
|
84
|
+
if (value) {
|
85
|
+
siblings.each(function () {
|
86
|
+
const elm = $(this);
|
87
|
+
elm.attr(
|
88
|
+
"href",
|
89
|
+
elm.attr("data-href-template").replace("__fk__", value)
|
90
|
+
);
|
91
|
+
elm.removeAttr("aria-disabled");
|
92
|
+
});
|
93
|
+
} else {
|
94
|
+
siblings.removeAttr("href");
|
95
|
+
siblings.attr("aria-disabled", true);
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
function updateRelatedSelectsOptions(
|
100
|
+
currentSelect,
|
101
|
+
win,
|
102
|
+
objId,
|
103
|
+
newRepr,
|
104
|
+
newId,
|
105
|
+
skipIds = []
|
106
|
+
) {
|
107
|
+
// After create/edit a model from the options next to the current
|
108
|
+
// select (+ or :pencil:) update ForeignKey PK of the rest of selects
|
109
|
+
// in the page.
|
110
|
+
|
111
|
+
const path = win.location.pathname;
|
112
|
+
// Extract the model from the popup url '.../<model>/add/' or
|
113
|
+
// '.../<model>/<id>/change/' depending the action (add or change).
|
114
|
+
const modelName = path.split("/")[path.split("/").length - (objId ? 4 : 3)];
|
115
|
+
// Select elements with a specific model reference and context of "available-source".
|
116
|
+
const selectsRelated = document.querySelectorAll(
|
117
|
+
`[data-model-ref="${modelName}"] [data-context="available-source"]`
|
118
|
+
);
|
119
|
+
|
120
|
+
selectsRelated.forEach(function (select) {
|
121
|
+
if (
|
122
|
+
currentSelect === select ||
|
123
|
+
(skipIds && skipIds.includes(select.id))
|
124
|
+
) {
|
125
|
+
return;
|
126
|
+
}
|
127
|
+
|
128
|
+
let option = select.querySelector(`option[value="${objId}"]`);
|
129
|
+
|
130
|
+
if (!option) {
|
131
|
+
option = new Option(newRepr, newId);
|
132
|
+
select.options.add(option);
|
133
|
+
// Update SelectBox cache for related fields.
|
134
|
+
if (
|
135
|
+
window.SelectBox !== undefined &&
|
136
|
+
!SelectBox.cache[currentSelect.id]
|
137
|
+
) {
|
138
|
+
SelectBox.add_to_cache(select.id, option);
|
139
|
+
SelectBox.redisplay(select.id);
|
140
|
+
}
|
141
|
+
return;
|
142
|
+
}
|
143
|
+
|
144
|
+
option.textContent = newRepr;
|
145
|
+
option.value = newId;
|
146
|
+
});
|
147
|
+
}
|
148
|
+
|
149
|
+
function dismissAddRelatedObjectPopup(win, newId, newRepr) {
|
150
|
+
const name = removePopupIndex(win.name);
|
151
|
+
const elem = document.getElementById(name);
|
152
|
+
if (elem) {
|
153
|
+
const elemName = elem.nodeName.toUpperCase();
|
154
|
+
if (elemName === "SELECT") {
|
155
|
+
elem.options[elem.options.length] = new Option(
|
156
|
+
newRepr,
|
157
|
+
newId,
|
158
|
+
true,
|
159
|
+
true
|
160
|
+
);
|
161
|
+
updateRelatedSelectsOptions(elem, win, null, newRepr, newId);
|
162
|
+
} else if (elemName === "INPUT") {
|
163
|
+
if (
|
164
|
+
elem.classList.contains("vManyToManyRawIdAdminField") &&
|
165
|
+
elem.value
|
166
|
+
) {
|
167
|
+
elem.value += "," + newId;
|
168
|
+
} else {
|
169
|
+
elem.value = newId;
|
170
|
+
}
|
171
|
+
}
|
172
|
+
// Trigger a change event to update related links if required.
|
173
|
+
$(elem).trigger("change");
|
174
|
+
} else {
|
175
|
+
const toId = name + "_to";
|
176
|
+
const toElem = document.getElementById(toId);
|
177
|
+
const o = new Option(newRepr, newId);
|
178
|
+
SelectBox.add_to_cache(toId, o);
|
179
|
+
SelectBox.redisplay(toId);
|
180
|
+
if (toElem && toElem.nodeName.toUpperCase() === "SELECT") {
|
181
|
+
const skipIds = [name + "_from"];
|
182
|
+
updateRelatedSelectsOptions(toElem, win, null, newRepr, newId, skipIds);
|
183
|
+
}
|
184
|
+
}
|
185
|
+
const index = relatedWindows.indexOf(win);
|
186
|
+
if (index > -1) {
|
187
|
+
relatedWindows.splice(index, 1);
|
188
|
+
}
|
189
|
+
win.close();
|
190
|
+
}
|
191
|
+
|
192
|
+
function dismissChangeRelatedObjectPopup(win, objId, newRepr, newId) {
|
193
|
+
const id = removePopupIndex(win.name.replace(/^edit_/, ""));
|
194
|
+
const selectsSelector = interpolate("#%s, #%s_from, #%s_to", [id, id, id]);
|
195
|
+
const selects = $(selectsSelector);
|
196
|
+
selects
|
197
|
+
.find("option")
|
198
|
+
.each(function () {
|
199
|
+
if (this.value === objId) {
|
200
|
+
this.textContent = newRepr;
|
201
|
+
this.value = newId;
|
202
|
+
}
|
203
|
+
})
|
204
|
+
.trigger("change");
|
205
|
+
updateRelatedSelectsOptions(selects[0], win, objId, newRepr, newId);
|
206
|
+
selects
|
207
|
+
.next()
|
208
|
+
.find(".select2-selection__rendered")
|
209
|
+
.each(function () {
|
210
|
+
// The element can have a clear button as a child.
|
211
|
+
// Use the lastChild to modify only the displayed value.
|
212
|
+
this.lastChild.textContent = newRepr;
|
213
|
+
this.title = newRepr;
|
214
|
+
});
|
215
|
+
const index = relatedWindows.indexOf(win);
|
216
|
+
if (index > -1) {
|
217
|
+
relatedWindows.splice(index, 1);
|
218
|
+
}
|
219
|
+
win.close();
|
220
|
+
}
|
221
|
+
|
222
|
+
function dismissDeleteRelatedObjectPopup(win, objId) {
|
223
|
+
const id = removePopupIndex(win.name.replace(/^delete_/, ""));
|
224
|
+
const selectsSelector = interpolate("#%s, #%s_from, #%s_to", [id, id, id]);
|
225
|
+
const selects = $(selectsSelector);
|
226
|
+
selects
|
227
|
+
.find("option")
|
228
|
+
.each(function () {
|
229
|
+
if (this.value === objId) {
|
230
|
+
$(this).remove();
|
231
|
+
}
|
232
|
+
})
|
233
|
+
.trigger("change");
|
234
|
+
const index = relatedWindows.indexOf(win);
|
235
|
+
if (index > -1) {
|
236
|
+
relatedWindows.splice(index, 1);
|
237
|
+
}
|
238
|
+
win.close();
|
239
|
+
}
|
240
|
+
|
241
|
+
window.showRelatedObjectLookupPopup = showRelatedObjectLookupPopup;
|
242
|
+
window.dismissRelatedLookupPopup = dismissRelatedLookupPopup;
|
243
|
+
window.showRelatedObjectPopup = showRelatedObjectPopup;
|
244
|
+
window.updateRelatedObjectLinks = updateRelatedObjectLinks;
|
245
|
+
window.dismissAddRelatedObjectPopup = dismissAddRelatedObjectPopup;
|
246
|
+
window.dismissChangeRelatedObjectPopup = dismissChangeRelatedObjectPopup;
|
247
|
+
window.dismissDeleteRelatedObjectPopup = dismissDeleteRelatedObjectPopup;
|
248
|
+
window.dismissChildPopups = dismissChildPopups;
|
249
|
+
|
250
|
+
// Kept for backward compatibility
|
251
|
+
window.showAddAnotherPopup = showRelatedObjectPopup;
|
252
|
+
window.dismissAddAnotherPopup = dismissAddRelatedObjectPopup;
|
253
|
+
|
254
|
+
window.addEventListener("unload", function (evt) {
|
255
|
+
window.dismissChildPopups();
|
256
|
+
});
|
257
|
+
|
258
|
+
$(document).ready(function () {
|
259
|
+
setPopupIndex();
|
260
|
+
$("a[data-popup-opener]").on("click", function (event) {
|
261
|
+
event.preventDefault();
|
262
|
+
opener.dismissRelatedLookupPopup(window, $(this).data("popup-opener"));
|
263
|
+
});
|
264
|
+
$("body").on(
|
265
|
+
"click",
|
266
|
+
'.related-widget-wrapper-link[data-popup="yes"]',
|
267
|
+
function (e) {
|
268
|
+
e.preventDefault();
|
269
|
+
if (this.href) {
|
270
|
+
const event = $.Event("django:show-related", { href: this.href });
|
271
|
+
$(this).trigger(event);
|
272
|
+
if (!event.isDefaultPrevented()) {
|
273
|
+
showRelatedObjectPopup(this);
|
274
|
+
}
|
275
|
+
}
|
276
|
+
}
|
277
|
+
);
|
278
|
+
$("body").on("change", ".related-widget-wrapper select", function (e) {
|
279
|
+
const event = $.Event("django:update-related");
|
280
|
+
$(this).trigger(event);
|
281
|
+
if (!event.isDefaultPrevented()) {
|
282
|
+
updateRelatedObjectLinks(this);
|
283
|
+
}
|
284
|
+
});
|
285
|
+
$(".related-widget-wrapper select").trigger("change");
|
286
|
+
$("body").on("click", ".related-lookup", function (e) {
|
287
|
+
e.preventDefault();
|
288
|
+
const event = $.Event("django:lookup-related");
|
289
|
+
$(this).trigger(event);
|
290
|
+
if (!event.isDefaultPrevented()) {
|
291
|
+
showRelatedObjectLookupPopup(this);
|
292
|
+
}
|
293
|
+
});
|
294
|
+
});
|
295
|
+
}
|