예제 #1
0
 def form_valid(self, form):
     form.instance.author_user = self.request.user
     if not self.kwargs['slug']:
         form.instance.slug = py_slugify(form.instance.name + "-" + rand_slug())
     return super().form_valid(form)
예제 #2
0
 def save(self, *args, **kwargs):
     self.slug = py_slugify(self.name) + "-" + random_slug(3)
     super(Skill, self).save(*args, **kwargs)
예제 #3
0
 def form_valid(self, form):
     form.instance.author_user = self.request.user
     form.instance.slug = py_slugify(form.instance.name + "-" +
                                     random_slug(3))
     return super().form_valid(form)