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

Fix BaseEntityAdmin #239

Merged
merged 1 commit into from
Sep 1, 2022
Merged

Fix BaseEntityAdmin #239

merged 1 commit into from
Sep 1, 2022

Conversation

mikalai-hryb
Copy link
Contributor

I'm helping!

Checklist

  • I have double checked that there are no unrelated changes in this pull request (old patches, accidental config files, etc.)
  • I have created at least one test case for the changes I have made
  • I have updated the documentation for the changes I have made
  • I have added my changes to the CHANGELOG.md

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

Related issue(s)

Other Information

Comment on lines +11 to +12
- Fixes missing `Add another` button for inlines in `BaseEntityAdmin`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before fix
before_fix

after fix
after_fix


# 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)
Copy link
Contributor Author

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
Copy link

codecov bot commented Aug 31, 2022

Codecov Report

Merging #239 (5760f20) into master (883ddfa) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            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              
Impacted Files Coverage Δ
eav/admin.py 68.42% <100.00%> (+0.85%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@mikalai-hryb mikalai-hryb changed the title fix BaseEntityAdmin Fix BaseEntityAdmin Aug 31, 2022
@Dresdn Dresdn merged commit d39eb45 into jazzband:master Sep 1, 2022
@Dresdn
Copy link
Contributor

Dresdn commented Sep 1, 2022

Thank you!

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

Successfully merging this pull request may close these issues.

2 participants