If I am under standing the relationship correctly, a City has many Neighborhoods. So this is a many-to-many relationship. In the models.py this would look like
from django.db import models
class Neighborhood(models.Model):
name = models.CharField(max_length=100)
class City(models.Model):
name = models.CharField(max_length=100)
neighborhoods = models.ManyToManyField(Neighborhood)
You can then set up your page to accept the city name as an argument in the href, and then call a page view for only neighborhoods in that city. Your href link in the template to go to the city view with only it's neighborhoods may look like this:
<a href="{% url 'city_view' city.name %}">Link</a>
That is linked to this url in your urls.py:
url(r'city/(?P<city_name>.+)/$', views.city_view, name='city_view')
Then your view in views.py that will filter for only neighborhoods in that city may look like this:
def city_view(request, name):
city = City.objects.get(name=name)
neighborhoods = city.neighborhoods.all()
return render(request, 'template.html', {'neighborhoods': neighborhoods})
Then call only the neighborhoods for that city in the template.html:
{% for neighborhood in neighborhoods %}
neighborhood.name
{% endfor %}
This should hopefully show the database calls, views.py progression, and how it routes the view based on what is requested in the urls.py. If you need anything else, lmk.