Git Product home page Git Product logo

Comments (7)

chrisglass avatar chrisglass commented on July 22, 2024

Of all things, I would have least expected people wanting to change the cart model :)

This makes some sense, even though I generally don't like using the django settings for this (even though I used this trick for the address model already).
Would a signal be suitable for this task instead, maybe?

from django-shop.

thoas avatar thoas commented on July 22, 2024

I don't think a signal is the right answer for my case but I could be wrong.

I'm currently checking the stock of a product in the clean method of the CartItem model for the need of my application.
Because there is no option to override default models I have to use the "add_to_class" method to inject my method in those models.

I certainly will have others use cases in the next few days.

Thank you for your quick answer ;)

from django-shop.

chrisglass avatar chrisglass commented on July 22, 2024

Alright, I think I'll use the same settings-based approach as I have for the addressmodel, with a new optional setting (something like SHOP_CART_MODEL or similar)

I will however not isolate the cart in its own django app this time, so you will have "my" Cart table lying around. Is that ok?

from django-shop.

thoas avatar thoas commented on July 22, 2024

ok for me.

Sorry for the delay.

from django-shop.

zeus avatar zeus commented on July 22, 2024

Fully agree, cart/order/.. models should be replacable through settings. We have powerfull python duck typing to do that.

from django-shop.

chrisglass avatar chrisglass commented on July 22, 2024

I have commited some changes that should fix this issue. Please see the relevant documentation, and reopen this ticket if it doesn't suit your needs somehow :)

from django-shop.

thoas avatar thoas commented on July 22, 2024

Neat, thank you for your time I will have to replace all my (bad) monkey patches with this approach now.

BTW, our presale service is powered by django-shop ;)

from django-shop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.