Solution 1 :

Because the object uses str representation in the City model. So whenever you access that object using print or str, which your template does, the name will be returned:

def __str__(self):
    return force_text(

You should use {{ }} instead of {{ city }} or whatever unique field is available in your template.

See Python str() and repr() functions for further information about string representation.

Problem :

I have an autocomplete dropdown list that uses the list of cities from my database. I am using django-cities. I want to be able to display it as
( , in my HTML. But it says that city is a string. Could someone explain to me why in my destination_form.html that {{ city }} is a string and not a city object

def add_destination(request,trip_id):
    city_list = City.objects.all()
    dict = {
    if request.method=="POST":
        print("Resquest: ")
        city = request.POST['city']

    return render(request,'trips/destination_form.html',dict)


{% extends "trips/trip_base.html" %}
{% load bootstrap3 %}
{% block trip_content %}
<h4>Add Destination!</h4>
<form method="POST" id='destinanationForm' action="{% url 'trips:add_destination' trip_id=trip_id%}">
  {% csrf_token %}
  <label for="city">City: </label>
  <input id="city" list="city_list" placeholder="Search City..." class="form-control" style="width:300px" name="city">
  <datalist id="city_list">
    {% for city in city_list %}
    <option value="{{ city }}" >{{}} , {{ }}</option>
    {% endfor %}
  <label for="start_date">Start Date: </label>
  <input id="start_date" type="date" name="start_date" value="{{ start_date }}">
  <label for="end_date">End Date: </label>
  <input id="end_date" type="date" name="end_date" value="{{ end_date }}">
<input type="submit" class="btn btn-primary btn-large" value="Create">
{% endblock %}