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

Standardize add, import, and export functionality for tags

This commit is contained in:
Jeremy Stretch
2020-06-12 09:48:23 -04:00
parent 057a022205
commit da906f48d9
7 changed files with 58 additions and 25 deletions

View File

@@ -24,6 +24,8 @@ class Tag(TagBase, ChangeLoggedModel):
objects = RestrictedQuerySet.as_manager()
csv_headers = ['name', 'slug', 'color', 'description']
def get_absolute_url(self):
return reverse('extras:tag', args=[self.slug])
@@ -34,6 +36,14 @@ class Tag(TagBase, ChangeLoggedModel):
slug += "_%d" % i
return slug
def to_csv(self):
return (
self.name,
self.slug,
self.color,
self.description
)
class TaggedItem(GenericTaggedItemBase):
tag = models.ForeignKey(