Comments (3)
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.
I will look into adding such a feature, as soon as I get some free time :)
from django-salesman.
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)
- ExtraRowSerializer in basket modifiers should include request in context
- Stock Handling HOT 8
- item_validate is called twice per item HOT 1
- Wagtail 4.x support HOT 2
- How long will django-salesman be maintained? More Maintainers needed? HOT 3
- Modify payment_methods_pool HOT 4
- Documentation - Wagtail Admin HOT 2
- Store custom data on Order HOT 1
- Multiple checkout steps - A checkout model HOT 3
- Django 4.2 support HOT 3
- Wagtail 6 Support HOT 2
- Swappable models incorrectly documented to work with Django<4 HOT 1
- Inherited PaymentMethod not shown as choice HOT 2
- Checkout serializer missing `allow_blank=True`
- Add label to order payment HOT 1
- Remove basket item by PUTing quantity of 0
- Add PATCH endpoint for basket item "extra" data
- Allow non-integer primary keys HOT 2
- Remove address fields or make them optional. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-salesman.