Example #1
0
                         help_text=u"На какой сумме заканчивается диапазон.",
                         default=50000))

config_register(
    PositiveIntegerValue(MYAPP_GROUP,
                         'TIME_START',
                         description=u'Диапазон времени. Начало.',
                         help_text=u"С какого времени начинается диапазон.",
                         default=1))

config_register(
    PositiveIntegerValue(
        MYAPP_GROUP,
        'TIME_END',
        description=u'Диапазон времени. Конец.',
        help_text=u"Через сколько недель заканчивается диапазон.",
        default=50))

config_register(
    StringValue(MYAPP_GROUP,
                'EMAIL',
                description=u'Email администратора',
                help_text=u"Почта, куда будут приходить заявки.",
                default='*****@*****.**'))

config_register(
    PercentValue(MYAPP_GROUP,
                 'PERCENT',
                 description=u'Процентная ставка',
                 help_text=u"Процентная ставка в неделю.",
                 default=0.02))
Example #2
0
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION
from livesettings import (ConfigurationGroup, BooleanValue, StringValue, LongStringValue)
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import string_concat

register = settings.register

ACCESS_CONTROL = ConfigurationGroup('ACCESS_CONTROL', _('Access control settings'),
                                    super_group=LOGIN_USERS_COMMUNICATION)

register(BooleanValue(ACCESS_CONTROL, 'READ_ONLY_MODE_ENABLED', default=False, description=_('Make site read-only')))

register(StringValue(
    ACCESS_CONTROL, 'READ_ONLY_MESSAGE',
    default=_('The site is temporarily read-only. Only viewing of the content is possible at the moment.')))

register(BooleanValue(ACCESS_CONTROL, 'ASKBOT_CLOSED_FORUM_MODE', default=False,
                      description=_('Allow only registered user to access the forum')))


EMAIL_VALIDATION_CASE_CHOICES = (
    ('nothing', _('nothing - not required')),
    ('see-content', _('account registration')),
    # 'post-content', _('posting content'),
)


register(StringValue(ACCESS_CONTROL, 'REQUIRE_VALID_EMAIL_FOR', default='nothing',
                     choices=EMAIL_VALIDATION_CASE_CHOICES, description=_('Require valid email for')))
Example #3
0
        description=_("Required shipping data"),
        help_text=_(
            "Similar to'REQUIRED_BILLING_DATA', except for shipping fields."),
        default=('addressee', 'street1', 'city', 'postal_code', 'country'),
        choices=(('addressee', _("Addressee")), ('street1', _("Street")),
                 ('street2', _("Street (second line)")), ('city', _("City")),
                 ('state', _("State/Province")), ('postal_code',
                                                  _("Postal code/ZIP")),
                 ('country', _("Country")))))

# I am doing it this way instead of a boolean for email verification because I
# intend to add a "manual approval" style of account verification. -Bruce
ACCOUNT_VERIFICATION = config_register(
    StringValue(
        SHOP_GROUP,
        'ACCOUNT_VERIFICATION',
        description=_("Account Verification"),
        help_text=
        _("Select the style of account verification.  'Immediate' means no verification needed."
          ),
        default="IMMEDIATE",
        choices=[('IMMEDIATE', _('Immediate')), ('EMAIL', _('Email'))]))

config_register(
    IntegerValue(SHOP_GROUP,
                 'ACCOUNT_ACTIVATION_DAYS',
                 description=_('Days to verify account'),
                 default=7,
                 requires=ACCOUNT_VERIFICATION,
                 requiresvalue='EMAIL'))
Example #4
0
from askbot.conf.super_groups import EXTERNAL_SERVICES
from livesettings import ConfigurationGroup, BooleanValue, StringValue

SOCIAL_SHARING = ConfigurationGroup('SOCIAL_SHARING',
                                    _('Content sharing'),
                                    super_group=EXTERNAL_SERVICES)

settings.register(
    BooleanValue(SOCIAL_SHARING,
                 'RSS_ENABLED',
                 default=True,
                 description=_('Check to enable RSS feeds')))

settings.register(
    StringValue(SOCIAL_SHARING,
                'SHARING_SUFFIX_TEXT',
                default='',
                description=_('Hashtag or suffix to sharing messages')))

settings.register(
    BooleanValue(
        SOCIAL_SHARING,
        'ENABLE_SHARING_FACEBOOK',
        default=True,
        description=_('Check to enable sharing of questions on Facebook')))

settings.register(
    BooleanValue(
        SOCIAL_SHARING,
        'ENABLE_SHARING_LINKEDIN',
        default=True,
        description=_('Check to enable sharing of questions on LinkedIn')))
