Code Monkey home page Code Monkey logo

Comments (3)

Timusan avatar Timusan commented on August 25, 2024 1

It makes sense to keep kind of a "point-in-time" data on the order, which cannot be altered by the customer itself once the order is complete. But I think this should still be something left up to the implementer. Using foreign keys would not negate point-in-time as the addresses referred to by those keys could be made non-manageable.

For example, I have created an OrderAddress model just for this on which the different address components are stored in a single model. An end user cannot edit this. If they would have an address stored on their profile those values would simply be copied over to an OrderAddress during checkout.

Having a shipping_address_id and billing_address_id as separate params in the JSON body would be a nice addition (instead of/or accompanying) full text addresses. Possible together with SALESMAN_ADDRESS_MODEL and/or SALESMAN_ADDRESS_SERIALIZER to point to the custom model/serializer that is used? Address objects are managed outside of Salesman (as this is indeed out of scope).

Also ... thanks a bunch for the awesome work already done on Salesman! And for keeping up with my ramblings ;)

from django-salesman.

dinoperovic avatar dinoperovic commented on August 25, 2024 1

I will look into adding such a feature, as soon as I get some free time :)

from django-salesman.

dinoperovic avatar dinoperovic commented on August 25, 2024

Adding SALESMAN_CHECKOUT_SERIALIZER seems like a good idea to me. I will look to add it as part of #29.

For the addresses, I did not include them to keep it simple (hence the strings for addresses) and figured we could pass the shipping_address_id param instead of full text address (which you can validate in SALESMAN_ADDRESS_VALIDATOR and return the address as text if you want).

You would setup a custom endpoint for addresses and handle them separately as this is usually handled by the user/account outside of the order context anyway.

Another reason for not using foreign keys for addresses is that you wish to keep the snapshot of an address that was used during the checkout, in a case that user has changed the address after the order was created. This of course depends on your system requirements.

I was considering adding address as a module to salesman, but also realise that they could be implemented in many different ways and would make it difficult to support.

from django-salesman.

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.