Is it possible to use a generic view with additional parameters in the URL mapping - i.e. I got the following model:
class Route(models.Model):
area = models.ForeignKey(Area)
slug = models.SlugField(null=True,blank=True)
@models.permalink
def get_absolute_url(self):
return ('route_details', (), {'area': self.area.slug,
'slug': self.slug})
This URL-Mapping:
url(r'^(?P<area>[-\w]+)/(?P<slug>[-\w]+)/$','routes.views.route_details',
name='route_details')
And this trivial view:
def route_details(self, area, slug):
route = get_object_or_404(Route, slug=slug)
return render_to_response("routes/route_details.html", {'route': route})
As you can see, I'm actually identifying the route just by the route's slug and the area slug is just to shape the url (e.g. routes/central-park/rat-rock
). Can I do the same just using a generic view?