1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #13622: Fix exception when viewing current config and no revisions have been created

This commit is contained in:
Jeremy Stretch
2023-08-31 08:52:46 -04:00
parent 06f2c6f867
commit 2544e2bf18
3 changed files with 21 additions and 3 deletions

View File

@@ -723,6 +723,8 @@ class ConfigRevision(models.Model):
verbose_name_plural = _('config revisions')
def __str__(self):
if not self.pk:
return gettext('Default configuration')
if self.is_active:
return gettext('Current configuration')
return gettext('Config revision #{id}').format(id=self.pk)
@@ -733,6 +735,8 @@ class ConfigRevision(models.Model):
return super().__getattribute__(item)
def get_absolute_url(self):
if not self.pk:
return reverse('core:config') # Default config view
return reverse('extras:configrevision', args=[self.pk])
def activate(self):