-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
Update admin.py #467
Update admin.py #467
Conversation
add extra_context to history_form_view
fix tests
Codecov Report
@@ Coverage Diff @@
## master #467 +/- ##
=========================================
+ Coverage 97.09% 97.1% +<.01%
=========================================
Files 15 15
Lines 689 690 +1
Branches 96 96
=========================================
+ Hits 669 670 +1
Misses 10 10
Partials 10 10
Continue to review full report at Codecov.
|
@ozeranskiy can you add some more context about this change? Also, add the change to |
update and sort AUTHORS
Done. class SimpleHistoryAdminMixin(SimpleHistoryAdmin):
def history_form_view(self, request, object_id, version_id, extra_kwargs=None):
extra_kwargs = extra_kwargs or {}
extra_kwargs['obj'] = 'My data'
return super(SimpleHistoryAdminMixin, self).history_form_view(
request, object_id, version_id, extra_context=extra_kwargs
) This is necessary if you need to pass custom parameters to the template "simple_history/object_history_form.html" |
@@ -107,7 +107,8 @@ def response_change(self, request, obj): | |||
return super(SimpleHistoryAdmin, self).response_change( | |||
request, obj) | |||
|
|||
def history_form_view(self, request, object_id, version_id): | |||
def history_form_view(self, request, object_id, version_id, | |||
extra_context=None): |
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.
extra_context
is None
by default, so you shouldn't have to add it here. Try to add separate tests where extra_context
has an actual value and passes through
Hey @ozeranskiy are you still working on this or want me to take it over? |
In the near future I can not write a test. Can you accept the current state? |
I can take it over and add some additional tests this week. I'm not a fan of merge now and add tests later because it's easy to lose track of that work. Thanks for your contribution! |
ok, thanks you. |
Opened #499 so I'll close this. Thanks again! |
add extra_context to history_form_view
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: