Repository: django-import-export/django-import-export

Issue:
Issue with example get_queryset for a widget
`import_data_inner` passes kwargs through `self.import_row()` which make their way to widgets via a `clean()` which does;

```
value = self.widget.clean(value, row=data, **kwargs)
```

This works well for the default `get_queryset()` of the `ForeignKeyWidget`, but the example code within is incorrect;

```
    def get_queryset(self, value, row, *args, **kwargs):
        """
        Returns a queryset of all objects for this Model.

        Overwrite this method if you want to limit the pool of objects from
        which the related object is retrieved.

        :param value: The field's value in the datasource.
        :param row: The datasource's current row.

        As an example; if you'd like to have ForeignKeyWidget look up a Person
        by their pre- **and** lastname column, you could subclass the widget
        like so::

            class FullNameForeignKeyWidget(ForeignKeyWidget):
                def get_queryset(self, value, row):
                    return self.model.objects.filter(
                        first_name__iexact=row["first_name"],
                        last_name__iexact=row["last_name"]
                    )
        """
        return self.model.objects.all()
```
Taking the example from the docstring here results in an unexpected keyword of `row_number`.

**To Reproduce**
Steps to reproduce the behavior:
1. Implement a widget subclass as seen in the above docstring
2. Run an import
3. Observe the error

**Versions (please complete the following information):**
 - Django Import Export: 2.7.1
 - Python: 3.8
 - Django: 3.2

**Expected behavior**
The included example code should function correctly.

**Additional context**

```
Traceback (most recent call last):
File "/Users/mwalker/Sites/super-halfs/.venv/lib/python3.8/site-packages/import_export/resources.py", line 691, in import_row
self.import_obj(instance, row, dry_run, **kwargs)
File "/Users/mwalker/Sites/super-halfs/.venv/lib/python3.8/site-packages/import_export/resources.py", line 541, in import_obj
self.import_field(field, obj, data, **kwargs)
File "/Users/mwalker/Sites/super-halfs/.venv/lib/python3.8/site-packages/import_export/resources.py", line 524, in import_field
field.save(obj, data, is_m2m, **kwargs)
File "/Users/mwalker/Sites/super-halfs/.venv/lib/python3.8/site-packages/import_export/fields.py", line 110, in save
cleaned = self.clean(data, **kwargs)
File "/Users/mwalker/Sites/super-halfs/.venv/lib/python3.8/site-packages/import_export/fields.py", line 66, in clean
value = self.widget.clean(value, row=data, **kwargs)
File "/Users/mwalker/Sites/super-halfs/results/resources/widgets.py", line 75, in clean
return self.get_queryset(value, row, *args, **kwargs).get(
TypeError: get_queryset() got an unexpected keyword argument 'row_number'
```

I'll raise a PR for this now.



Discussion:
Thanks for this. Same issue as #1385.

Resolving patch:
diff --git a/import_export/widgets.py b/import_export/widgets.py
--- a/import_export/widgets.py
+++ b/import_export/widgets.py
@@ -392,7 +392,7 @@ def get_queryset(self, value, row, *args, **kwargs):
         like so::
 
             class FullNameForeignKeyWidget(ForeignKeyWidget):
-                def get_queryset(self, value, row):
+                def get_queryset(self, value, row, *args, **kwargs):
                     return self.model.objects.filter(
                         first_name__iexact=row["first_name"],
                         last_name__iexact=row["last_name"]


Test patch:
diff --git a/tests/core/tests/test_widgets.py b/tests/core/tests/test_widgets.py
--- a/tests/core/tests/test_widgets.py
+++ b/tests/core/tests/test_widgets.py
@@ -293,7 +293,7 @@ def test_render_empty(self):
 
     def test_clean_multi_column(self):
         class BirthdayWidget(widgets.ForeignKeyWidget):
-            def get_queryset(self, value, row):
+            def get_queryset(self, value, row, *args, **kwargs):
                 return self.model.objects.filter(
                     birthday=row['birthday']
                 )
@@ -304,6 +304,18 @@ def get_queryset(self, value, row):
         row = {'name': "Foo", 'birthday': author2.birthday}
         self.assertEqual(birthday_widget.clean("Foo", row), author2)
 
+    def test_invalid_get_queryset(self):
+        class BirthdayWidget(widgets.ForeignKeyWidget):
+            def get_queryset(self, value, row):
+                return self.model.objects.filter(
+                    birthday=row['birthday']
+                )
+
+        birthday_widget = BirthdayWidget(Author, 'name')
+        row = {'name': "Foo", 'age': 38}
+        with self.assertRaises(TypeError):
+            birthday_widget.clean("Foo", row, row_number=1)
+
     def test_render_handles_value_error(self):
         class TestObj(object):
             @property