0.0.1 init, main page prepare
This commit is contained in:
50
GeneralApp/models.py
Normal file
50
GeneralApp/models.py
Normal file
@@ -0,0 +1,50 @@
|
||||
from django.db import models
|
||||
from BaseModels.base_models import BaseModelViewPage, BaseModel
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
# from ckeditor.fields import RichTextField
|
||||
from ckeditor_uploader.fields import RichTextUploadingField
|
||||
|
||||
class StaticPage(BaseModelViewPage):
|
||||
promo_header = models.BooleanField(verbose_name='Промо-хэдер', default=False)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Статическая страница')
|
||||
verbose_name_plural = _('Статические страницы')
|
||||
|
||||
class Block(BaseModelViewPage):
|
||||
class Meta:
|
||||
verbose_name = _('Блок на странице')
|
||||
verbose_name_plural = _('Блоки на страницах')
|
||||
|
||||
class Option(BaseModel):
|
||||
opt_type = models.CharField(max_length=250, verbose_name='Тип', blank=True, null=True)
|
||||
prefix = models.CharField(max_length=250, verbose_name='Префикс', blank=True, null=True)
|
||||
value = models.CharField(max_length=250, verbose_name='Значение')
|
||||
picture = models.ImageField(upload_to='uploads/', verbose_name=_('Миниатюра'), null=True, blank=True,
|
||||
help_text=u'')
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Параметр')
|
||||
verbose_name_plural = _('Параметры')
|
||||
|
||||
class FAQitem(BaseModel):
|
||||
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
|
||||
content_type = models.ForeignKey(ContentType, on_delete=models.SET_NULL, null=True)
|
||||
object_id = models.PositiveIntegerField()
|
||||
content_object = GenericForeignKey('content_type', 'object_id')
|
||||
|
||||
question = models.TextField(verbose_name='Вопрос')
|
||||
answer = RichTextUploadingField(verbose_name='Ответ')
|
||||
|
||||
def __str__(self):
|
||||
if self.question:
|
||||
return self.question
|
||||
else:
|
||||
return self.id
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'FAQ'
|
||||
verbose_name_plural = 'FAQs'
|
||||
Reference in New Issue
Block a user