django-filter

Django-filter, how to make multiple fields search? (with django-filter!)

Django-filter, how to make multiple fields search? (with django-filter!) Question: How can I make multiple fields search with Django-filter from model like: class Location(models.Model): loc = models.CharField(max_length=100, blank=True) loc_mansioned = models.CharField(max_length=100, blank=True) loc_country = models.CharField(max_length=100, blank=True) loc_modern = models.CharField(max_length=100, blank=True) I need one input field on my website, that can search over all fields of …

Total answers: 4

How to filter an object with choice filed values in django_filter

How to filter an object with choice filed values in django_filter Question: I have following choice field in my model IPInfo class IPInfoModel(models.Model): TYPE_INTRANET = 1 TYPE_INTERNET = 2 IP_TYPES = ( (TYPE_INTRANET, u’INTRANET’), (TYPE_INTERNET, u’INTERNET’), ) ip = models.GenericIPAddressField(“IP”, unique=True) ip_type = models.SmallIntegerField(choices=IP_TYPES) and I use django_filters to filter IPInfo. from django_filters import rest_framework …

Total answers: 2

django-filter use paginations

django-filter use paginations Question: I’m using the django-filter package to provide a search functionality on my List View. Now I want to add a pagination to that view as well. I’m trying to combine pagination to a filtered queryset, but I have no clue on how to go on. So far, I have tried the …

Total answers: 11

How to exclude two conditions in query via Django ORM?

How to exclude two conditions in query via Django ORM? Question: How can I exclude by two conditions which are connected via a logical OR: Object.objects.filter(country_send=country).exclude(status__exact=”).order_by(‘-id’) Object.objects.filter(country_send=country).exclude(status__exact=’deleted’).order_by(‘-id’) I’m trying to exclude the object with no status and status "deleted". Asked By: user3657840 || Source Answers: You can try using “lists”. On status list you can …

Total answers: 4