Browse Source

Novinky | vytvoreni modelu

remotes/origin/vysl
Bc. Petr Pecha 10 years ago
parent
commit
fa0c4e0fa9
  1. 19
      seminar/models.py

19
seminar/models.py

@ -618,3 +618,22 @@ class Nastaveni(SingletonModel):
def verejne(self): def verejne(self):
return False return False
@python_2_unicode_compatible
class Novinky(models.Model):
datum = models.DateField(auto_now_add=True)
text = models.TextField('Text novinky', blank=True, null=True)
obrazek = models.ImageField('Obrázek', upload_to='image_novinky/%Y/%m/%d/',
null=True, blank=True)
autor = models.ForeignKey(settings.AUTH_USER_MODEL,
verbose_name='Autor novinky')
zverejneno = models.BooleanField('Zveřejněno', default="False")
def __str__(self):
return '[' + self.datum + '] ' + self.text[0:20]
class Meta:
verbose_name = 'Novinka'
verbose_name_plural = 'Novinky'

Loading…
Cancel
Save