示例#1
0
'''
This file defines a variety of preferences that must be set in the DB,
but can be changed dynamically.
'''

from django.utils.translation import ugettext_lazy as _

from dynamic_preferences.types import BooleanPreference, StringPreference, Section
from dynamic_preferences.registries import global_preferences_registry

# we create some section objects to link related preferences together

requirements = Section('requirements', _('Class Requirements'))


################################
# Class Requirements Preferences
#
@global_preferences_registry.register
class EnableRequirements(BooleanPreference):
    section = requirements
    name = 'enableRequirements'
    verbose_name = _('Requirements Enabled')
    help_text = _(
        'If this box is unchecked, then all requirement checks during registration will be disabled.'
    )
    default = True


@global_preferences_registry.register
class RequirementErrorMessage(StringPreference):
示例#2
0
# -*- coding: utf-8 -*-
__author__ = 'lundberg'

from dynamic_preferences.types import StringPreference, Section
from dynamic_preferences.registries import global_preferences_registry
from .models import UniqueIdGenerator

general = Section('general')
announcements = Section('announcements')
id_gen = Section('id_generators')


@global_preferences_registry.register
class DataDomain(StringPreference):
    section = general
    name = 'data_domain'
    default = 'common'
    help_text = 'Used for dynamic loading of forms (restart required)'


@global_preferences_registry.register
class MoreInfoLink(StringPreference):
    section = general
    name = 'more_info_link'
    default = 'https://portal.nordu.net/display/nordunetops/'
    help_text = 'Base url for more information links on detail pages'


@global_preferences_registry.register
class PageFlashMessage(StringPreference):
    section = announcements
示例#3
0
from django.utils.translation import ugettext_lazy as _
from django.template.loader import get_template

from dynamic_preferences.types import BooleanPreference, StringPreference, IntegerPreference, FloatPreference, ChoicePreference, ModelChoicePreference, Section
from dynamic_preferences.registries import global_preferences_registry
from filer.models import Folder
from cms.models import Page
from cms.forms.fields import PageSelectFormField

from .utils.serializers import PageModelSerializer
from .models import EventStaffCategory, EmailTemplate, get_defaultEmailName, get_defaultEmailFrom

# we create some section objects to link related preferences together

general = Section('general', _('General Settings'))
contact = Section('contact', _('Contact Info'))
registration = Section('registration', _('Registration'))
email = Section('email', _('Email'))
calendar = Section('calendar', _('Calendar'))


############################
# General Preferences
#
@global_preferences_registry.register
class CurrencyCode(StringPreference):
    section = general
    name = 'currencyCode'
    verbose_name = _('Currency Code')
    help_text = _('Use a three-letter currency code for compatibility with payment systems')
示例#4
0
from dynamic_preferences.types import StringPreference,IntegerPreference, BooleanPreference, Section
from dynamic_preferences.registries import global_preferences_registry
from django.conf import settings


general_section = Section('general')
homepage_section = Section('homepage')


@global_preferences_registry.register
class SiteTitle(StringPreference):
    section = general_section
    name = 'admin_title'
    verbose_name = 'Admin Site Title'
    default = 'Global Trade Motors'


@global_preferences_registry.register
class SiteHeader(StringPreference):
    section = general_section
    name = 'admin_header'
    verbose_name = 'Admin Site Header'
    default = 'Global Trade Motors'


@global_preferences_registry.register
class NumberOfVehiclesOnHompage(IntegerPreference):
    section = homepage_section
    name = 'number_of_vehicles'
    verbose_name = 'Homepage Vehicles'
    help_text = 'Please enter the number of vehicles to show on homepage.'
示例#5
0
from django.utils.translation import ugettext_lazy as _
from dynamic_preferences.registries import global_preferences_registry
from dynamic_preferences.types import Section, BooleanPreference

admin = Section("admin")


