def save(self, *args, **kwargs): if not self.short_name: self.short_name = self.name if not self.slug: self.slug = slugify(self.short_name, allow_numbers=True) if self.parent: self.slug = self.parent.slug + '-' + self.slug self.slug = self.slug[:46] while Committee.objects.filter(slug=self.slug).exists(): self.slug += '-' + random.choice(string.lowercase) super(Committee, self).save(*args, **kwargs)
def save(self, *args, **kwargs): if not self.short_name_en: self.short_name_en = self.name_en if not self.short_name_fr: self.short_name_fr = self.name_fr if not self.slug: self.slug = slugify(self.short_name_en, allow_numbers=True) if self.parent: self.slug = self.parent.slug + '-' + self.slug self.slug = self.slug[:46] while Committee.objects.filter(slug=self.slug).exists(): self.slug += '-' + random.choice(string.lowercase) super(Committee, self).save(*args, **kwargs)
def save(self): if not self.slug: self.slug = parsetools.slugify(self.name_en) super(Riding, self).save()
def get_by_name(self, name): slug = parsetools.slugify(name) if slug in RidingManager.FIX_RIDING: slug = RidingManager.FIX_RIDING[slug] return self.get_queryset().get(slug=slug)
def save(self): if not self.slug: self.slug = parsetools.slugify(self.name) super(Riding, self).save()
def get_by_name(self, name): slug = parsetools.slugify(name) if slug in RidingManager.FIX_RIDING: slug = RidingManager.FIX_RIDING[slug] return self.get_query_set().get(slug=slug)