Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # the view code
- def company_list(request):
- qs = Company.objects.all()
- # custom filter using django-filters
- f = CompanyFilter(request.GET, queryset=qs)
- return object_list(request,
- extra_context={'filter': f},
- queryset=f.qs.distinct(),
- template_name='supplier/company/list.html',
- template_object_name='company',
- paginate_by=30)
- # part of the model code
- class Company(models.Model):
- regions = models.ManyToManyField(Region, blank=True, null=True)
- categories = models.ManyToManyField(Category, blank=True, null=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement