Novinky | vytvoreni modelu
This commit is contained in:
		
							parent
							
								
									81cbf39df7
								
							
						
					
					
						commit
						fa0c4e0fa9
					
				
					 1 changed files with 19 additions and 0 deletions
				
			
		|  | @ -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…
	
		Reference in a new issue
	
	 Bc. Petr Pecha
						Bc. Petr Pecha