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

Add kwargs to import_row, import_object and import_field #1190

Merged
merged 6 commits into from Jul 12, 2021

Conversation

marcoaurelioneto
Copy link
Contributor

Added in resources.py kwargs on def import_row line 506, def import_object line 359 and def import_field line 348. Because I need the user id of the reqisition that is in kwargs, on import_field def. I need this user to filter objects by my permission system on a manager of the class.

Signed-off-by: GabrielPetz gabriel.petz.simepar@gmail.com

Problem
I have a customized permission system to different users, so I need them id before import fields, in my case I need subscribe this method import_field, adding the user of request.

Solution

How did you solve the problem?
The solution for my problem has been adding in resources.py argument kwargs on functions import_row line 506, import_object line 359 and import_field line 348

Acceptance Criteria

There is no need to write a different test, the test_resource.py file already calls the import_data > import_data_inner > import_row > import_obj > import_field , then the class of tests already coverage the changes. My changes are in bold.
There is no need to screenshots, because my changes are just in resources.py, there is no other changes.

I just added kwargs argument on functions, so there is no need to docs in function body to describe it.

GabrielPetz and others added 6 commits May 28, 2019 11:31
…bject line 359 and def import_field line 348. Because I need the user id of the reqisition that is in kwargs, on import_field def. I need this user to filter objects by my permission system on a manager of the class.

Signed-off-by: GabrielPetz <gabriel.petz.simepar@gmail.com>
…tion.py. Because the change that I have done influence the import_obj function

Signed-off-by: GabrielPetz <gabriel.petz.simepar@gmail.com>
…e change that I have done influence the import_obj function

Signed-off-by: GabrielPetz <gabriel.petz.simepar@gmail.com>
…, 101 and 110. I've added into resources.py a kwargs arg to, it was in def import_field when it calls field.save, in line 354.

Signed-off-by: GabrielPetz <gabriel.petz.simepar@gmail.com>
@coveralls
Copy link

coveralls commented Oct 6, 2020

Coverage Status

Coverage remained the same at 96.74% when pulling 4108d63 on simepar:kwargs_user_fix into cd06c59 on django-import-export:master.

@andrewgy8
Copy link
Member

andrewgy8 commented Dec 11, 2020

Thanks for the contribution! Is this good to go to master?

@marcoaurelioneto
Copy link
Contributor Author

Yes, i think so.

@andrewgy8 andrewgy8 merged commit f226bcf into django-import-export:main Jul 12, 2021
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.

None yet

3 participants