You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for this pull request. Rendering the previous and next siblings of a product, may really be useful in some situations.
Just some points I would have done differently:
Instead of using a tag named one_product, I would use something such as with_direct_siblings.
Don't change the semantics of the method get_object(), this should always return one and only one product. Instead add another method named say get_object_with_direct_siblings() .
But in general looking at your code, how does this view function behave, if someone filters by a certain product tag, or uses the search input field? Where is that information kept while rendering the product's detail view?
For this we have three possible solutions. Add this filtering information to the session, or to a cookie or as a request parameter. The latter generates ugly URLs for the detail view. Session could be problematic, because in django-SHOP the session_id is generated only after adding the first product to the cart, or as logged in user. So the remaining possibility is a cookie.
Let's discuss this on a chat.
haricot
changed the title
ProductRetrieveView:param:one_product if False return pre,cur,nex products to the context
ProductRetrieveView:param:with_direct_siblings if True return pre,cur,nex products to the context
Apr 8, 2020
haricot
changed the title
ProductRetrieveView:param:with_direct_siblings if True return pre,cur,nex products to the context
ProductRetrieveView:param:with_direct_siblings if True return pre,nex products to the context and direct_siblings
Apr 9, 2020
haricot
changed the title
ProductRetrieveView:param:with_direct_siblings if True return pre,nex products to the context and direct_siblings
ProductRetrieveView:param:with_direct_siblings if True return pre,nex products to the context and direct_siblings in serializer
Apr 9, 2020
haricot
changed the title
ProductRetrieveView:param:with_direct_siblings if True return pre,nex products to the context and direct_siblings in serializer
ProductRetrieveView:param:with_direct_siblings if True return product_pre,product_next to the context and direct_siblings in serializer
Apr 9, 2020
haricot
changed the title
ProductRetrieveView:param:with_direct_siblings if True return product_pre,product_next to the context and direct_siblings in serializer
ProductRetrieveView:param:with_direct_siblings if True return product_pre, product_next to the context and direct_siblings in serializer
Apr 9, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Same things as the linked pull request #734 but reviewed in a simpler way.