示例#1
0
    def test_bytes_conversion(self):

        settings.clear_cache()

        register_setting(name="BYTES_TEST_SETTING", editable=True, default=b"")
        Setting.objects.create(name="BYTES_TEST_SETTING", value="A unicode value")
        self.assertEqual(settings.BYTES_TEST_SETTING, b"A unicode value")
    def test_bytes_conversion(self):

        settings.clear_cache()

        register_setting(name="BYTES_TEST_SETTING", editable=True, default=b"")
        Setting.objects.create(name="BYTES_TEST_SETTING",
                               value="A unicode value")
        self.assertEqual(settings.BYTES_TEST_SETTING, b"A unicode value")
    def test_invalid_value_warning(self):
        """
        Test that a warning is raised when a database setting has an invalid
        value, i.e. one that can't be converted to the correct Python type.
        """

        settings.clear_cache()

        register_setting(name="INVALID_INT_SETTING", editable=True, default=0)
        Setting.objects.create(name="INVALID_INT_SETTING", value="zero")
        with warnings.catch_warnings():
            warning_re = r"The setting \w+ should be of type"
            warnings.filterwarnings("error", warning_re, UserWarning)
            with self.assertRaises(UserWarning):
                settings.INVALID_INT_SETTING
        self.assertEqual(settings.INVALID_INT_SETTING, 0)
示例#4
0
文件: tests.py 项目: yomguy/mezzanine
    def test_invalid_value_warning(self):
        """
        Test that a warning is raised when a database setting has an invalid
        value, i.e. one that can't be converted to the correct Python type.
        """

        settings.clear_cache()

        register_setting(name="INVALID_INT_SETTING", editable=True, default=0)
        Setting.objects.create(name="INVALID_INT_SETTING", value='zero')
        with warnings.catch_warnings():
            warning_re = r'The setting \w+ should be of type'
            warnings.filterwarnings('error', warning_re, UserWarning)
            with self.assertRaises(UserWarning):
                settings.INVALID_INT_SETTING
        self.assertEqual(settings.INVALID_INT_SETTING, 0)
    def test_unregistered_setting(self):
        """
        Test that accessing any editable setting will delete all Settings
        with no corresponding registered setting from the database.
        """

        settings.clear_cache()

        register_setting(name="REGISTERED_SETTING", editable=True, default="")
        Setting.objects.create(name="UNREGISTERED_SETTING", value="")

        with self.assertRaises(AttributeError):
            settings.UNREGISTERED_SETTING

        qs = Setting.objects.filter(name="UNREGISTERED_SETTING")
        self.assertEqual(qs.count(), 1)

        # This triggers Settings._load(), which deletes unregistered Settings
        settings.REGISTERED_SETTING

        self.assertEqual(qs.count(), 0)
示例#6
0
文件: tests.py 项目: yomguy/mezzanine
    def test_unregistered_setting(self):
        """
        Test that accessing any editable setting will delete all Settings
        with no corresponding registered setting from the database.
        """

        settings.clear_cache()

        register_setting(name="REGISTERED_SETTING", editable=True, default="")
        Setting.objects.create(name="UNREGISTERED_SETTING", value='')

        with self.assertRaises(AttributeError):
            settings.UNREGISTERED_SETTING

        qs = Setting.objects.filter(name="UNREGISTERED_SETTING")
        self.assertEqual(qs.count(), 1)

        # This triggers Settings._load(), which deletes unregistered Settings
        settings.REGISTERED_SETTING

        self.assertEqual(qs.count(), 0)
示例#7
0
    def test_conflicting_setting(self):
        """
        Test that conflicting settings raise a warning and use the settings.py
        value instead of the value from the database.
        """

        settings.clear_cache()

        register_setting(name="CONFLICTING_SETTING", editable=True, default=1)
        Setting.objects.create(name="CONFLICTING_SETTING", value=2)
        settings.CONFLICTING_SETTING = 3

        with warnings.catch_warnings():
            warning_re = "These settings are defined in both " "settings\.py and the database"
            warnings.filterwarnings("error", warning_re, UserWarning)

            with self.assertRaises(UserWarning):
                settings.CONFLICTING_SETTING

        self.assertEqual(settings.CONFLICTING_SETTING, 3)

        del settings.CONFLICTING_SETTING
    def test_conflicting_setting(self):
        """
        Test that conflicting settings raise a warning and use the settings.py
        value instead of the value from the database.
        """

        settings.clear_cache()

        register_setting(name="CONFLICTING_SETTING", editable=True, default=1)
        Setting.objects.create(name="CONFLICTING_SETTING", value=2)
        settings.CONFLICTING_SETTING = 3

        with warnings.catch_warnings():
            warning_re = ("These settings are defined in both "
                          r"settings\.py and the database")
            warnings.filterwarnings("error", warning_re, UserWarning)

            with self.assertRaises(UserWarning):
                settings.CONFLICTING_SETTING

        self.assertEqual(settings.CONFLICTING_SETTING, 3)

        del settings.CONFLICTING_SETTING
示例#9
0
from mezzanine.conf import register_setting

register_setting(
    name="RICHTEXT_ALLOWED_TAGS",
    append=True,
    default=("script",),
)
示例#10
0
from mezzanine.conf import register_setting

register_setting(
	name="MZEVENTS_GOOGLE_MAPS_DOMAIN",
	description="The Google Maps country domain to geocode addresses with",
	editable=True,
	default="maps.google.com.au",
)

register_setting(
	name="MZEVENTS_HIDPI_STATIC_MAPS",
	description="Generate maps suitable for Retina displays",
	editable=True,
	default=True,
)
示例#11
0
Thought should be given to how a setting is actually used before
making it editable, as it may be inappropriate - for example settings
that are only read during startup shouldn't be editable, since changing
them would require an application reload.
"""
from django.utils.translation import gettext_lazy as _

from mezzanine.conf import register_setting
from mezzanine.twitter import QUERY_TYPE_CHOICES, QUERY_TYPE_SEARCH

register_setting(
    name="TWITTER_DEFAULT_QUERY_TYPE",
    label=_("Default Twitter Query Type"),
    description=_(
        "Type of query that will be used to retrieve tweets for "
        "the default Twitter feed."
    ),
    editable=True,
    default=QUERY_TYPE_SEARCH,
    choices=QUERY_TYPE_CHOICES,
)

register_setting(
    name="TWITTER_DEFAULT_QUERY",
    label=_("Default Twitter Query"),
    description=_(
        "Twitter query to use for the default query type. "
        "\n\n*Note:* Once you change this from the default, you'll need to "
        "configure each of the oAuth consumer/access key/secret settings. "
        "Please refer to http://dev.twitter.com for more information "
        "on creating an application and acquiring these settings."
示例#12
0
from socket import gethostname

from django.utils.translation import ugettext as _

from mezzanine.conf import register_setting


register_setting(
    name="SHOP_CARD_TYPES",
    description="Sequence of available credit card types for payment.",
    editable=False,
    default=("Mastercard", "Visa", "Diners", "Amex"),
)

register_setting(
    name="SHOP_CART_EXPIRY_MINUTES",
    description="Number of minutes of inactivity until carts are abandoned.",
    editable=False,
    default=30,
)

register_setting(
    name="SHOP_CHECKOUT_ACCOUNT_ENABLED",
    description="If True, users can create a login for the checkout process.",
    editable=False,
    default=True,
)

register_setting(
    name="SHOP_CHECKOUT_ACCOUNT_REQUIRED",
示例#13
0
from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


register_setting(
    name="jobpostS_PER_PAGE",
    label=_("Job Posts per page"),
    description=_("Number of job posts shown on a career listing page."),
    editable=True,
    default=7,
)

register_setting(
    name="jobpost_SLUG",
    description=_("Slug of the page object for the careers app."),
    editable=False,
    default="jobpost",
)
示例#14
0
Thought should be given to how a setting is actually used before
making it editable, as it may be inappropriate - for example settings
that are only read during startup shouldn't be editable, since changing
them would require an application reload.
"""

from django.utils.translation import ugettext_lazy as _
from mezzanine.conf import register_setting
from mezzanine.twitter import QUERY_TYPE_CHOICES, QUERY_TYPE_SEARCH

register_setting(
    name="TWITTER_DEFAULT_QUERY_TYPE",
    label=_("Default Twitter Query Type"),
    description=_("Type of query that will be used to retrieve tweets for "
                  "the default Twitter feed."),
    editable=True,
    default=QUERY_TYPE_SEARCH,
    choices=QUERY_TYPE_CHOICES,
)

register_setting(
    name="TWITTER_DEFAULT_QUERY",
    label=_("Default Twitter Query"),
    description=_("Twitter query to use for the default query type."),
    editable=True,
    default="django mezzanine",
)

register_setting(
    name="TWITTER_DEFAULT_NUM_TWEETS",
示例#15
0
that are only read during startup shouldn't be editable, since changing
them would require an application reload.
"""

from django.conf import settings
from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


register_setting(
    name="ADMIN_MENU_ORDER",
    description=_("Controls the ordering and grouping of the admin menu."),
    editable=False,
    default=(
        (_("Content"), ("pages.Page", "blog.BlogPost",
           "generic.ThreadedComment", (_("Media Library"), "fb_browse"),)),
        (_("Site"), ("sites.Site", "redirects.Redirect", "conf.Setting")),
        (_("Users"), ("auth.User", "auth.Group",)),
    ),
)

register_setting(
    name="ADMIN_REMOVAL",
    description=_("Unregister these models from the admin."),
    editable=False,
    default=(),
)

register_setting(
    name="ADMIN_THUMB_SIZE",
示例#16
0
the setting is editable via Django's admin.

Thought should be given to how a setting is actually used before
making it editable, as it may be inappropriate - for example settings
that are only read during startup shouldn't be editable, since changing
them would require an application reload.
"""

from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


register_setting(
    name="ACCOUNTS_MIN_PASSWORD_LENGTH",
    description=_("Minimum length for passwords"),
    editable=False,
    default=6,
)

register_setting(
    name="ACCOUNTS_PROFILE_FORM_EXCLUDE_FIELDS",
    description=_("List of fields to exclude from the profile form."),
    editable=False,
    default=(),
)

register_setting(
    name="ACCOUNTS_PROFILE_FORM_CLASS",
    description=_("Dotted package path and class name of profile form to use "
        "for users signing up and updating their profile, when "
        "``mezzanine.accounts`` is installed."),
示例#17
0
from __future__ import unicode_literals

from django.utils.translation import ugettext_lazy as _
from mezzanine.conf import register_setting

register_setting(
    name="BUFFER_CLIENT_ID",
    label=_("Buffer Client ID"),
    editable=True,
    default='',
)

register_setting(
    name="BUFFER_CLIENT_SECRET",
    label=_("Buffer Client Secret"),
    editable=True,
    default='',
)

register_setting(
    name="BUFFER_ACCESS_TOKEN",
    label=_("Buffer Access Token"),
    editable=True,
    default='',
)
示例#18
0
####################################################################
#  This first set of settings already exists in Mezzanine but can  #
#  be overridden or appended to here with Cartridge values.        #
####################################################################

# Add shop admin modules to the admin menu.
register_setting(
    name="ADMIN_MENU_ORDER",
    description=_("Controls the ordering and grouping of the admin menu."),
    editable=False,
    default=(
        (_("Content"), (
            "pages.Page",
            "blog.BlogPost",
            "generic.ThreadedComment",
            (_("Media Library"), "fb_browse"),
        )),
        (_("Shop"), ("shop.Product", "shop.ProductOption", "shop.DiscountCode",
                     "shop.Sale", "shop.Order")),
        (_("Site"), ("sites.Site", "redirects.Redirect", "conf.Setting")),
        (_("Users"), (
            "auth.User",
            "auth.Group",
        )),
    ),
)

# Add the checkout URLs prefix to those forced to run over SSL.
# Only relevant if SSL_ENABLED (defined in Mezzanine) is True.
register_setting(
    name="SSL_FORCE_URL_PREFIXES",
    description="Sequence of URL prefixes that will be forced to run over "
示例#19
0
from django.conf import settings
from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting

register_setting(
    name="ADMIN_MENU_ORDER",
    description=_("Controls the ordering and grouping of the admin menu."),
    editable=False,
    default=(
        (_("Content"), (
            "pages.Page",
            "blog.BlogPost",
            "mezzanine_agenda.Event",
            "generic.ThreadedComment",
            (_("Media Library"), "fb_browse"),
        )),
        (_("Site"), ("sites.Site", "redirects.Redirect", "conf.Setting")),
        (_("Users"), (
            "auth.User",
            "auth.Group",
        )),
    ),
)

register_setting(
    name="EVENT_USE_FEATURED_IMAGE",
    description=_("Enable featured images in events"),
    editable=False,
    default=False,
from mezzanine.conf import register_setting

register_setting(
    name="CHECK_XHTML_SYNTAX",
    description="Enables the XHTML validator when editing a blog post.",
    editable=True,
    default=True,
)

register_setting(
    name="CHECK_XHTML_INTERVAL",
    description="Defines the interval in seconds between xhtml "
    "validations. Valid when CHECK_XHTML_SYNTAX=True",
    editable=True,
    default=15,
)

register_setting(
    name="REFRESH_PREVIEW_AUTO",
    description="Enables automatic preview updates editing a post entry",
    editable=True,
    default=False,
)

register_setting(
    name="REFRESH_PREVIEW_INTERVAL",
    description="Defines the interval in seconds between preview updates."
    " Valid when REFRESH_PREVIEW_AUTO=True",
    editable=True,
    default=15,
)
示例#21
0
"""
Default settings for the `mp_cms`.
The `editable` argument for each controls whether
the setting is editable via Django's admin.
"""
from __future__ import unicode_literals

from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting

register_setting(
    name='TEMPLATE_ACCESSIBLE_SETTINGS',
    append=True,
    default=(
        'GOOGLE_GTM_ID',
        'GOOGLE_GTM_ENABLED',
        'TRANSIFEX_API_KEY',
    ),
)

register_setting(
    name='GOOGLE_GTM_ID',
    label=_('Google Tag Manager ID'),
    description=_('Google Tag Manager ID '
                  '(https://www.google.com/analytics/tag-manager/)'),
    editable=True,
    default='',
)

register_setting(
示例#22
0
from mezzanine.conf import register_setting

register_setting(
    name="TEMPLATE_ACCESSIBLE_SETTINGS",
    append=True,
    default=("SOCIAL_LINK_FACEBOOK",
             "SOCIAL_LINK_TWITTER",
             "SOCIAL_LINK_PINTEREST",
             "SOCIAL_LINK_VIMEO",
             "SOCIAL_LINK_TUMBLR",
             "SOCIAL_LINK_DELICIOUS",
             ),
)

register_setting(
    name="SOCIAL_LINK_FACEBOOK",
    label="Facebook link",
    description="If present a Facebook icon linking here will be in the header.",
    editable=True,
    default="https://facebook.com/mezzatheme",
)

register_setting(
    name="SOCIAL_LINK_TWITTER",
    label="Twitter link",
    description="If present a Twitter icon linking here will be in the header.",
    editable=True,
    default="https://twitter.com/mezzatheme",
)

register_setting(
示例#23
0
# -*- coding:utf-8 -*-

from __future__ import absolute_import, unicode_literals

from mezzanine.conf import register_setting


# USE_VERIFY_CODE = False
# VERIFY_CODE_EXPIRED_SECONDS = 180
# VERIFY_CODE_TEMPLATE = "【切克闹】您的验证码是%s"
# SMS_API_KEY = "803998d17b6ff9eae33e38e3e407b773"

register_setting(
    name="SMS_USE_VERIFY_CODE",
    label="是否使用验证码",
    description="是否使用验证码",
    editable=True,
    default=False,
)

register_setting(
    name="SMS_VERIFY_CODE_EXPIRED_SECONDS",
    label="SMS_VERIFY_CODE_EXPIRED_SECONDS",
    description="SMS_VERIFY_CODE_EXPIRED_SECONDS",
    editable=True,
    default=180,
)

register_setting(
    name="SMS_VERIFY_CODE_TEMPLATE",
    label="SMS_VERIFY_CODE_TEMPLATE",
示例#24
0
the setting is editable via Django's admin.

Thought should be given to how a setting is actually used before
making it editable, as it may be inappropriate - for example settings
that are only read during startup shouldn't be editable, since changing
them would require an application reload.
"""

from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


register_setting(
    name="ACCOUNTS_MIN_PASSWORD_LENGTH",
    description=_("Minimum length for passwords"),
    editable=False,
    default=6,
)

register_setting(
    name="ACCOUNTS_NO_USERNAME",
    description=_("If ``True``, the username field will be excluded "
        "from sign up and account update forms."),
    editable=False,
    default=False,
)

register_setting(
    name="ACCOUNTS_PROFILE_FORM_EXCLUDE_FIELDS",
    description=_("List of fields to exclude from the profile form."),
    editable=False,
示例#25
0
Thought should be given to how a setting is actually used before
making it editable, as it may be inappropriate - for example settings
that are only read during startup shouldn't be editable, since changing
them would require an application reload.   
"""

from django.conf import settings
from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


register_setting(
    name="FORUM_USE_FEATURED_IMAGE",
    description=_("Enable featured images in forum posts"),
    editable=False,
    default=False,
)

_FORUM_URLS_DATE_FORMAT = ""
if getattr(settings, "FORUM_URLS_USE_DATE", False):
    _FORUM_URLS_DATE_FORMAT = "day"
    from warnings import warn
    warn("FORUM_URLS_USE_DATE setting is deprecated, please use the "
        "FORUM_URLS_DATE_FORMAT setting with a value of 'year', 'month', "
        "or 'day'.")

register_setting(
    name="FORUM_URLS_DATE_FORMAT",
    label=_("Forum post URL date format"),
    description=_("A string containing the value ``year``, ``month``, or "
示例#26
0
文件: defaults.py 项目: keznikl/bozp
from mezzanine.conf import register_setting
from django.utils.translation import ugettext_lazy as _


register_setting(
    name="NEWS_SLUG",
    label=_("News slug"),
    description=_("The slug name for page representing the news list."),
    editable=True,
    default="news",
)

register_setting(
    name="NEWS_PER_PAGE",
    label=_("News per page"),
    description=_("The number of news entries to show on a single page."),
    editable=True,
    default=10,
)

register_setting(
    name="NEWS_IMG_DIR",
    label=_("News image directory"),
    description=_("The directory for news images."),
    editable=True,
    default="uploads/news",
)
示例#27
0
that are only read during startup shouldn't be editable, since changing
them would require an application reload.
"""
from __future__ import unicode_literals

from django.conf import settings
from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting

register_setting(
    name="ADMIN_MENU_ORDER",
    description=_("Controls the ordering and grouping of the admin menu."),
    editable=False,
    default=(
        (_("Content"), ("pages.Page", "blog.BlogPost", "mezzanine_agenda.Event",
                        "generic.ThreadedComment", (_("Media Library"), "fb_browse"),)),
        (_("Site"), ("sites.Site", "redirects.Redirect", "conf.Setting")),
        (_("Users"), ("auth.User", "auth.Group",)),
    ),
)

register_setting(
    name="EVENT_USE_FEATURED_IMAGE",
    description=_("Enable featured images in events"),
    editable=False,
    default=False,
)

register_setting(
    name="EVENT_URLS_DATE_FORMAT",
示例#28
0
making it editable, as it may be inappropriate - for example settings
that are only read during startup shouldn't be editable, since changing
them would require an application reload.
"""
from django.conf import settings
from django.utils.translation import gettext_lazy as _

from mezzanine.conf import register_setting

generic_comments = getattr(settings, "COMMENTS_APP", "") == "mezzanine.generic"

if generic_comments:
    register_setting(
        name="COMMENTS_ACCOUNT_REQUIRED",
        label=_("Accounts required for commenting"),
        description=_("If ``True``, users must log in to comment."),
        editable=True,
        default=False,
    )

    register_setting(
        name="COMMENTS_DISQUS_SHORTNAME",
        label=_("Disqus shortname"),
        description=_("Shortname for the http://disqus.com comments " "service."),
        editable=True,
        default="",
    )

    register_setting(
        name="COMMENTS_DISQUS_API_PUBLIC_KEY",
        label=_("Disqus public key"),
示例#29
0
#!/usr/bin/env python
#coding: utf-8

from django.utils.translation import ugettext_lazy as _
from mezzanine.conf import register_setting

register_setting(
    name="WNI_SEARCH_PLACEHOLDER",
    label=_("Search form placeholder"),
    description=_("Placeholder for search form on web page, for Ads purpose"),
    editable=True,
    default=u"香蕉牛奶特价,只要10元",
)
示例#30
0
文件: defaults.py 项目: manojlds/pari
from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


register_setting(
    name="SITE_FULL_TITLE",
    label=_("Full Site Title"),
    description="Expanded title",
    editable=True,
    default="People's Archive of Rural India",
)
register_setting(
    name="ANALYTICS_PIWIK_URL",
    label=_("PIWIK hosted instance url ( don't include the protocol)"),
    description="Anyalytics with PIWIK",
    editable=True,
    default="analytics-ruralindiaonline.rhcloud.com",
)
register_setting(
    name="ANALYTICS_ENABLED",
    description="Setting to enable / disable analytics",
    editable=True,
    default=False,
)
register_setting(
    name="SOCIAL_FACEBOOK",
    label=_("Facebook Page Url"),
    description="Facebook Page Url for PARI",
    editable=True,
    default="http://facebook.com",
示例#31
0
from mezzanine.conf import register_setting

register_setting(
    name="MZEVENTS_GOOGLE_MAPS_DOMAIN",
    description="The Google Maps country domain to geocode addresses with",
    editable=True,
    default="maps.google.com.au",
)

register_setting(
    name="MZEVENTS_HIDPI_STATIC_MAPS",
    description="Generate maps suitable for Retina displays",
    editable=True,
    default=True,
)
示例#32
0
from mezzanine.conf import register_setting

register_setting(
        name="MAINTENANCE_ON",
        description="Configuration of the maintenance mode, True closes the site.",
        editable=True,
        default=False,
        )

示例#33
0
from mezzanine.conf import register_setting
from django.utils.translation import ugettext_lazy as _  # import as '_', used for trans

# These register setting to editable in the admin easily.
# http://mezzanine.jupo.org/docs/configuration.html#registering-settings

# Register our new settings, so we can change their vals in admin.
# this also makes them available in a view say as
# from mezzanine.conf import settings
# settings.SOCIAL_LINK_FACEBOOK.
# But if we want avail in template see further down.
register_setting(
    name="SOCIAL_LINK_FACEBOOK",
    label=_("Facebook link"),
    description=_("If present a Facebook icon linking here will be in the "
                  "header."),
    editable=True,
    default="https://facebook.com/mezzatheme",
)

register_setting(
    name="SOCIAL_LINK_FLICKR",
    label=_("Flickr link"),
    description=_("If present a Flickr icon linking here will be in the "
                  "header."),
    editable=True,
    default="",
)

register_setting(
    name="SOCIAL_LINK_GPLUS",
示例#34
0
Thought should be given to how a setting is actually used before
making it editable, as it may be inappropriate - for example settings
that are only read during startup shouldn't be editable, since changing
them would require an application reload.
"""

from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


register_setting(
    name="BLOG_BITLY_USER",
    label=_("bit.ly username"),
    description=_("Username for http://bit.ly URL shortening service."),
    editable=True,
    default="",
)

register_setting(
    name="BLOG_BITLY_KEY",
    label=_("bit.ly key"),
    description=_("Key for http://bit.ly URL shortening service."),
    editable=True,
    default="",
)

register_setting(
    name="BLOG_USE_FEATURED_IMAGE",
    description=_("Enable featured images in blog posts"),
示例#35
0
from mezzanine.conf import register_setting
from django.utils.translation import gettext as _  # import as '_', used for trans

# Register settings so that they are available in the admin for editing.

# Social settings

register_setting(
    name="SOCIAL_LINK_FACEBOOK",
    label=_("Facebook link"),
    description=_("If present a Facebook icon linking here will be in the "
                  "footer and contact sections."),
    editable=True,
    default="https://facebook.com/mezzatheme",
)

register_setting(
    name="SOCIAL_LINK_TWITTER",
    label=_("Twitter link"),
    description=_("If present a Twitter icon linking here will be in the "
                  "footer and contact sections."),
    editable=True,
    default="https://twitter.com/MEZZaTHEME",
)

register_setting(
    name="SOCIAL_LINK_VIMEO",
    label=_("Vimeo link"),
    description=_("If present a vimeo icon linking here will be in the "
                  "footer and contact sections."
                  ),  # the _(...) is the ugettext function imported as _
示例#36
0
from mezzanine.conf import register_setting


####################################################################
#  This first set of settings already exists in Mezzanine but can  #
#  be overridden or appended to here with Cartridge values.        #
####################################################################

# Add shop admin modules to the admin menu.
register_setting(
    name="ADMIN_MENU_ORDER",
    description=_("Controls the ordering and grouping of the admin menu."),
    editable=False,
    default=(
        (_("Content"), ("pages.Page", "blog.BlogPost",
            "generic.ThreadedComment", (_("Media Library"), "fb_browse"),)),
        (_("Shop"), ("shop.Product", "shop.ProductOption", "shop.DiscountCode",
            "shop.Sale", "shop.Order")),
        (_("Site"), ("sites.Site", "redirects.Redirect", "conf.Setting")),
        (_("Users"), ("auth.User", "auth.Group",)),
    ),
)

# Add the product model to the list of search choices.
register_setting(
    name="SEARCH_MODEL_CHOICES",
    description=_("Sequence of models that will be provided by default as "
        "choices in the search form. Each model should be in the format "
        "``app_label.model_name``. Only models that subclass "
        "``mezzanine.core.models.Displayable`` should be used."),
    editable=False,
示例#37
0
文件: defaults.py 项目: jowolf/tlg
from mezzanine.conf import register_setting

#register_setting (
#    name="SITE_LOGO",
#    label="Site Logo",
#    description="The Logo that appears with Site Title and Tagline.",
#    editable=True,
#    default='<img src="/img/logo.png" alt="{{ settings.SITE_TITLE }}", title="{{ settings.SITE_TITLE }}">',
#)

register_setting (
    name="ORG_LOGO",
    label="Organization Logo",
    description="The Logo that appears for the organization / domain, along with the Site Title and Tagline.",
    editable=True,
    default='<img src="/img/logo.png" alt="{{ settings.SITE_TITLE }}", title="{{ settings.SITE_TITLE }}">',
)

register_setting (
    name="ORG_THEME_COLOR",
    label="Organization Theme Color",
    description="The Theme Color that appears for the organization / domain.",
    editable=True,
    default='default',
    choices = (
        ('aqua',        'Aqua'),
        ('blue',        'Blue'),
        ('brown',       'Brown'),
        ('dark-blue',   'Dark Blue'),
        ('dark-red',    'Dark Red'),
        ('default',     'Default (Green)'),
示例#38
0
from django.utils.translation import ugettext as _
from mezzanine.conf import register_setting


register_setting(
    name="MEZZANINE_EDITOR_ENABLED",
    description=_("Toggles editor workflow."),
    editable=True,
    default=True,
)


register_setting(
    name="MEZZANINE_EDITOR_GROUPNAME",
    description=_("Name for editor group."),
    editable=True,
    default="Editor",
)


register_setting(
    name="MEZZANINE_EDITOR_SUPER",
    description=_("Treat superuser as an editor."),
    editable=True,
    default=False,
)
示例#39
0
from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting

register_setting(
    name='NEWSLETTER_FROM',
    label=_('An email address to send a newsletter from'),
    default='newsletter@localhost',
    editable=True,
)

register_setting(
    name='NEWSLETTER_TIMEOUT',
    label=_('Newsletter address activation in days'),
    default=7,
    editable=True,
)
示例#40
0
####################################################################
#  This first set of settings already exists in Mezzanine but can  #
#  be overridden or appended to here with Cartridge values.        #
####################################################################

# Add shop admin modules to the admin menu.
register_setting(
    name="ADMIN_MENU_ORDER",
    description=_("Controls the ordering and grouping of the admin menu."),
    editable=False,
    default=(
        (_("Content"), (
            "pages.Page",
            "blog.BlogPost",
            "generic.ThreadedComment",
            (_("Media Library"), "fb_browse"),
        )),
        (_("Shop"), ("shop.Product", "shop.ProductOption", "shop.DiscountCode",
                     "shop.Sale", "shop.Order")),
        (_("Site"), ("sites.Site", "redirects.Redirect", "conf.Setting")),
        (_("Users"), (
            "auth.User",
            "auth.Group",
        )),
    ),
)

# Add the product model to the list of search choices.
register_setting(
    name="SEARCH_MODEL_CHOICES",
    description=_(
        "Sequence of models that will be provided by default as "
示例#41
0
them would require an application reload.
"""

from django.conf import settings
from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


generic_comments = getattr(settings, "COMMENTS_APP", "") == "mezzanine.generic"

if generic_comments:
    register_setting(
        name="COMMENTS_ACCOUNT_REQUIRED",
        label=_("Accounts required for commenting"),
        description=_("If ``True``, users must log in to comment."),
        editable=True,
        default=False,
    )

    register_setting(
        name="COMMENTS_DISQUS_SHORTNAME",
        label=_("Disqus shortname"),
        description=_("Shortname for the http://disqus.com comments "
                      "service."),
        editable=True,
        default="",
    )

    register_setting(
        name="COMMENTS_DISQUS_API_PUBLIC_KEY",
from __future__ import unicode_literals

from mezzanine.conf import register_setting


register_setting(
    name="STRIPE_SK",
    label="Stripe secret key",
    editable=True,
    default="",
)

register_setting(
    name="STRIPE_PK",
    label="Stripe public key",
    editable=True,
    default="",
)

register_setting(
    name="PURCHASE_CREDIT_PRICE",
    label="Credit price",
    description="The price of each Track Credit",
    editable=True,
    default=10,
)

register_setting(
    name="TEMPLATE_ACCESSIBLE_SETTINGS",
    default=("PURCHASE_CREDIT_PRICE", "STRIPE_PK"),
    append=True
示例#43
0
from django.utils.translation import ugettext_lazy as _
from mezzanine.conf import register_setting

# newly registered social links
register_setting(
    name="SOCIAL_LINK_FACEBOOK",
    label=_("Facebook link"),
    description=_(
        "If present a Facebook icon linking here will be in the footer."),
    editable=True,
    default="https://www.facebook.com/<your-username>",
)

register_setting(
    name="SOCIAL_LINK_TWITTER",
    label=_("Twitter link"),
    description=_(
        "If present a Twitter icon linking here will be in the footer."),
    editable=True,
    default="https://twitter.com/<your-username>",
)

register_setting(
    name="SOCIAL_LINK_GOOGLE_PLUS",
    label=_("Google+ link"),
    description=_(
        "If present a Google+ icon linking here will be in the footer."),
    editable=True,
    default='http://plus.google.com/<your-username>/',
)
示例#44
0
        "openhelpdesk.add_tipology",
        "openhelpdesk.change_tipology",
        "openhelpdesk.delete_tipology",
        "auth.add_user",
        "auth.change_user",
        "auth.add_group",
        "auth.change_group",
    ],
)
OPENHELPDESK_MAX_TIPOLOGIES_FOR_TICKET = 3
OPENHELPDESK_LDAP_OPERATOR_GROUPS = "Domain Admins"
OPENHELPDESK_LDAP_REQUESTER_GROUPS = ""

register_setting(
    name="HELPDESK_REQUESTERS",
    description="The group name of requesters.",
    editable=False,
    default=HELPDESK_REQUESTERS[0],
)

register_setting(
    name="HELPDESK_OPERATORS",
    description="The group name of helpdesk operator.",
    editable=False,
    default=HELPDESK_OPERATORS[0],
)

register_setting(
    name="HELPDESK_ADMINS", description="The group name of helpdesk admins.", editable=False, default=HELPDESK_ADMINS[0]
)

register_setting(
示例#45
0
#
#   Copyright 2013 by Arnold Krille for bcs kommunikationsloesungen
#                     <*****@*****.**>
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
#

from mezzanine.conf import register_setting

register_setting(
    name="PAGEIMAGE_TYPES",
    description=
    "The list of image types defined by pageimages and used in the templates.",
    editable=False,
    default=(('BACKGROUND', 'Background image for the page'), ),
)
示例#46
0
from socket import gethostname

from django.conf import settings
from django.utils.translation import ugettext as _

from mezzanine.conf import register_setting


register_setting(
    name="SHOP_CARD_TYPES",
    description="Sequence of available credit card types for payment.",
    editable=False,
    default=("Mastercard", "Visa", "Diners", "Amex"),
)

register_setting(
    name="SHOP_CART_EXPIRY_MINUTES",
    description="Number of minutes of inactivity until carts are abandoned.",
    editable=False,
    default=30,
) 

register_setting(
    name="SHOP_CHECKOUT_ACCOUNT_ENABLED",
    description="If True, users can create a login for the checkout process.",
    editable=False,
    default=True,
)

register_setting(
示例#47
0
from django.utils.translation import ugettext as _

from mezzanine.conf import register_setting


##################################################
#  These first set of settings already exist in  #
#  mezzanine.conf.defaults, and are overridden   #
#  or appended to here, with Cartridge values.   #
##################################################

# Default to False in Mezzanine, change to True so checkout can have
# an account option.
register_setting(
    name="ACCOUNTS_ENABLED",
    description="If True, users can create an account.",
    editable=False,
    default=True,
)

# Add shop admin modules to the admin menu.
register_setting(
    name="ADMIN_MENU_ORDER",
    description=_("Controls the ordering and grouping of the admin menu."),
    editable=False,
    default=(
        (_("Content"), ("pages.Page", "blog.BlogPost",
            "generic.ThreadedComment", (_("Media Library"), "fb_browse"),)),
        (_("Shop"), ("shop.Product", "shop.ProductOption", "shop.DiscountCode",
            "shop.Sale", "shop.Order")),
        (_("Site"), ("sites.Site", "redirects.Redirect", "conf.Setting")),
        (_("Users"), ("auth.User", "auth.Group",)),
示例#48
0
them would require an application reload.
"""

from django.conf import settings
from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


generic_comments = getattr(settings, "COMMENTS_APP", "") == "mezzanine.generic"

if generic_comments:
    register_setting(
        name="COMMENTS_ACCOUNT_REQUIRED",
        label=_("Accounts required for commenting"),
        description=_("If ``True``, users must log in to comment."),
        editable=True,
        default=False,
    )

    register_setting(
        name="COMMENTS_DISQUS_SHORTNAME",
        label=_("Disqus shortname"),
        description=_("Shortname for the http://disqus.com comments "
                      "service."),
        editable=True,
        default="",
    )

    register_setting(
        name="COMMENTS_DISQUS_API_PUBLIC_KEY",
示例#49
0
from django.utils.translation import ugettext_lazy as _
from mezzanine.conf import register_setting

register_setting(
    name="Enable Twitter",
    label=_("For sending info about events"),
    description=_("For sending info about events."),
    editable=True,
    default=True,
)

register_setting(
    name="Consumer Key",
    label=_("Twitter Consumer Key"),
    description=_("Twitter Consumer Key"),
    editable=True,
    default="",
)

register_setting(
    name="Consumer Secret",
    label=_("Twitter Consumer Secret"),
    description=_("Twitter Consumer Secret."),
    editable=True,
    default="",
)

register_setting(
    name="Access Token",
    label=_("Twitter Access Token"),
    description=_("Twitter Access Token."),
示例#50
0
#
#   Copyright 2013 by Arnold Krille for bcs kommunikationsloesungen
#                     <*****@*****.**>
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
#

from mezzanine.conf import register_setting

register_setting(
    name="PAGEIMAGE_TYPES",
    description="The list of image types defined by pageimages and used in the templates.",
    editable=False,
    default=(
        ('BACKGROUND', 'Background image for the page'),
    ),
)
示例#51
0
from mezzanine.conf import register_setting

from django.utils.translation import ugettext as _

#register_setting(
#    name="IMAGE_FIELD_WIDGET_CLASS",
#    description=_("Dotted package path and class name of the widget to use "
#                  "for the image fields`."),
#    editable=False,
#    default="django.forms.FileInput",
#)

register_setting(
    name="RESTRICTED_WIDGETS",
    label="Restricted Widgets",
    description=_("Widgets which cannot be added by a client "),
    editable=False,
    append=True,
    default=[
        "TestWidget"
    ],
)

register_setting(
    name="WIDGET_PERMISSION_HANDLER",
    label="Widget Permission Handler",
    description=_("A class which handles permissions for widgets"),
    editable=False,
    default=None,
)
示例#52
0
Each of these can be overridden in your project's settings module, 
just like regular Django settings. 
The ``editable`` argument for each controls whether 
the setting is editable via Django's admin.
Thought should be given to how a setting is actually used before
making it editable, as it may be inappropriate - for example settings
that are only read during startup shouldn't be editable, since changing
them would require an application reload.
"""
from mezzanine.conf import register_setting

register_setting(
    name="PAGEDOWN_SERVER_SIDE_PREVIEW",
    description="Render previews on the server using the same "
                "converter that generates the actual pages.",
    editable=False,
    default=False,
)

register_setting(
    name="PAGEDOWN_MARKDOWN_EXTENSIONS",
    description="A tuple specifying enabled python-markdown extensions.",
    editable=False,
    default=(),
)

register_setting(
    name="PAGEDOWN_USE_MEZZANINE_HTML_ESCAPE",
    description="Use MEZZANINE's HTML escape processing. "
	            "When set to True, HTML escape of MEZZANINE according to RICH TEXT FILTER is done. ",
示例#53
0
them would require an application reload.
"""

from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


register_setting(
    name="PAGE_MENU_TEMPLATES",
    description=_("A sequence of templates used by the ``page_menu`` "
        "template tag. Each item in the sequence is a three item sequence, "
        "containing a unique ID for the template, a label for the template, "
        "and the template path. These templates are then available for "
        "selection when editing which menus a page should appear in. Note "
        "that if a menu template is used that doesn't appear in this "
        "setting, all pages will appear in it."),
    editable=False,
    default=(
        (1, _("Top navigation bar"), "pages/menus/dropdown.html"),
        (2, _("Left-hand tree"), "pages/menus/tree.html"),
        (3, _("Footer"), "pages/menus/footer.html"),
    ),
)

register_setting(
    name="PAGE_MENU_TEMPLATES_DEFAULT",
    description=_("A sequence of IDs from the ``PAGE_MENU_TEMPLATES`` "
        "setting that defines the default menu templates selected when "
        "creating new pages. By default all menu templates are selected. "
        "Set this setting to an empty sequence to have no templates "
        "selected by default."),
示例#54
0
Thought should be given to how a setting is actually used before
making it editable, as it may be inappropriate - for example settings
that are only read during startup shouldn't be editable, since changing
them would require an application reload.
"""

from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


register_setting(
    name="FORMS_DISABLE_SEND_FROM_EMAIL_FIELD",
    description=_("If ``True``, emails sent to extra recipients for form "
        "submissions won't be sent from an address taken from one of the "
        "form's email fields."),
    editable=False,
    default=False,
)

register_setting(
    name="FORMS_FIELD_MAX_LENGTH",
    description=_("Max length allowed for field values in the forms app."),
    editable=False,
    default=2000,
)

register_setting(
    name="FORMS_LABEL_MAX_LENGTH",
    description=_("Max length allowed for field labels in the forms app."),
    editable=False,
示例#55
0
文件: defaults.py 项目: CDC/cartridge
from socket import gethostname

from django.utils.translation import ugettext as _

from mezzanine.conf import register_setting

register_setting(
    name="SHOP_CARD_TYPES",
    description="Sequence of available credit card types for payment.",
    editable=False,
    default=("Mastercard", "Visa", "Diners", "Amex"),
)

register_setting(
    name="SHOP_CART_EXPIRY_MINUTES",
    description="Number of minutes of inactivity until carts are abandoned.",
    editable=False,
    default=30,
)

register_setting(
    name="SHOP_CHECKOUT_ACCOUNT_ENABLED",
    description="If True, users can create a login for the checkout process.",
    editable=False,
    default=True,
)

register_setting(
    name="SHOP_CHECKOUT_ACCOUNT_REQUIRED",
    description="If True, users must create a login for the checkout process.",
    editable=False,
示例#56
0
from __future__ import unicode_literals

from django.conf import settings
from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting

register_setting(
    name="ADMIN_MENU_ORDER",
    description=_("Controls the ordering and grouping of the admin menu."),
    editable=False,
    default=(
        (_("Content"), (
            "pages.Page",
            "blog.BlogPost",
            "generic.ThreadedComment",
            (_("Media Library"), "media-library"),
        )),
        (_("Site"), ("sites.Site", "redirects.Redirect", "conf.Setting")),
        (_("Users"), (
            "auth.User",
            "auth.Group",
        )),
    ),
)

register_setting(
    name="ADMIN_MENU_COLLAPSED",
    label=_("Collapse the Admin menu"),
    description=_("Controls whether or not the left-hand admin menu is "
                  "collapsed by default."),
    editable=True,
示例#57
0
from __future__ import unicode_literals
from future.builtins import range

from django.conf import settings
from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


generic_comments = getattr(settings, "COMMENTS_APP", "") == "mezzanine.generic"

if generic_comments:
    register_setting(
        name="COMMENTS_ACCOUNT_REQUIRED",
        label=_("Accounts required for commenting"),
        description=_("If ``True``, users must log in to comment."),
        editable=True,
        default=False,
    )

    register_setting(
        name="COMMENTS_DISQUS_SHORTNAME",
        label=_("Disqus shortname"),
        description=_("Shortname for the http://disqus.com comments "
                      "service."),
        editable=True,
        default="",
    )

    register_setting(
        name="COMMENTS_DISQUS_API_PUBLIC_KEY",