Refactor how the routing for different kinds of entry works - this will make implementing webmentions easier, hopefully?
This commit is contained in:
parent
c359b7640e
commit
9580068c5b
12 changed files with 136 additions and 73 deletions
|
|
@ -135,18 +135,18 @@ class Entry(ModelMeta, TimeStampedModel):
|
|||
@property
|
||||
def url(self):
|
||||
kind = kinds.from_id[self.kind]
|
||||
args = [self.id]
|
||||
args = [kind.plural, self.id]
|
||||
if kind.slug:
|
||||
args.append(self.slug)
|
||||
return reverse('entries:' + kind.entry, args=args)
|
||||
return reverse('entries:entry', args=args)
|
||||
|
||||
@property
|
||||
def amp_url(self):
|
||||
kind = kinds.from_id[self.kind]
|
||||
args = [self.id]
|
||||
args = [kind.plural, self.id]
|
||||
if kind.slug:
|
||||
args.append(self.slug)
|
||||
return reverse('entries:' + kind.entry_amp, args=args)
|
||||
return reverse('entries:entry_amp', args=args)
|
||||
|
||||
@property
|
||||
def slug(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue