aboutsummaryrefslogtreecommitdiff
path: root/apps/utils/util.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2018-12-06 07:03:24 -0600
committerluxagraf <sng@luxagraf.net>2018-12-06 07:03:24 -0600
commit4eaaa999c89293677dade99568a279c934e0b8d9 (patch)
treec543451d3ca149681460f45ab6161a813cf4ed29 /apps/utils/util.py
parentcb21e59587ab328e9a3e06c9d57c2bafce281715 (diff)
redid scripts to use just npm
Diffstat (limited to 'apps/utils/util.py')
-rw-r--r--apps/utils/util.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/utils/util.py b/apps/utils/util.py
index 415704c..287205a 100644
--- a/apps/utils/util.py
+++ b/apps/utils/util.py
@@ -96,9 +96,9 @@ def unique_slug_generator(instance, new_slug=None):
slug = new_slug
else:
try:
- slug = slugify(instance.title)
+ slug = slugify(instance.title)[:45]
except AttributeError:
- slug = slugify(instance.name)
+ slug = slugify(instance.name)[:45]
Klass = instance.__class__
qs_exists = Klass.objects.filter(slug=slug).exists()
if qs_exists:
@@ -108,3 +108,11 @@ def unique_slug_generator(instance, new_slug=None):
)
return unique_slug_generator(instance, new_slug=new_slug)
return slug
+
+
+def comma_splitter(tag_string):
+ return [t.strip().lower() for t in tag_string.split(',') if t.strip()]
+
+
+def comma_joiner(tags):
+ return ', '.join(t.name for t in tags)