django_dynamic_theme.models

Admins modles for Theme.

Classes

FontSizeChoice

List of pre defined css font sizes.

AbstractModelMeta

Abstract class for the meta to avoid metaclass exception

ThemeElement

Abstract class for theme elements.

Background

Stores the background colors.

MediaGallery

A specialization of a n-dimensional list for the purpose of videos / images.

Navbar

Stores the theming of bootstrap 5 nav bar

Theme

Combines all values.

Module Contents

class django_dynamic_theme.models.FontSizeChoice

Bases: django.db.models.TextChoices

List of pre defined css font sizes. Or px or em or % see https://developer.mozilla.org/en-US/docs/Web/CSS/font-size

XX_SMALL = 'xx-small'
X_SMALL = 'x-small'
SMALL = 'small'
MEDIUM = 'medium'
LARGE = 'large'
X_LARGE = 'x-large'
XX_LARGE = 'xx-large'
XXX_LARGE = 'xxx-large'
class django_dynamic_theme.models.AbstractModelMeta

Bases: abc.ABCMeta, type(models.Model)

Abstract class for the meta to avoid metaclass exception

class django_dynamic_theme.models.ThemeElement

Bases: django.db.models.Model

Abstract class for theme elements. :param name: The name of that configuration.

name
class Meta

Meta class for ThemeElement

abstract = True
abstractmethod export() str

Exports the key value pairs as string.

save(*args, **kwargs) None

Saves the ThemeElement object and triggers the themes to write it’s content to the SCSS file.

__str__() str

Returns the name as string conversion.

__repr__() str

Returns the type and the name as representation.

class django_dynamic_theme.models.Background

Bases: ThemeElement

Stores the background colors. :param primary_bg: The color of the primary background.

primary_bg
export() str

Exports it’s values as string in SCSS format.

class django_dynamic_theme.models.MediaGallery

Bases: ThemeElement

A specialization of a n-dimensional list for the purpose of videos / images. :param margin_left: The margin of the entire media gallery on left side. :param margin_right: The margin of the entire media gallery on right side. :param max_width: The maximum width of the entire media gallery. :param item_align: The align of the single items within a row. :param row_margin_top: The top margin between rows.

margin_left
margin_right
max_width
item_align
row_margin_top
class Meta

Meta definitions of Media Gallery

verbose_name = 'Media Gallery'
verbose_name_plural = 'Media Galleries'
export() str

Returns configuration as string.

class django_dynamic_theme.models.Navbar

Bases: ThemeElement

Stores the theming of bootstrap 5 nav bar :param background_color: Background color of the Navbar :param opacity: How transparent the background is. 0 is full transparent. :param font_size: The size of nav bar font. :param text_color: Color of the nav bar text. :param text_opacity: How transparent the text is. 0 is full transparent.

background_color
opacity
font_size
text_color
text_opacity
export() str

Exports the navbar properties as strings.

class django_dynamic_theme.models.Theme

Bases: django.db.models.Model

Combines all values. :param name: Name of the theme. Also used as file name + .scss. See self.path() :param default: Unique. If that is the default theme. :param background: ThemeElement for background. :param media_gallery: ThemeElement for media gallery. :param navrbar: ThemeElement for nav bar.

name
default
background: Background
navbar: Navbar
class Meta

Meta class of the Theme.

constraints
property path: str

Returns the path based on the file name.

export() str

Exports all listed configurations as string in SCSS format.

write_export() None

Writes the content of the export to the file.

save(*args, **kwargs) None

Saves the Theme object and writes it’s content to the SCSS file.