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'
|
verbose_name_plural = 'Organizátoři'
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
|
if self.id is not None:
|
||||||
|
puvodni = Organizator.objects.get(id=self.id)
|
||||||
if self.foto:
|
if self.foto:
|
||||||
original = Image.open(self.foto)
|
if not puvodni or puvodni.foto != self.foto:
|
||||||
jmeno = os.path.basename(self.foto.file.name)
|
original = Image.open(self.foto)
|
||||||
Organizator._vyrobMiniaturu(original, jmeno, 500, self.foto)
|
jmeno = os.path.basename(self.foto.file.name)
|
||||||
Organizator._vyrobMiniaturu(original, jmeno, 200, self.foto_male)
|
Organizator._vyrobMiniaturu(original, jmeno, 500, self.foto)
|
||||||
|
Organizator._vyrobMiniaturu(original, jmeno, 200, self.foto_male)
|
||||||
super(Organizator, self).save()
|
super(Organizator, self).save()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in a new issue