0
Ich habe einen Kommentar und ein Post-Modell.Django URL Slugs
Ich möchte die URL kommen als/post // Kommentar //
Aber ich bin nicht sicher, wie dies einzurichten.
My Post-Modell hat dies:
@python_2_unicode_compatible
class Post(models.Model):
...
slug = models.SlugField(unique=True)
@models.permalink
def get_absolute_url(self):
return 'appname:post', (self.slug,)
kann mein Kommentar Modell hat:
@python_2_unicode_compatible
class Comment(models.Model):
...
slug = models.SlugField(unique=True)
@models.permalink
def get_absolute_url(self):
return 'appname:post:comment', (self.slug,)
oder wie ich get_absolute_url tun Haken, so dass die URL den Weg kommt heraus, dass ich erwähnt? oder gibt es einen besseren Weg?