Example #5
0
project_root = os.path.dirname(
    os.path.normpath(
        sys.modules[os.environ['DJANGO_SETTINGS_MODULE']].__file__))
# default value `project_root + 'static'` is currently the best common for all Django 1.2 - 1.4
default_icon_url = urlparse.urlunsplit(
    ('file', '', os.path.join(project_root, 'static',
                              'images/sample-logo.bmp'), '', ''))

#### SHOP Group ####

LOGO_URI = config_register(
    StringValue(SHOP_GROUP,
                'LOGO_URI',
                description=_("URI to the logo for the store"),
                help_text=_(
                    ("For example http://www.example.com/images/logo.jpg or "
                     "file:///var/www/html/images/logo.jpg")),
                default=default_icon_url))

ENFORCE_STATE = config_register(
    BooleanValue(
        SHOP_GROUP,
        'ENFORCE_STATE',
        description=_('State required?'),
        help_text=
        _("Require a state during registration/checkout for countries that have states?"
          ),
        default=True))

SHOW_SITE = config_register(
Example #6
0
# -*- coding: utf-8 -*-
from livesettings import config_register, ConfigurationGroup, StringValue
from django.utils.translation import ugettext_lazy as _

from product.models import Category

from .utils import ModelValue

# GIFT_INFO configs
GIFT_INFO = ConfigurationGroup('GIFT_INFO',
                               _('Gift configurations'),
                               ordering=0)

# Codice univoco
config_register(
    StringValue(GIFT_INFO,
                'LABEL',
                description=_('Label for gift orders annotation'),
                help_text="",
                default="Is a gift."))

# Gift category
config_register(
    ModelValue(GIFT_INFO,
               'GIFT_CATEGORY',
               description=_(u'Gift Category'),
               help_text=_(u"Choose which category contains gift products"),
               queryset=Category.objects.all(),
               required=False))
Example #7
0
from livesettings import ConfigurationGroup, BooleanValue, StringValue


SPAM_AND_MODERATION = ConfigurationGroup(
    'SPAM_AND_MODERATION',
    _('Akismet spam protection'),
    super_group=EXTERNAL_SERVICES
)


settings.register(
    BooleanValue(
        SPAM_AND_MODERATION,
        'USE_AKISMET',
        description=_('Enable Akismet spam detection(keys below are required)'),
        default=False,
        help_text=_('To get an Akismet key please visit <a href="%(url)s">Akismet site</a>') % {
            'url': const.DEPENDENCY_URLS['akismet']}
    )
)


settings.register(
    StringValue(
        SPAM_AND_MODERATION,
        'AKISMET_API_KEY',
        description=_('Akismet key for spam detection')
    )
)

Example #8
0
class EmailValue(StringValue):
    def make_field(self, **kwargs):
        validators = kwargs.setdefault('validators', [])
        validators.append(validate_email)
        return super(EmailValue, self).make_field(**kwargs)


SHOP_CONFIG = ConfigurationGroup('SHOP_CONFIG',
                                 _(u'Shop configuration'),
                                 ordering=0)

config_register(
    StringValue(
        SHOP_CONFIG,
        'SHOP_NAME',
        description=_(u'Shop name'),
        help_text=_(u'The name of the site, shown on all pages and mails'),
        default=u"Sho Name"))

config_register(
    IBANValue(SHOP_CONFIG,
              'IBAN',
              description=_(u'IBAN'),
              help_text=_(
                  u'your bank account code: fill in if you have chosen '
                  u'to accept payments via bank transfer'),
              default=u''))

config_register(
    StringValue(SHOP_CONFIG,
                'ADDRESS',
Example #9
0
         "list of valid credit card numbers."),
     default=False),
 ModuleValue(PAYMENT_GROUP,
             'MODULE',
             description=_('Implementation module'),
             hidden=True,
             default='payment.modules.payflowpro'),
 BooleanValue(PAYMENT_GROUP,
              'CAPTURE',
              description=_('Capture Payment immediately?'),
              default=True,
              help_text=_('IMPORTANT: If false, a capture attempt will be '
                          'made when the order is marked as shipped.')),
 StringValue(PAYMENT_GROUP,
             'KEY',
             description=_("Module key"),
             hidden=True,
             default='PAYFLOWPRO'),
 StringValue(
     PAYMENT_GROUP,
     'LABEL',
     description=_('English name for this group on the checkout screens'),
     default='Credit Cards',
     dummy=_('Credit Cards'),  # Force this to appear on po-files
     help_text=_('This will be passed to the translation utility')),
 StringValue(PAYMENT_GROUP,
             'URL_BASE',
             description=_(
                 'The url base used for constructing urlpatterns which '
                 'will use this module'),
             default=r'^credit/'),
Example #10
0
# -*- coding: utf-8 -*-
from livesettings import config_register, ConfigurationGroup, PositiveIntegerValue, PercentValue, StringValue
from django.utils.translation import ugettext_lazy as _

# First, setup a grup to hold all our possible configs
MYAPP_GROUP = ConfigurationGroup(
    'MyApp',  # key: internal name of the group to be created
    u'Настройки сайта',  # name: verbose name which can be automatically translated
    ordering=0  # ordering: order of group in the list (default is 1)
)

config_register(
    StringValue(MYAPP_GROUP,
                'EMAIL',
                description=u'Email администратора',
                help_text=u"Почта, куда будут приходить заявки.",
                default='*****@*****.**'))

config_register(
    StringValue(MYAPP_GROUP,
                'PHONE',
                description=u'Телефон',
                default='+7(495) 969 88 69'))
Example #11
0
#pylint: disable=E1102
#        '_ is not callable'
from livesettings import config_register, ConfigurationGroup, StringValue, \
    BooleanValue, PasswordValue, IntegerValue
from django.utils.translation import ugettext_lazy as _

RECEIVEMAIL_GROUP = ConfigurationGroup(
    'ReceiveMail',               # key: internal name of the group to be created
    _('Receiving email Settings (POP3)'),  # name: verbose name which can be automatically translated
    ordering=0             # ordering: order of group in the list (default is 1)
    )

config_register(StringValue(
    RECEIVEMAIL_GROUP,           # group: object of ConfigurationGroup created above
        'USERNAME',      # key:   internal name of the configuration value to be created
        description = _('Username'),              # label for the value
        help_text = _("Enter the Username used to access the email account."),  # help text
        ordering = 0
    ))

config_register(PasswordValue(
    RECEIVEMAIL_GROUP,
        'PASSWORD',
        description='Password',
        help_text='Enter the password to access this mail account.',
        render_value=True,
        ordering = 1
    ))

config_register(StringValue(
    RECEIVEMAIL_GROUP,
Example #12
0
                 help_text=_(
                     u"sets the maximum number of offers to be shown in the "
                     u"splash page"),
                 default=Decimal('3')))

# SOCIALS_INFO configs
SOCIALS_INFO = ConfigurationGroup('SOCIALS_INFO',
                                  _('Socials urls info'),
                                  ordering=0)

# facebook
config_register(
    StringValue(
        SOCIALS_INFO,
        'FACEBOOK_URL',
        description=_(u'Facebook url'),
        help_text=_(u"Insert personal facebook url"),
        default="",
    ))

# twitter
config_register(
    StringValue(
        SOCIALS_INFO,
        'TWITTER_URL',
        description=_('Twitter url'),
        help_text=_(u"Insert personal twitter url"),
        default="",
    ))

# linkedin
Example #13
0
    from askbot.models import Group
    cleaned_new_name = clean_group_name(new_name.strip())

    if new_name == '':
        # name cannot be empty
        return old_name

    group = Group.objects.get_global_group()
    group.name = cleaned_new_name
    group.save()
    return new_name
"""

register(
    StringValue(GROUP_SETTINGS,
                'GLOBAL_GROUP_NAME',
                default=_('everyone'),
                description=_('Global user group name'),
                help_text=_('All users belong to this group automatically')))
# update_callback=group_name_update_callback

register(
    BooleanValue(
        GROUP_SETTINGS,
        'GROUP_EMAIL_ADDRESSES_ENABLED',
        default=False,
        description=_('Enable group email adddresses'),
        help_text=
        _('If selected, users can post to groups by email "*****@*****.**"'
          )))
Example #14
0
        MARKUP,
        'ENABLE_MATHJAX',
        description=_('Mathjax support (rendering of LaTeX)'),
        help_text=_('If you enable this feature, '
                    '<a href="%(url)s">mathjax</a> must be '
                    'installed on your server in its own directory.') % {
                        'url': const.DEPENDENCY_URLS['mathjax'],
                    },
        default=False))

settings.register(
    StringValue(MARKUP,
                'MATHJAX_BASE_URL',
                description=_('Base url of MathJax deployment'),
                help_text=_('Note - <strong>MathJax is not included with '
                            'askbot</strong> - you should deploy it yourself, '
                            'preferably at a separate domain and enter url '
                            'pointing to the "mathjax" directory '
                            '(for example: http://mysite.com/mathjax)'),
                default=''))

settings.register(
    BooleanValue(MARKUP,
                 'ENABLE_AUTO_LINKING',
                 description=_('Enable autolinking with specific patterns'),
                 help_text=_('If you enable this feature, '
                             'the application  will be able to '
                             'detect patterns and auto link to URLs'),
                 default=False))

settings.register(
Example #15
0
#!/usr/bin/env python

from livesettings import config_register, BooleanValue, ConfigurationGroup, FloatValue, PositiveIntegerValue, StringValue
from django.utils.translation import ugettext_lazy as _

# Site domain settings
DOMAIN_GROUP = ConfigurationGroup(
    'DOMAIN',
    _('Site domain'),
    ordering=0
)

config_register(StringValue(
    DOMAIN_GROUP,
    'SITE_DOMAIN',
    description=_('Site domain to be referenced in outgoing email.'),
    default='localhost:8000'
))

# Email settings
EMAIL_GROUP = ConfigurationGroup(
    'EMAIL',
    _('Email'),
    ordering=1
)

config_register(BooleanValue(
    EMAIL_GROUP,
    'EMAIL_ENABLED',
    description=_('Enable email?'),
    help_text=_('If enabled, notifications and activation messages will be sent via email.'),
Example #16
0
                    'MODERATION',
                    _('Content moderation'),
                    super_group=DATA_AND_FORMATTING
                )

CONTENT_MODERATION_MODE_CHOICES = (
    ('flags', _('audit flagged posts')),
    ('audit', _('audit flagged posts and watched users')),
    ('premoderation', _('pre-moderate watched users and audit flagged posts')),
)

settings.register(
    StringValue(
        MODERATION,
        'CONTENT_MODERATION_MODE',
        choices=CONTENT_MODERATION_MODE_CHOICES,
        default='flags',
        description=_('Content moderation method'),
        help_text=_("Audit is made after the posts are published, pre-moderation prevents publishing before moderator's decision.")
    )
)

settings.register(
    LongStringValue(
        MODERATION,
        'FORBIDDEN_PHRASES',
        default='',
        description=_('Reject all posts with these phrases'),
        help_text=_('Enter one phrase per line (case-insensitive). '
            'Posts with these phrases will be rejected '
            'without moderation.'
        )
Example #17
0
# -*- coding: utf-8 -*-
from livesettings import config_register, ConfigurationGroup, PositiveIntegerValue, PercentValue, StringValue
from django.utils.translation import ugettext_lazy as _

# First, setup a grup to hold all our possible configs
MYAPP_GROUP = ConfigurationGroup(
    'MyApp',  # key: internal name of the group to be created
    u'Настройки сайта',  # name: verbose name which can be automatically translated
    ordering=0  # ordering: order of group in the list (default is 1)
)

config_register(
    StringValue(MYAPP_GROUP,
                'EMAIL',
                description=u'Email администратора',
                help_text=u"Почта, куда будут приходить заявки.",
                default='*****@*****.**'))

config_register(
    StringValue(MYAPP_GROUP,
                'PHONE',
                description=u'Телефон',
                help_text=u"Для отображения на сайте",
                default='8 (926) 555-55-55'))

config_register(
    StringValue(MYAPP_GROUP,
                'ORDERS_COUNT',
                description=u'Кол-во заказов выполненных',
                help_text=u"Для отображения в шапке сайта",
                default='986'))
Example #18
0
# -*- coding: utf-8 -*-

from django.utils.translation import ugettext_lazy as _
from livesettings import ConfigurationGroup, PositiveIntegerValue, MultipleStringValue, StringValue, BooleanValue, config_register, config_register_list

PRODUCT_GROUP = ConfigurationGroup('PRODUCT', _('Product Settings'))

config_register(
    StringValue(PRODUCT_GROUP,
                'IMAGE_DIR',
                description=_("Upload Image Dir"),
                help_text=_("""Directory name for storing uploaded images.
    This value will be appended to MEDIA_ROOT.  Do not worry about slashes.
    We can handle it any which way."""),
                default="images"))

config_register_list(
    PositiveIntegerValue(
        PRODUCT_GROUP,
        'NUM_DISPLAY',
        description=_("Total featured"),
        help_text=_("Total number of featured items to display"),
        default=20),
    PositiveIntegerValue(
        PRODUCT_GROUP,
        'NUM_PAGINATED',
        description=_("Number featured"),
        help_text=_("Number of featured items to display on each page"),
        default=10),
    MultipleStringValue(
        PRODUCT_GROUP,