I have two models with slug fields:
class Book(models.Model):
name = models.CharField(max_length=200)
slug = models.SlugField()
class Author(models.Model):
name = models.CharField(max_length=200)
slug = models.SlugField()
I would like to map them to the first-level path:
(r'^(?P<slug>[a-zA-Z0-9_-]+)/$', 'book_detail'),
(r'^(?P<slug>[a-zA-Z0-9_-]+)/$', 'author_detail'),
What's the best way to accomplish this without using the same function and returning either book or author based on the slug.