Skip to main content

Sample app for django-monocle project generated by scaffolder

Project description

---
Модуль: monocle_mainbanner
---

Модуль отображающий главный баннер сайта в виде карусели с изображениями

## **Пример отображения на сайте:**
![Banner](/images_readme/mainbanner.png)

## **Пример отображения в панели администрирования:**
![Banner](/images_readme/mainbanner_admin.png)

## **Файл models.py:**

from django.db import models
from solo.models import SingletonModel

CHOICES_PAGIN = (('true', 'С пагинацией',), ('false', 'Без пагинации',))
CHOICES_ARROWS = (('true', 'Со стелками',), ('false', 'Без стелок',))

from filebrowser.fields import FileBrowseField

class MainBanner(SingletonModel):
name = models.CharField(max_length=255, verbose_name='Заголовок')
text = models.TextField(verbose_name='Подпись')
elem_number = models.PositiveSmallIntegerField(blank=False, default=1, verbose_name='Количество отображаемых слайдов')
isShown = models.BooleanField(default=True, verbose_name='Показывать')
arrows = models.CharField(max_length=5, choices=CHOICES_ARROWS, default='false', blank=False, verbose_name='Стрелки навигации')
pagination = models.CharField(max_length=5, choices=CHOICES_PAGIN, default='false', blank=False, verbose_name='Пагинация')

def __str__(self):
return self.name

class Meta:
verbose_name_plural = u'Главный баннер'
verbose_name = u'Главный баннер'


class Slide(models.Model):
name = models.CharField(max_length=255, blank=True, verbose_name= 'Заголовок')
slider = models.ForeignKey('MainBanner', verbose_name= 'Баннер')
image = FileBrowseField(max_length=200, directory="'banner", extensions=[".jpg", ".png", ".jpeg"], blank=True, null=True, verbose_name= 'Изображение')
text = models.TextField(verbose_name='Подпись', blank=True)
isShown = models.BooleanField(default=True, verbose_name='Показывать')
position = models.PositiveSmallIntegerField(default=0)

def __str__(self):
return self.name

class Meta:
verbose_name_plural = u'Слайды'
verbose_name = u'Слайд'
ordering = ['position']
from django.apps import AppConfig
class CustomAppConfig(AppConfig):
name = 'apps.monocle_mainbanner'
verbose_name = 'Главный баннер'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

monocle_mainbanner-0.1.5.tar.gz (304.7 kB view details)

Uploaded Source

Built Distribution

monocle_mainbanner-0.1.5-py3-none-any.whl (4.7 MB view details)

Uploaded Python 3

File details

Details for the file monocle_mainbanner-0.1.5.tar.gz.

File metadata

File hashes

Hashes for monocle_mainbanner-0.1.5.tar.gz
Algorithm Hash digest
SHA256 940b30c2a89ee5e8fd130fd6cbba83ad92e16bf594177132503034ffe8944564
MD5 27cbf5e10c55f3028834bcd16c373f03
BLAKE2b-256 3b8668c50a312ceb69f7fc0652fabd2e01c5197b7149dbddfe4decbf5c024aab

See more details on using hashes here.

File details

Details for the file monocle_mainbanner-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for monocle_mainbanner-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9dc6e6912435ef71dc22e2868010bcd9aefccdb626cc96a4d86c7584ce68ac1e
MD5 16b6fd7f79484c21f24b95ae05ad07a1
BLAKE2b-256 69ab9ddaf9b3dec661dd7ae2ddf90f0e48e57c2a573d67398908abc84203df2d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page