Reputation: 105
model.py
class Venue(models.Model):
place = models.CharField(max_length=50)
venue_Name = models.CharField(max_length=100)
rent = models.IntegerField()
parking_area = models.IntegerField()
def __unicode__(self):
return self.venue_Name
i want to filter this model using places which is selected in a droupdown list in one page when press filter display the model values from the database. though i read django doc i didnt understand the process of filtering
Upvotes: 0
Views: 33
Reputation: 105
Venue.objects.filter(place= a[0])
a[0] being the value received from drop-down list
Upvotes: 0
Reputation: 12092
This is the part in the documentation you should be looking at - https://docs.djangoproject.com/en/dev/topics/db/queries/#retrieving-specific-objects-with-filters
The query that filters model values from the database is:
Venue.objects.filter(place='<dropdown-select>')
Upvotes: 1