title: Dropdown select option to filter a Django list
body: <p>Coming from Angular, this was easy to do, but I am not sure where to begin on creating a dropdown form that will filter from a list of objects.  Basically, I have the code below, that will pull in and display all real estate listings; I would like to create a dropdown that will have 2 selections, 'Featured' and 'New Listing' and when a user selects one, the list will filter out and display only those listings that match.  Thank you for your help.</p>
  
  <p><strong>Here is my model</strong></p>
  
  <pre><code>from django.db import models
  from django.utils import timezone
  
  
  class Listing(models.Model):
      FAIR = 'FAIR'
      GOOD = 'GOOD'
      VERY_GOOD = 'VERY_GOOD'
      EXCELLENT = 'EXCELLENT'
  
      NEW_LISTING = 'NEW_LISTING'
      PRICE_REDUCED = 'PRICE_REDUCED'
      UNDER_AGREEMENT = 'UNDER_AGREEMENT'
      SOLD = 'SOLD'
  
      YES = 'YES'
      NO = 'NO'
  
      FULL_SERVICE = 'FULL_SERVICE'
      FOR_LEASE = 'FOR_LEASE'
      WITH_REAL = 'WITH_REAL'
      QUICK_SERVE = 'QUICK_SERVE'
  
      CONDITION_CHOICES = (
          ('FAIR', 'Fair'),
          ('GOOD', 'Good'),
          ('VERY_GOOD', 'Very Good'),
          ('EXCELLENT', 'Excellent'),
      )
  
      STATUS_CHOICES = (
          ('NEW_LISTING', 'New Listing'),
          ('PRICE_REDUCED', 'Price Reduced'),
          ('UNDER_AGREEMENT', 'Under Agreement'),
          ('SOLD', 'Sold'),
      )
  
      FEATURED_CHOICES = (
          ('YES', 'Yes'),
          ('NO', 'No'),
      )
  
      LOCATION_TYPE = (
          ('FULL_SERVICE', 'Full Service'),
          ('FOR_LEASE', 'For Lease'),
          ('WITH_REAL', 'With Real'),
          ('QUICK_SERVE', 'Quick Serve'),
      )
  
      photo = models.ImageField(upload_to="media/properties/", max_length=250, blank=True, null=True)
      broker = models.ForeignKey('auth.User')
      phone = models.CharField(max_length=20, null=True)
      title = models.CharField(max_length=250, null=True)
      description = models.TextField(null=True)
      concept = models.CharField(max_length=250, null=True)
      location = models.CharField(max_length=250, null=True)
      size = models.CharField(max_length=250, null=True)
      seating = models.CharField(max_length=250, null=True)
      condition_choices = models.CharField(max_length=20, choices=CONDITION_CHOICES, blank=True)
      hours = models.CharField(max_length=250, null=True)
      asking_price = models.CharField(max_length=250, null=True)
      sales_price = models.CharField(max_length=250, null=True)
      rent_price = models.CharField(max_length=250, null=True)
      lease_terms = models.CharField(max_length=250, null=True)
      licenses = models.CharField(max_length=250, null=True)
      parking = models.CharField(max_length=250, null=True)
      status_choices = models.CharField(max_length=20, choices=STATUS_CHOICES, blank=True, null=True)
      featured_choices = models.CharField(max_length=5, choices=FEATURED_CHOICES, blank=True, null=True)
      location_type = models.CharField(max_length=20, choices=LOCATION_TYPE, blank=True, null=True)
      created_date = models.DateTimeField(default=timezone.now, null=True)
      published_date = models.DateTimeField(default=timezone.now, null=True)
  
      listing_order = models.PositiveIntegerField(default=0, blank=False, null=False)
  
      class Meta(object):
          ordering = ('listing_order',)
  
      def publish(self):
          """This is a docstring"""
          self.published_date = timezone.now()
          self.save()
  
      def __str__(self):
          return self.title
  </code></pre>
  
  <p><strong>And here is my template</strong></p>
  
  <pre><code>{% extends "listing/base.html" %}{% load staticfiles %}
  
  {% block content %}
  
    &lt;section class="listings mt64 mb64"&gt;
      &lt;div class="container"&gt;
        {% for listing in listings %}
          &lt;div class="row"&gt;
            &lt;div class="col-md-4"&gt;
              &lt;div class="listings-photo" style="background: #ccc url('{{ MEDIA_URL }}{{ listing.photo.name }}')no-repeat 50% 50%; background-size: cover; width: 350px; height: 220px"&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;div class="col-md-8"&gt;
              &lt;h3 class="uppercase"&gt;{{ listing.title }}&lt;/h3&gt;
  
              &lt;p&gt;&lt;span class="listings-title"&gt;Description:&lt;/span&gt; {{ listing.description }}&lt;/p&gt;
  
              &lt;div class="row"&gt;
                &lt;div class="col-md-6"&gt;
                  &lt;ul&gt;
                    &lt;li&gt;&lt;span class="listings-title"&gt;Concept:&lt;/span&gt; {{ listing.concept }}&lt;/li&gt;
                    &lt;li&gt;&lt;span class="listings-title"&gt;Location:&lt;/span&gt; {{ listing.location }}&lt;/li&gt;
                    &lt;li&gt;&lt;span class="listings-title"&gt;Size:&lt;/span&gt; {{ listing.size }}&lt;/li&gt;
                    &lt;li&gt;&lt;span class="listings-title"&gt;Seating:&lt;/span&gt; {{ listing.seating }}&lt;/li&gt;
                    &lt;li&gt;&lt;span class="listings-title"&gt;Condition:&lt;/span&gt; {{ listing.condition_choices }}
                    &lt;/li&gt;
                    &lt;li&gt;&lt;span class="listings-title"&gt;Hours:&lt;/span&gt; {{ listing.hours }}&lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
                &lt;div class="col-md-6"&gt;
                  &lt;ul&gt;
                    &lt;li&gt;&lt;span class="listings-title"&gt;Asking Price:&lt;/span&gt; {{ listing.asking_price }}
                    &lt;/li&gt;
                    &lt;li&gt;&lt;span class="listings-title"&gt;Sales:&lt;/span&gt; {{ listing.sales_price }}&lt;/li&gt;
                    &lt;li&gt;&lt;span class="listings-title"&gt;Rent:&lt;/span&gt; {{ listing.rent_price }}&lt;/li&gt;
                    &lt;li&gt;&lt;span class="listings-title"&gt;Lease Terms:&lt;/span&gt; {{ listing.lease_terms }}&lt;/li&gt;
                    &lt;li&gt;&lt;span class="listings-title"&gt;Licenses:&lt;/span&gt; {{ listing.licenses }}&lt;/li&gt;
                    &lt;li&gt;&lt;span class="listings-title"&gt;Parking:&lt;/span&gt; {{ listing.parking }}&lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;p&gt;For more information please contact {{ user.first_name }} {{ user.last_name }} at {{ listing.phone }}.&lt;/p&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        {% endfor %}
      &lt;/div&gt;
    &lt;/section&gt;
  
  {% endblock content %}
  </code></pre>