Пример #1
0
 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)
Пример #2
0
    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)
Пример #3
0
    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)
Пример #4
0
    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)
Пример #5
0
    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)
Пример #6
0
    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)
Пример #7
0
 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)
Пример #8
0
 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)
Пример #9
0
    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)
Пример #10
0
 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)
Пример #11
0
    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)
Пример #12
0
    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)