How to write a view that accesses a method over all objects in a given model?

2011-04-26 Thread matt
First post, creating first Django project and having a of an issue I was hoping for some help with! I'm trying to write my own search which takes as input a user's location and returns a list of places (from my db) sorted by proximity. Here's roughly what I've got: in models.py: class Place(mode

Re: How to write a view that accesses a method over all objects in a given model?

2011-04-26 Thread Alendit
Hi, to access a model in the view, simply import it into you view. Something along the lines: from yourapp.models import Place from django.http import HttpResponse def some_view(request): OBJECT_ID = 1 # put here the id of the object # or give it as a function arg