Skip to content
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

Support for multiple models #23

Open
Matt-Deacalion opened this issue Nov 11, 2015 · 2 comments
Open

Support for multiple models #23

Matt-Deacalion opened this issue Nov 11, 2015 · 2 comments

Comments

@Matt-Deacalion
Copy link

I would like to have two carts on a single web site, which is easy enough - but I would like each one to work on a different model. I think the best way would be to add an optional model kwarg to the Cart __init__ method, then have get_product_model use the specified model if it exists, otherwise it falls back to the current behaviour.

Is this something done before? if it's useful, could I do a pull request for it?

@Matt-Deacalion
Copy link
Author

I went another way with this. I made Django Carton model agnostic, so it doesn't need to know in advance what product model it's dealing with. My real world use is that my cart needs to be able to deal with both Merchandise and Ticket models.

The code is here: Matt-Deacalion@1e17a0f

If you're interested in accepting it upstream I'll clean it up and do a pull request. The changes are all backwards compatible.

@olivierdalang
Copy link

Hi !

I'd love this too. Wouldn't it be quite easy using the content types framework ?

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

No branches or pull requests

2 participants