title: Autocomplete field in Django
body: <p>I have models similar to the following:</p>
  
  <pre><code>class Country(models.Model):    
          name = models.CharField(max_length=50, unique=True)
  
  class City(models.Model):
          name = models.CharField(max_length=50, unique=True)
          country = models.ForeignKey(Country)
  </code></pre>
  
  <p>and essentially I want to add a City to the database in my template. Before that, i should link it to the Country that already exists, so i want to use 'autocomplete field' in my template to get Country from DB</p>
  
  <p>I have the following form defined:</p>
  
  <pre><code>class AddCityForm(forms.ModelForm):
      city_name = forms.CharField(max_length=100)
      country_name = forms.CharField(max_length=100)
  </code></pre>
  
  <p>In my template i have the forms like this :</p>
  
  <pre><code>&lt;form action="/city/add" method="post"&gt;{% csrf_token %}
  {{ add_city_form.as_p }}
  &lt;input type="submit" value="Submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>so is there any solution in django, to make the field 'country_name' autocompleted from the databese ?</p>
  
  <p>cheers,
  newbie in django.</p>