mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-06-01 07:18:27 -04:00
fix Tag creation via admin erroring because slug field is not filled
This commit is contained in:
parent
c0b7887fd7
commit
1d7f0ab20d
1 changed files with 5 additions and 1 deletions
|
@ -82,9 +82,13 @@ class Tag(ABIDModel):
|
|||
if i is not None:
|
||||
slug += "_%d" % i
|
||||
return slug
|
||||
|
||||
def clean(self, *args, **kwargs):
|
||||
self.slug = self.slug or self.slugify(self.name)
|
||||
super().clean(*args, **kwargs)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if self._state.adding and not self.slug:
|
||||
if self._state.adding:
|
||||
self.slug = self.slugify(self.name)
|
||||
|
||||
# if name is different but slug conficts with another tags slug, append a counter
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue