Browse Source

Organizatori | admin

+ odstraneni chyby, kdyz chybi obrazek organizatora
remotes/origin/vysl
Bc. Petr Pecha 10 years ago
parent
commit
e6b0efe1a7
  1. 10
      seminar/admin.py
  2. 1
      seminar/models.py

10
seminar/admin.py

@ -8,7 +8,7 @@ from ckeditor.widgets import CKEditorWidget
from django.db.models import Count from django.db.models import Count
from django.db import models from django.db import models
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Novinky from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Novinky, Organizator
import autocomplete_light import autocomplete_light
@ -329,5 +329,11 @@ class NovinkyAdminForm(forms.ModelForm):
class NovinkyAdmin(admin.ModelAdmin): class NovinkyAdmin(admin.ModelAdmin):
form = NovinkyAdminForm form = NovinkyAdminForm
admin.site.register(Novinky, NovinkyAdmin) admin.site.register(Novinky, NovinkyAdmin)
### Organizator
@admin.register(Organizator)
class OrganizatorAdmin(admin.ModelAdmin):
list_filter = ['organizuje_do_roku']

1
seminar/models.py

@ -670,6 +670,7 @@ class Organizator(models.Model):
verbose_name_plural = 'Organizátoři' verbose_name_plural = 'Organizátoři'
def save(self): def save(self):
if self.foto:
original = Image.open(self.foto) original = Image.open(self.foto)
jmeno = os.path.basename(self.foto.file.name) jmeno = os.path.basename(self.foto.file.name)
Organizator._vyrobMiniaturu(original, jmeno, 500, self.foto) Organizator._vyrobMiniaturu(original, jmeno, 500, self.foto)

Loading…
Cancel
Save