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 on terminal 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!




-- 
https://github.com/django-oscar/django-oscar
http://django-oscar.readthedocs.org/en/latest/
--- 
You received this message because you are subscribed to the Google Groups 
"django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-oscar+unsubscr...@googlegroups.com.
To view this discussion, visit 
https://groups.google.com/d/msgid/django-oscar/b3a52320-9f41-43c6-876d-677d3b8469c4n%40googlegroups.com.

Reply via email to