Example #1
0
    def save(self, *args, **kwargs):
        # brand exists only on new or updated clips
        if self.brand:
            filename = os.path.split(self.brand.name)[1]

            if self.pk is not None:
                # case: existing clip (pk) and has a brand
                ## Don't re-save the exact same brand
                orig = Clip.objects.get(pk=self.pk)
                if orig.brand != self.brand:
                    util.squarer(self.brand, filename)

            else:
                # case: created clip (pk = None) and has a brand
                util.squarer(self.brand, filename)

        self.slug = slugify(self.title)
        super(Clip, self).save(*args, **kwargs)
Example #2
0
 def save(self, *args, **kwargs):
     self.username = self.user.username
     if self.avatar:
        util.squarer(self.avatar, self.avatar.name)
     super(Person, self).save(*args, **kwargs)