Skip to content

Commit

Permalink
fix typos, annotations. cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cocorocho committed Jan 9, 2024
1 parent aefbfe0 commit 67d43ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions import_export/forms.py
Expand Up @@ -141,7 +141,7 @@ def _create_boolean_fields(self, resource: ModelResource) -> None:
def create_boolean_field_name(resource: ModelResource, field_name: str) -> str:
"""
Create field name by combining `resource_name` + `field_name` to prevent
confliction between resource fields with same name
conflict between resource fields with same name
Example:
BookResource + name -> bookresource_name
Expand Down Expand Up @@ -181,9 +181,6 @@ def _remove_unselected_resource_fields(
self.cleaned_data = _cleaned_data

def get_selected_resource(self):
"""
Get selected resource
"""
if not getattr(self, "cleaned_data", None):
raise forms.ValidationError(
_("Form is not validated, call `is_valid` first")
Expand All @@ -198,7 +195,7 @@ def get_selected_resource(self):
pass
return self.resources[resource_index]

def _normalize_resource_fields(self, selected_resource: ModelResource) -> dict:
def _normalize_resource_fields(self, selected_resource: ModelResource) -> None:
"""
Field names are combination of resource_name + field_name,
normalize field names by removing resource name
Expand Down
4 changes: 2 additions & 2 deletions import_export/mixins.py
Expand Up @@ -102,7 +102,7 @@ def choose_export_resource_class(self, form):
def get_export_resource_kwargs(self, request, **kwargs):
return self.get_resource_kwargs(request, **kwargs)

def get_export_resource_fields_from_from(self, form):
def get_export_resource_fields_from_form(self, form):
if isinstance(form, SelectableFieldsExportForm):
export_fields = form.get_selected_resource_export_fields()
if export_fields:
Expand All @@ -114,7 +114,7 @@ def get_data_for_export(self, request, queryset, **kwargs):
export_form = kwargs.get("export_form")
export_class = self.choose_export_resource_class(export_form)
export_resource_kwargs = self.get_export_resource_kwargs(request, **kwargs)
export_fields = self.get_export_resource_fields_from_from(export_form)
export_fields = self.get_export_resource_fields_from_form(export_form)
cls = export_class(**export_resource_kwargs)
export_data = cls.export(
queryset=queryset, export_fields=export_fields, **kwargs
Expand Down

0 comments on commit 67d43ca

Please sign in to comment.