-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
Fix BaseEntityAdmin #239
Fix BaseEntityAdmin #239
Conversation
- Fixes missing `Add another` button for inlines in `BaseEntityAdmin` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
# Infer correct data from the form. | ||
fieldsets = self.fieldsets or [(None, {'fields': form.fields.keys()})] | ||
adminform = admin.helpers.AdminForm(form, fieldsets, self.prepopulated_fields) | ||
media = mark_safe(self.media + adminform.media) | ||
media = mark_safe(media + adminform.media) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using Django 3.2
When I created class ProductAdmin(BaseEntityAdmin)
the Add another
button for inline fields disappeared.
This happens because the self.media
returns this and there is no admin/js/inlines.js
there by default.
The Add another
button for inlines is added on the fly by admin/js/inlines.js script.
The context["media"]
contains current/nessasary form assets to create the button.
Codecov Report
@@ Coverage Diff @@
## master #239 +/- ##
==========================================
+ Coverage 89.98% 90.00% +0.01%
==========================================
Files 22 22
Lines 759 760 +1
Branches 135 135
==========================================
+ Hits 683 684 +1
Misses 52 52
Partials 24 24
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Thank you! |
I'm helping!
Checklist
CHANGELOG.md
Pull Request type
Please check the type of change your PR introduces:
Related issue(s)
Other Information