Everybody knows about permalink
, but it's usually used only in get_absolute_url
. I prefer to use it for all related model urls.
class Event(models.Model):
# ...
@models.permalink
def edit_url(self):
return ('event_edit', (self.pk, ))
And then in template:
Редактировать событие