Skip to content

Commit

Permalink
bugfix - empty slug field
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Dec 8, 2015
1 parent 021654c commit 2833bd3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions panoramix/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,9 @@ class DashboardModelView(PanoramixModelView, DeleteMixin):
}
def pre_add(self, obj):
obj.slug = obj.slug.strip() or None
obj.slug = obj.slug.replace(" ", "-")
obj.slug = re.sub(r'\W+', '', obj.slug)
if obj.slug:
obj.slug = obj.slug.replace(" ", "-")
obj.slug = re.sub(r'\W+', '', obj.slug)

def pre_update(self, obj):
self.pre_add(obj)
Expand Down

0 comments on commit 2833bd3

Please sign in to comment.