-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use get_class for oscar_invoice.utils.InvoiceCreator #14
Comments
I think we can add the ability to set custom
@sasha0 @specialunderwear WDYT? |
Not ideal, but I found a workaround: get_class("oscar_invoices.utils", "InvoiceCreator") This way Oscar will try to load class from the local module. |
That seems pretty ok to me |
Hmm sorry, but how can you override the InvoiceCreator if we import like that?
|
I've got an idea to introduce a new setting and load OSCAR_INVOICES_INVOICE_CREATOR = getattr(settings, 'OSCAR_INVOICES_INVOICE_CREATOR', 'oscar_invoices.InvoiceCreator') WDYT @samitnuk @specialunderwear ? |
Hi we allready use the current method, which works in our stack. I don't think having 2 different methods would be a good idea. BTW are you guys both having the same idea? Or are you trying to push this feature??? |
Yeah, I've reviewed again the whole thread and realized that @samitnuk proposed the same at the beginning 😄 . |
Currently overriding oscar_invoice.utils.InvoiceCreator is non trivial because it is not loaded with get_class. The only way to make this possible is to add one more namespace to the application. Let's say we add a namespace called 'poepie' making the folder structure like this:
that would allow using get_class like this:
You can not use get_class with only 2 namespace levels, you CAN however use get_model (it is implemented completely different).
Please suggest the 3rd namespace name and I will create a PR.
The text was updated successfully, but these errors were encountered: