Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Prevent migrating this app, use Select widget instead #3

Merged
merged 2 commits into from
Sep 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/wagtailthemes/models.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
from django import forms
from django.conf import settings
from django.db import models
from wagtail.contrib.settings.models import BaseSetting, register_setting
from wagtail.wagtailadmin.edit_handlers import FieldPanel


__ALL__ = ['ThemeSettings']


@register_setting
class ThemeSettings(BaseSetting):
THEMES = getattr(settings, 'WAGTAIL_THEMES', None)

theme = models.CharField(
blank=True, choices=THEMES, max_length=255, null=True)
theme = models.CharField(blank=True, max_length=255, null=True)

panels = [
FieldPanel('theme', widget=forms.Select(choices=THEMES))
]
1 change: 1 addition & 0 deletions src/wagtailthemes/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
def set_theme(theme):
setattr(_thread_locals, 'wagtail_theme', theme)


def get_theme():
theme = getattr(_thread_locals, 'wagtail_theme', None)
return theme