def __create_slug(self): try: unique_slugify(self, self.get_username() or self.user.get_full_name(), slug_separator='_') self.save() except Exception as e: self.logger.error("Unable to create profile slug: %s", e)
def save(self, force_insert=False, force_update=False, using=None, update_fields=None): """ Save Photo after ensuring it is not blank. Resize as needed. """ if self.slug is None or self.slug == '': self.slug = unique_slugify(self, self.user.get_username()) print "Slugified: %s" % self.slug return super(UserProfile, self).save(force_insert, force_update, using, update_fields)
def save(self, force_insert=False, force_update=False, using=None, update_fields=None): if not self.id: self.slug = unique_slugify(self, self.name) super(Playlist, self).save(force_insert, force_update, using, update_fields)
def save(self, force_insert=False, force_update=False, using=None, update_fields=None): if not self.id: self.slug = unique_slugify(self, self.title) self.clean_image('mix_image', Mix) super(Mix, self).save(force_insert, force_update, using, update_fields)
def save(self, force_insert=False, force_update=False, using=None, update_fields=None): """ Save Photo after ensuring it is not blank. Resize as needed. """ if self.slug is None or self.slug == '': self.slug = unique_slugify(self, self.user.get_username()) print("Slugified: %s" % self.slug) return super(UserProfile, self).save(force_insert, force_update, using, update_fields)
def save(self, force_insert=False, force_update=False, using=None, update_fields=None): if not self.id: self.slug = unique_slugify(self, self.title) self.clean_image('mix_image', Mix) #Check for the unlikely event that the waveform has been generated if os.path.isfile(self.get_waveform_path()): self.waveform_generated = True try: self.duration = mp3_length(self.get_absolute_path()) except Mp3FileNotFoundException: #Not really bothered about this in save as it can be called before we have an mp3 pass super(Mix, self).save(force_insert, force_update, using, update_fields)
def handle(self, *args, **options): try: candidates = Mix.objects.all() for mix in candidates: try: if mix.duration is None: print "Finding duration for: %s" % mix.title length = mp3_length(mix.get_absolute_path()) print "\tLength: %d" % length mix.duration = length if mix.slug == 'Invalid': print "Slugifying mix: %s" % mix.title mix.slug = unique_slugify(mix, mix.title) print "\tNew title: %s" % mix.slug mix.save() except Mp3FileNotFoundException, me: mix.delete() print me.message except Exception, ex: raise CommandError(ex.message)
def handle(self, *args, **options): try: candidates = Mix.objects.all() for mix in candidates: try: if mix.duration is None: print("Finding duration for: %s" % mix.title) length = mp3_length(mix.get_absolute_path()) print("\tLength: %d" % length) mix.duration = length if mix.slug == 'Invalid': print("Slugifying mix: %s" % mix.title) mix.slug = unique_slugify(mix, mix.title) print("\tNew title: %s" % mix.slug) mix.save() except Mp3FileNotFoundException as me: mix.delete() print(me.message) except Exception as ex: raise CommandError(ex.message)
def save(self, force_insert=False, force_update=False, using=None, update_fields=None): if not self.id: self.slug = unique_slugify(self, self.title) super(Blog, self).save(force_insert, force_update, using, update_fields)
def __create_slug(self): try: unique_slugify(self, self.get_username() or self.user.get_full_name(), slug_separator='_') self.save() except Exception, e: self.logger.error("Unable to create profile slug: %s", e.message)
def save(self, force_insert=False, force_update=False, using=None): if not self.slug: self.slug = unique_slugify(self, self.description, slug_separator='_') super(Genre, self).save(force_insert, force_update, using)