Skip to content

Conversation

eddyraz
Copy link
Contributor

@eddyraz eddyraz commented Feb 13, 2025

… overriding the ModelAdmin.get_changelist() method

… overriding the ModelAdmin.get_changelist() method
Copy link
Owner

@ishakoktn ishakoktn left a comment

Choose a reason for hiding this comment

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

Hi Eddy, thanks for your time and awesome work.

Could please make these changes?

remove = []

# Get the original query string
query_string = super().get_query_string(new_params, remove)
Copy link
Owner

Choose a reason for hiding this comment

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

We could sort this function from the start of this line as below.

 # If search fields exist, add them to new_params
if self.model_admin._selected_search_fields:
    new_params.update({
        'search-fields': self.model_admin._selected_search_fields
    })

# Get the query string with all parameters
return super().get_query_string(new_params, remove)

self.search_fields = original_search_fields

#To vew the returned results in dev mode.
#print(results)
Copy link
Owner

Choose a reason for hiding this comment

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

could you please delete comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK I will do it today.

if request.GET:
request.GET._mutable = True
try:
print(request.GET.pop("request-fields", None))
Copy link
Owner

Choose a reason for hiding this comment

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

please delete print statement

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