Neukládej k organizátorovi fotku, nezměnila-li se
This commit is contained in:
parent
708da4bf99
commit
7b815da63f
1 changed files with 7 additions and 4 deletions
|
@ -793,11 +793,14 @@ class Organizator(models.Model):
|
|||
verbose_name_plural = 'Organizátoři'
|
||||
|
||||
def save(self):
|
||||
if self.id is not None:
|
||||
puvodni = Organizator.objects.get(id=self.id)
|
||||
if self.foto:
|
||||
original = Image.open(self.foto)
|
||||
jmeno = os.path.basename(self.foto.file.name)
|
||||
Organizator._vyrobMiniaturu(original, jmeno, 500, self.foto)
|
||||
Organizator._vyrobMiniaturu(original, jmeno, 200, self.foto_male)
|
||||
if not puvodni or puvodni.foto != self.foto:
|
||||
original = Image.open(self.foto)
|
||||
jmeno = os.path.basename(self.foto.file.name)
|
||||
Organizator._vyrobMiniaturu(original, jmeno, 500, self.foto)
|
||||
Organizator._vyrobMiniaturu(original, jmeno, 200, self.foto_male)
|
||||
super(Organizator, self).save()
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in a new issue