Пример #1
0
 def save(self, **kwargs):
     self.slug = unique_slugify(
         self.name,
         slugs_in_use=self.__class__.objects.all().values_list("slug",
                                                               flat=True),
     )
     super().save(**kwargs)
Пример #2
0
 def save(self, **kwargs):
     if not self.slug:
         self.slug = unique_slugify(
             self.name,
             slugs_in_use=self.__class__.objects.filter(
                 responsible_team=self.responsible_team, ).values_list(
                     "slug", flat=True),
         )
     super().save(**kwargs)
Пример #3
0
 def save(self, **kwargs):
     # generate slug if needed
     if not self.slug:
         self.slug = unique_slugify(
             self.name,
             slugs_in_use=self.__class__.objects.filter(
                 team=self.team).values_list("slug", flat=True),
         )
     super().save(**kwargs)
Пример #4
0
 def save(self, **kwargs):
     if not self.slug:
         self.slug = unique_slugify(
             self.name,
             slugs_in_use=self.__class__.objects.filter(camp=self.camp).values_list(
                 "slug",
                 flat=True,
             ),
         )
     super().save(**kwargs)
Пример #5
0
 def save(self, **kwargs):
     """
     Generate slug as needed
     """
     if not self.slug:
         self.slug = unique_slugify(
             self.name,
             slugs_in_use=self.__class__.objects.filter(
                 chain=self.chain
             ).values_list("slug", flat=True),
         )
     super().save(**kwargs)
Пример #6
0
 def save(self, **kwargs):
     if self.published_at:
         # if this is a new newsitem, or it doesn't have a slug, or the slug is in use on another item, create a new slug
         if (not self.pk or not self.slug
                 or NewsItem.objects.filter(slug=self.slug).count() > 1):
             published_at_string = self.published_at.strftime("%Y-%m-%d")
             base_slug = slugify(self.title)
             slug = f"{published_at_string}-{base_slug}"
             self.slug = unique_slugify(
                 slug,
                 slugs_in_use=self.__class__.objects.all().values_list(
                     "slug",
                     flat=True,
                 ),
             )
     super().save(**kwargs)
Пример #7
0
 def save(self, *args, **kwargs):
     slug_str = f"{self.author.pk} {self.title}"
     unique_slugify(self, slug_str)
     if self.author.is_staff:
         self.is_staff = True
     super().save(*args, **kwargs)
Пример #8
0
 def save(self, *args, **kwargs):
     slug_str = f"{self.get_strand_title()} {self.index}"
     unique_slugify(self, slug_str)
     super(LearningOutcomeAnalysis, self).save(*args, **kwargs)
Пример #9
0
 def save(self, *args, **kwargs):
     slug_str = f"{self.author.username} {self.title}"
     unique_slugify(self, slug_str)
     super(Curriculum, self).save(*args, **kwargs)
Пример #10
0
 def save(self, *args, **kwargs):
     slug_str = f"{self.title}"
     unique_slugify(self, slug_str)
     super(NonCatVerb, self).save(*args, **kwargs)
Пример #11
0
 def save(self):
   unique_slugify(self, self.title)
   self.subtitle = ''
   self.content_markup = markdown(self.content_markdown, ['codehilite'])
   super(BanksPost, self).save()
Пример #12
0
 def save(self, *args, **kwargs):
     slug_str = self.title
     unique_slugify(self, slug_str)
     super().save(*args, **kwargs)
Пример #13
0
 def save(self, *args, **kwargs):
     slug_str = self.title[:110]
     unique_slugify(self, slug_str)
     super().save(*args, **kwargs)
     self.update_completions()
Пример #14
0
 def save(self, *args, **kwargs):
     slug_str = f"{self.title}"
     unique_slugify(self, slug_str)
     super(CurriculumAnalysis, self).save(*args, **kwargs)
Пример #15
0
 def save(self, *args, **kwargs):
     slug_str = f"analysis-{self.taxonomy}"
     unique_slugify(self, slug_str)
     super(CurriculumAnalysis, self).save(*args, **kwargs)
Пример #16
0
 def save(self, *args, **kwargs):
     slug_str = f"{self.strand.title} {self.index}"
     unique_slugify(self, slug_str)
     super(LearningOutcome, self).save(*args, **kwargs)
Пример #17
0
 def save(self):
     unique_slugify(self, self.title)
     self.subtitle = ''
     self.content_markup = markdown(self.content_markdown, ['codehilite'])
     super(BanksPost, self).save()