I’m trying to use my URLconf file (url.py) to create a KML file of a query of all objects with date X. I’m looking to pass it in a YYYY-MM-DD format.
My urls.py file:
urlpatterns = patterns('events.views',
(r'^(?P<date>[-\d]+)/$', 'kml_date')
)
My views.py file:
def kml_date(request, date):
venues = Venue.objects.filter(event__eventdate__date=date).kml()
return render_to_kml('gis/kml/placemarks.kml', {'places' : venues})
Not sure what I’m doing wrong here, any ideas?
Arguments passed to a view are strings. If you want them to be another datatype (e.g.
datetime.date) then you will need to parse them first.Also, your regex is far too permissive.