Thursday, July 1, 2021

Re: Sorting price and discount price (urgent)

Hi,

I will avoid using 'urgent'. The problem is as described above, I want to sort my products in ascending or descending price order which will include the discount price too if it exists. Right now, if there are two products, A and B; A being ₹900 and B being ₹1200 too but after discount, ₹ 800, the sorting order highest to lowest price is: B,A instead of A,B. As Shailesh asked, discount_price is a model field as I've given in the code about. And the 'fields = {'price': 'discount_price'}' is wrong after I searched a bit on the internet, kindly ignore that. 

Kindly suggest a way to include discount_price in the sorting parameter where it'll be considered instead of the original price itself. 

On Thu, 1 Jul, 2021, 4:06 pm Shailesh Yadav, <shaileshyadav7958@gmail.com> wrote:
yes, I agree with Kasper please don't use urgent  OR very urgent, and please describe your questions in detail.
from where you getting this discount_price and why you using the price key for two different values. (can you check by printing discount_price)


    fields={
            'price''price',
            'price':'discount_price'
        },



Thanks & Regards
Shailesh Yadav



On Thu, Jul 1, 2021 at 1:33 PM Aritra Ray <aritra805@gmail.com> wrote:
I tried to describe the problem but till my capability and it is urgent, not just for increasing the possibility of getting help. Thank you for your advice and help.

On Thu, 1 Jul, 2021, 1:30 pm Kasper Laudrup, <laudrup@stacktrace.dk> wrote:
On 7/1/21 8:03 AM, Aritra Ray wrote:
> I am facing a problem in including the discount_price into consideration
> when sorting price through the products. Kindly help me to do so. The
> below attached files are filters.py, views.py and  models.py.
>

Instead of writing "urgent" in hope it will increase your chances of
getting help faster, you'll have a much better chance of getting some
useful help if you spend some time describing the exact problem you have
instead of just "a problem".

This might help you:

https://betterprogramming.pub/how-to-ask-questions-about-programming-dcd948fcd2b

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0c454b7d-cb51-ea95-d0e8-ca4be0c2bad7%40stacktrace.dk.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFecadvpnYg3CWXRtZfNjWpLPbd4KyqndZ5EdmVUmaP_dbvR0Q%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMQ-AEVPDkAeFihwbd1xYWNskvUc8zta-9FZW1ePr_rYZ0vnGA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFecaduF3yum-%2BXVDqYTmcaBgSK5UajT8tBYYyErWGoJe7FsAw%40mail.gmail.com.

No comments:

Post a Comment