Re: Kindly help me with Django filer, urgent need.

2021-06-25 Thread Aritra Ray
Right, kindly heed to the problem as early as possible, The GitHub link is
provided below.
https://github.com/First-project-01/Django-ecommerce/issues/12

On Fri, 25 Jun 2021 at 19:34, Symaxx  wrote:

> This is easier to work with on GitHub, do you have a GitHub account?
>
> You can raise an issue then share the link here 
>
> On Fri, 25 Jun 2021, 3:04 PM Aritra Ray,  wrote:
>
>> Hi,
>> This is my second request regarding the same issue. I've been building a
>> Django E-commerce website and I'm facing problems filtering the product
>> according to price. I used django-filter to filter category and size.
>> Please suggest a solution for price in the following manner: Latest
>> products, Lowest to Highest and Highest to Lowest. I've made some progress
>> in the template without using django-filter. Kindly help me tie it up with
>> the backend.
>>
>> Do let me know if anything else is needed.
>> Thanks for your help in advance
>>
>> Regards,
>> Aritra
>>
>> #products-html
>>  
>> 
>>   
>>   
>> {{filter.form|crispy}}
>> 
>>   Select sorting criteria
>>   
>>   
>>   
>>   > '-date_added' %}selected{% endif %}>Latest collection
>>   >  %} selected {% endif %}>Lowest to Highest
>>   >  %} selected {% endif %}>Highest to Lowest
>>   
>>   
>>   
>>   
>> > class="glyphicon glyphicon-search"> Search
>> 
>>   
>> 
>>
>> #views.py
>>
>> class Product(ListView):
>> model = Items
>> paginate_by = 6
>> template_name = 'products.html'
>> ordering = ["-id"]
>>
>> def get_queryset(self):
>> queryset = super().get_queryset()
>> filter = ProductFilter(self.request.GET, queryset)
>> return filter.qs
>>
>> def get_context_data(self, **kwargs):
>> context = super().get_context_data(**kwargs)
>> queryset = self.get_queryset()
>> filter = ProductFilter(self.request.GET, queryset)
>> context["filter"] = filter
>> return context
>>
>> # filters.py
>> import django_filters
>> from .models import Items
>>
>> class ProductFilter(django_filters.FilterSet):
>> class Meta:
>> model = Items
>> fields = ['size', 'category']
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFecadt5eYOdDX3sL46kbscLfbhwAzEcvwUpM9TF_s%2B9YhBGVQ%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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANPYDAtyWhqy%3DGM%3DEGpwVrUFDrTuctmgpN4xPcrLyKYgOv23cg%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFecaduYnX1yYU-f1B2rOKZjX4_XnU-%2BVDGVPZan4DikY_e19A%40mail.gmail.com.


Re: Kindly help me with Django filer, urgent need.

2021-06-25 Thread Symaxx
This is easier to work with on GitHub, do you have a GitHub account?

You can raise an issue then share the link here 

On Fri, 25 Jun 2021, 3:04 PM Aritra Ray,  wrote:

> Hi,
> This is my second request regarding the same issue. I've been building a
> Django E-commerce website and I'm facing problems filtering the product
> according to price. I used django-filter to filter category and size.
> Please suggest a solution for price in the following manner: Latest
> products, Lowest to Highest and Highest to Lowest. I've made some progress
> in the template without using django-filter. Kindly help me tie it up with
> the backend.
>
> Do let me know if anything else is needed.
> Thanks for your help in advance
>
> Regards,
> Aritra
>
> #products-html
>  
> 
>   
>   
> {{filter.form|crispy}}
> 
>   Select sorting criteria
>   
>   
>   
>'-date_added' %}selected{% endif %}>Latest collection
> selected {% endif %}>Lowest to Highest
> %} selected {% endif %}>Highest to Lowest
>   
>   
>   
>   
>  class="glyphicon glyphicon-search"> Search
> 
>   
> 
>
> #views.py
>
> class Product(ListView):
> model = Items
> paginate_by = 6
> template_name = 'products.html'
> ordering = ["-id"]
>
> def get_queryset(self):
> queryset = super().get_queryset()
> filter = ProductFilter(self.request.GET, queryset)
> return filter.qs
>
> def get_context_data(self, **kwargs):
> context = super().get_context_data(**kwargs)
> queryset = self.get_queryset()
> filter = ProductFilter(self.request.GET, queryset)
> context["filter"] = filter
> return context
>
> # filters.py
> import django_filters
> from .models import Items
>
> class ProductFilter(django_filters.FilterSet):
> class Meta:
> model = Items
> fields = ['size', 'category']
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFecadt5eYOdDX3sL46kbscLfbhwAzEcvwUpM9TF_s%2B9YhBGVQ%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANPYDAtyWhqy%3DGM%3DEGpwVrUFDrTuctmgpN4xPcrLyKYgOv23cg%40mail.gmail.com.