You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.1 KiB
28 lines
1.1 KiB
from django.db import models
|
|
|
|
|
|
class SchoolSchedule(models.Model):
|
|
WEEKDAY_CHOICES = (
|
|
(1, 'понедельник'),
|
|
(2, 'вторник'),
|
|
(3, 'среда'),
|
|
(4, 'четверг'),
|
|
(5, 'пятница'),
|
|
(6, 'суббота'),
|
|
(7, 'воскресенье'),
|
|
)
|
|
weekday = models.PositiveSmallIntegerField('День недели', choices=WEEKDAY_CHOICES, unique=True)
|
|
title = models.CharField('Заголовок', default='', max_length=100, db_index=True)
|
|
description = models.TextField('Описание')
|
|
materials = models.TextField('Материалы')
|
|
age = models.PositiveSmallIntegerField('Возраст', default=0)
|
|
month_price = models.DecimalField('Цена', max_digits=8, decimal_places=2, default=0)
|
|
day_discount = models.DecimalField('Скидка, в валюте', max_digits=8, decimal_places=2, default=0)
|
|
|
|
class Meta:
|
|
ordering = ('weekday',)
|
|
verbose_name = 'Расписание'
|
|
verbose_name_plural = 'Расписания'
|
|
|
|
def __str__(self):
|
|
return dict(self.WEEKDAY_CHOICES).get(self.weekday, '')
|
|
|