@global_preferences_registry.register
class LogAllReceivePayloads(BooleanPreference):
    section = admin
    name = "log_all_receive_payloads"
    default = False
    verbose_name = _("Log all receive payloads")
    help_text = _(
        "If set to true, all received payloads will be written at DEBUG level to app logfile."
        "This is a performance hit so should only be turned on for temporary debugging."
    )
示例#6
0
from django import forms
from dynamic_preferences.registries import global_preferences_registry
from dynamic_preferences.types import Section, StringPreference

acoustid = Section("providers_acoustid")


@global_preferences_registry.register
class APIKey(StringPreference):
    section = acoustid
    name = "api_key"
    default = ""
    verbose_name = "Acoustid API key"
    help_text = "The API key used to query AcoustID. Get one at https://acoustid.org/new-application."
    widget = forms.PasswordInput
    field_kwargs = {"required": False}
from dynamic_preferences.types import BooleanPreference, IntegerPreference, StringPreference, Section
from dynamic_preferences.registries import user_preferences_registry
from django import forms

email_settings = Section('email_settings')


@user_preferences_registry.register
class EnableTLS(BooleanPreference):
    """Do you want to be notified on comment publication ?"""
    section = email_settings
    name = 'enable_TSL'
    default = True
    verbose_name = 'Enable TLS'
    help_text = 'check, if you want to enable TLS'


@user_preferences_registry.register
class EmailHost(StringPreference):
    section = email_settings
    name = 'comment_notifications_enabled'
    default = 'smtp.gmail.com'
    verbose_name = 'E-mail host'
    help_text = 'outgoing server (e.g. smtp)'


@user_preferences_registry.register
class EmailHostUser(StringPreference):
    section = email_settings
    name = 'email_host_user'
    default = '*****@*****.**'
示例#8
0
# dynamic_preferences_registry.py

from dynamic_preferences.types import BooleanPreference, StringPreference, Section
from dynamic_preferences.registries import user_preferences_registry, global_preferences_registry

# we create some section objects to link related preferences together

# general = Section('general')
discussion = Section('discussion')


# # We start with a global preference
# @global_preferences_registry.register
# class SiteTitle(StringPreference):
#     section = general
#     name = 'title'
#     default = 'My site'
#
#
# @global_preferences_registry.register
# class MaintenanceMode(BooleanPreference):
#     name = 'maintenance_mode'
#     default = False


# now we declare a per-user preference
@user_preferences_registry.register
class CommentNotificationsEnabled(BooleanPreference):
    """Do you want to be notified on comment publication ?"""
    section = discussion
    name = 'comment_notifications_enabled'
示例#9
0
#!/usr/bin/env python
# vim: set expandtab tabstop=4 shiftwidth=4:

from dynamic_preferences.types import StringPreference, BooleanPreference, Section
from dynamic_preferences.registries import global_preferences_registry
from dynamic_preferences.users.registries import user_preferences_registry

exordium = Section('exordium')

@global_preferences_registry.register
class LibraryPath(StringPreference):
    section = exordium
    name = 'base_path'
    default = '/var/audio'
    verbose_name = 'Exordium Library Base Path'
    help_text = 'Where on the filesystem can music files be found?'

@global_preferences_registry.register
class LibraryUrlHTML5(StringPreference):
    section = exordium
    name = 'media_url_html5'
    default = 'http://localhost/media'
    verbose_name = 'Exordium Media URL for HTML5'
    help_text = 'What is a direct URL to the media directory, for HTML5 streaming?'

@global_preferences_registry.register
class LibraryUrlM3U(StringPreference):
    section = exordium
    name = 'media_url_m3u'
    default = 'http://localhost/media'
    verbose_name = 'Exordium Media URL for m3u'
示例#10
0
# blog/dynamic_preferences_registry.py

from dynamic_preferences.types import StringPreference, Section
from dynamic_preferences.registries import global_preferences_registry

instances_section = Section('instances')


@global_preferences_registry.register
class DetailDashboardUrl(StringPreference):
    section = instances_section
    name = 'detail_dashboard_url'
    default = 'https://dashboards.mnm.social/dashboard/db/instance-detail?var-instance={instance}'
