Hi everyone,
I’m using Oscar + Django and I have a functioning website.
I’m trying to override the SearhForm class by the usual steps (app forking) but seems that the ‘search’ method cannot be override from the child class…
Here the code in my custom app:
from oscar.apps.search.forms import SearchForm as CoreSearchForm
class SearchForm(CoreSearchForm):
def search(self):
print(" --------- CHILD METHOD -----------")
I’ve added to the original parent class (inside oscar.apps.search.forms) for the debug some prints like so:
class SearchForm(FacetedSearchForm):
...
def search(self):
print(" --------- PARENT METHOD -----------")
sqs = super(FacetedSearchForm, self).search()
print("1. sqs: ", list([e['pk'] for e in sqs.values('pk')]))
...
print("2. sqs: ", list([e['pk'] for e in sqs.values('pk')]))
return sqs
Here the output when I perform some product sorting:
--------- PARENT METHOD -----------
haystack.forms - SearchForm: 'search()'
1. sqs: ['10', '1', '4', '7']
2. sqs: ['4', '1', '10', '7']
[05/Jul/2025 17:34:50] "GET /shop/catalogue/?q=&sort_by=price-asc HTTP/1.1" 200 65452
So it seems the child method has not been called…
Anyone can understand what is happening?
Thank you in advance for any help!