from dynamic_preferences.types import BooleanPreference, Section, ChoicePreference
from dynamic_preferences.users.registries import user_preferences_registry

ui = Section('ui')
homepage = Section('homepage')


@user_preferences_registry.register
class ThemeSkin(ChoicePreference):
    verbose_name = "Tema de interfaz"
    choices = (
        ("skin-blue", "Azul"),
        ("skin-blue-light", "Azul-blanco"),
        ("skin-black-light", "Blanco"),
        ("skin-black", "Blanco-negro"),
        ("skin-red", "Rojo"),
        ("skin-red-light", "Rojo-blanco"),
        ("skin-green", "Verde"),
        ("skin-green-light", "Verde-blanco"),
        ("skin-yellow", "Amarillo"),
        ("skin-yellow-light", "Amarillo-blanco"),
        ("skin-purple", "Morado"),
        ("skin-purple-light", "Morado-blanco"),)
    section = "ui"
    name = "skin"
    default = "skin-blue"


@user_preferences_registry.register
class ThemeSkin(BooleanPreference):
    verbose_name = "Navegación estática"
but can be changed dynamically.
'''

from django.utils.translation import ugettext_lazy as _
from django.db import connection
from django.template.loader import get_template

from dynamic_preferences.types import BooleanPreference, StringPreference, FloatPreference, ModelChoicePreference, Section
from dynamic_preferences.registries import global_preferences_registry

from danceschool.core.models import EmailTemplate, get_defaultEmailName, get_defaultEmailFrom
from .models import VoucherCategory

# we create some section objects to link related preferences together

vouchers = Section('vouchers', _('Vouchers/Gift Certificates'))
referrals = Section('referrals', _('Referral Program'))


##############################
# General Vouchers/Gift Cert Preferences
#
@global_preferences_registry.register
class VouchersEnabled(BooleanPreference):
    section = vouchers
    name = 'enableVouchers'
    verbose_name = _('Enable Vouchers')
    help_text = _('If checked, then voucher functionality will be enabled.')
    default = True

'''
This file defines a variety of preferences that must be set in the DB,
but can be changed dynamically.
'''

from django.utils.translation import ugettext_lazy as _

from dynamic_preferences.types import FloatPreference, Section
from dynamic_preferences.registries import global_preferences_registry

paypal = Section('paypal', _('Paypal'))


##############################
# Referral Program Preferences
#
@global_preferences_registry.register
class FixedTransactionFee(FloatPreference):
    section = paypal
    name = 'fixedTransactionFee'
    verbose_name = _('Paypal fixed transaction fee')
    help_text = _(
        'Paypal fees consist of a fixed fee plus a percentage of the total price.  When a refund is made, the  the U.S., the variable percentage is refunded, but the fixed fee is not.  In the U.S., this fixed fee is $0.30.  Entering your country\'s fee here ensures that your accounting will remain accurate when you refund students.'
    )
    default = 0.30
示例#14
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from dynamic_preferences.types import Section
from dynamic_preferences.types import StringPreference
from dynamic_preferences.types import BooleanPreference
from dynamic_preferences.types import LongStringPreference
from dynamic_preferences.registries import global_preferences_registry

general = Section('general')


@global_preferences_registry.register
class SiteTitle(StringPreference):
    section = general
    name = 'title'
    default = 'COSAS DE TÍOS'


@global_preferences_registry.register
class GoogleAnalytics(StringPreference):
    section = general
    name = 'trackingId'
    default = 'UA-00000000-0'


@global_preferences_registry.register
class GoogleADs(StringPreference):
    section = general
    name = 'adsId'
    default = 'ca-pub-0000000000000000'
示例#15
0
'''
This file defines a variety of preferences that must be set in the DB,
but can be changed dynamically.
'''
from django.utils.translation import ugettext_lazy as _

from dynamic_preferences.types import BooleanPreference, IntegerPreference, ModelChoicePreference, Section
from dynamic_preferences.registries import global_preferences_registry

from .models import ExpenseCategory, RevenueCategory

# we create some section objects to link related preferences together

financial = Section('financial', _('Financial App'))


##############################
# Referral Program Preferences
#
@global_preferences_registry.register
class GenerateEventStaffExpensesEnabled(BooleanPreference):
    section = financial
    name = 'autoGenerateExpensesEventStaff'
    verbose_name = _('Auto-generate ExpenseItems for completed events')
    help_text = _(
        'Uncheck to disable the automatic generation of expense items for class series instructors in the financial app.'
    )
    default = True


@global_preferences_registry.register
示例#16
0
# blog/dynamic_preferences_registry.py

from dynamic_preferences.types import IntegerPreference, Section
from dynamic_preferences.registries import global_preferences_registry

# we create some section objects to link related preferences together
linkage_cpp = Section('linkage_cpp')


@global_preferences_registry.register
class LDAOuterTitle(IntegerPreference):
    section = linkage_cpp
    name = 'max_outer_lda'
    default = 10


@global_preferences_registry.register
class LDAOuterTitle(IntegerPreference):
    section = linkage_cpp
    name = 'max_inner_lda'
    default = 10


@global_preferences_registry.register
class LDARepeatTitle(IntegerPreference):
    section = linkage_cpp
    name = 'n_repeat'
    default = 4
示例#17
0
from django.utils.translation import ugettext_lazy as _
from dynamic_preferences.types import Section, BooleanPreference
from dynamic_preferences.users.registries import user_preferences_registry

streams = Section("streams")


@user_preferences_registry.register
class UseNewStream(BooleanPreference):
    section = streams
    name = "use_new_stream"
    default = True
    verbose_name = _("Use new stream")
    help_text = _(
        "Set this to use the new alpha stream when possible. Warning! Not all functionality is available "
        "in the new stream.")
示例#18
0
from dynamic_preferences.types import BooleanPreference, ChoicePreference, FloatPreference, IntegerPreference, Section, StringPreference

from standings.teams import TeamStandingsGenerator
from tournaments.utils import get_position_name_choices

from .types import MultiValueChoicePreference
from .models import tournament_preferences_registry

# ==============================================================================
scoring = Section('scoring')
# ==============================================================================


@tournament_preferences_registry.register
class MinimumSpeakerScore(FloatPreference):
    help_text = "Minimum allowed score for substantive speeches"
    section = scoring
    name = 'score_min'
    verbose_name = 'Minimum speaker score'
    default = 68.0


@tournament_preferences_registry.register
class MaximumSpeakerScore(FloatPreference):
    verbose_name = 'Maximum speaker score'
    help_text = "Maximum allowed score for substantive speeches"
    section = scoring
    name = 'score_max'
    default = 82.0

from django.utils.translation import ugettext_lazy as _

from dynamic_preferences.types import BooleanPreference, StringPreference, Section
from dynamic_preferences.registries import global_preferences_registry

# we create some section objects to link related preferences together

registration = Section('registration', _('Registration'))


@global_preferences_registry.register
class BanListEnabled(BooleanPreference):
    section = registration
    name = 'enableBanList'
    verbose_name = _('Enable Automated Enforcement of Ban List')
    help_text = _(
        'If this box is checked, then if an individual whose name or email ' +
        'address appears on the ban list will be prevented from registration '
        +
        'and asked to contact the school.  Their attempt to register will be logged.'
    )
    default = True


@global_preferences_registry.register
class BanListContactEmail(StringPreference):
    section = registration
    name = 'banListContactEmail'
    verbose_name = _(
        'Individuals who are prevented from registration are asked ' +
        'to contact this address.')
示例#20
0
'''
This file defines a variety of preferences that must be set in the DB,
but can be changed dynamically.
'''

from django.utils.translation import ugettext_lazy as _
from django.template.loader import get_template

from dynamic_preferences.types import BooleanPreference, IntegerPreference, ModelChoicePreference, Section
from dynamic_preferences.registries import global_preferences_registry

from danceschool.core.models import EventStaffCategory, EmailTemplate, get_defaultEmailName, get_defaultEmailFrom

# we create some section objects to link related preferences together

privateLessons = Section('privateLessons', _('Private Lessons'))


############################
# Private Lessons Preferences
#
@global_preferences_registry.register
class AllowPublicBooking(BooleanPreference):
    section = privateLessons
    name = 'allowPublicBooking'
    verbose_name = _('Allow non-staff to book private lessons for themselves.')
    help_text = _(
        'The private lesson booking functions will only be available to individuals with permissions unless this box is checked.'
    )
    default = True
示例#21
0
from django.utils.translation import ugettext_lazy as _
from dynamic_preferences.types import Section, BooleanPreference
from dynamic_preferences.users.registries import user_preferences_registry

content = Section("content")


@user_preferences_registry.register
class UseNewPublisher(BooleanPreference):
    section = content
    name = "use_new_publisher"
    default = False
    verbose_name = _("Use new publisher")
    help_text = _(
        "Set this to use the new alpha publisher when possible. "
        "Warning! Not all functionality is available in the new publisher.")
示例#22
0
from django.conf.global_settings import LANGUAGES
from django.utils.translation import gettext_lazy as _
from dynamic_preferences.types import (
    BooleanPreference, ChoicePreference, FilePreference, Section
)
from dynamic_preferences.registries import global_preferences_registry
from dynamic_preferences.users.registries import user_preferences_registry
from cbvadmin.preferences.registries import site_preferences_registry
from cbvadmin.dynamic_preferences_registry import features

branding = Section('branding', 'Branding')


@global_preferences_registry.register
class EnableUserRegistration(BooleanPreference):
    section = features
    name = 'enable_registration'
    verbose_name = _('Enable user registration')
    default = True


@user_preferences_registry.register
class Language(ChoicePreference):
    name = 'language'
    choices = LANGUAGES
    default = 'en'


@site_preferences_registry.register
class SiteLogo(FilePreference):
    section = branding
from dynamic_preferences.types import BooleanPreference, Section
from dynamic_preferences.registries import global_preferences_registry

general = Section('general', 'General Settings')


@global_preferences_registry.register
class EnableDiscounts(BooleanPreference):
    section = general
    name = 'discountsEnabled'
    verbose_name = 'Discounts and Add-ons enabled'
    help_text = 'Uncheck this to disable the application of all discounts'
    default = True
示例#24
0
from django.utils.translation import ugettext_lazy as _
from dynamic_preferences.types import Section, ChoicePreference, BooleanPreference
from dynamic_preferences.users.registries import user_preferences_registry

generic = Section("generic")
content = Section("content")


@user_preferences_registry.register
class LandingPage(ChoicePreference):
    """Which page should be shown as landing page?"""
    section = generic
    name = "landing_page"
    choices = [
        ("profile", _("Profile")),
        ("profile_all", _("Profile - all content")),
        ("followed", _("Followed stream")),
        ("local", _("Local stream")),
        ("public", _("Public stream")),
        ("tags", _("Tags stream")),
    ]
    default = "followed"
    verbose_name = _("Landing page")
    help_text = _("Choose which page you want to see as the landing page.")
示例#25
0
import pytz
from django.conf import settings
from dynamic_preferences.types import (ChoicePreference, Section,
                                       StringPreference)
from dynamic_preferences.registries import user_preferences_registry
from dynamic_preferences.registries import global_preferences_registry

glob = Section('global')
trax = Section('trax')


@global_preferences_registry.register
class SlashCommandToken(StringPreference):
    section = trax
    name = 'slash_command_token'
    description = "The token used to validate slash command payload"
    default = 'CHANGEME'


@global_preferences_registry.register
class WebHookUrl(StringPreference):
    section = trax
    name = 'webhook_url'
    description = "The webhook URL where trax can send messages"
    default = 'http://changeme'


@user_preferences_registry.register
class TimeZone(ChoicePreference):
    section = glob
    name = 'timezone'