示例#1
0
SIGNUP_VERIFY_EMAIL_NOTICE = getattr(settings, 'SITEGATE_SIGNUP_VERIFY_EMAIL_NOTICE', _('Congratulations! You\'re almost done with the registration. Please check your mailbox for a message containing an account activation link.'))

SIGNUP_VERIFY_EMAIL_TITLE = getattr(settings, 'SITEGATE_SIGNUP_VERIFY_EMAIL_TITLE', _('Account activation'))
SIGNUP_VERIFY_EMAIL_BODY = getattr(settings, 'SITEGATE_SIGNUP_VERIFY_EMAIL_BODY', _('Please follow the link below to activate your account:\n%(url)s'))

SIGNUP_VERIFY_EMAIL_SUCCESS_TEXT = getattr(settings, 'SITEGATE_SIGNUP_VERIFY_EMAIL_SUCCESS_TEXT', _('E-mail was successfully verified. You can now proceed to sign in.'))
SIGNUP_VERIFY_EMAIL_ERROR_TEXT = getattr(settings, 'SITEGATE_SIGNUP_VERIFY_EMAIL_ERROR_TEXT', _('Unable to verify an e-mail. User account was not activated.'))

SIGNUP_VERIFY_EMAIL_VIEW_NAME = getattr(settings, 'SITEGATE_SIGNUP_VERIFY_EMAIL_VIEW_NAME', 'verify_email')

try:
    from siteprefs.toolbox import patch_locals, register_prefs, pref, pref_group
    from django.db.models import CharField

    patch_locals()
    register_prefs(
        pref(SIGNIN_ENABLED, verbose_name=_('Signin enabled'), static=False),
        pref(SIGNIN_DISABLED_TEXT, verbose_name=_('Sign in disabled text'), help_text=_('This text is shown instead of a signin form when sign in in disabled.'), static=False),
        pref(SIGNUP_ENABLED, verbose_name=_('Signup enabled'), static=False),
        pref(SIGNUP_DISABLED_TEXT, verbose_name=_('Sign up disabled text'), help_text=_('This text is shown instead of a signup form when sign up in disabled.'), static=False),

        pref_group(_('E-mail verification'), (
            pref(SIGNUP_VERIFY_EMAIL_NOTICE, verbose_name=_('Verification notice'), help_text=_('Text shown to a user after a registration form is submitted.'), static=False),

            pref(SIGNUP_VERIFY_EMAIL_TITLE, verbose_name=_('Message title'), help_text=_('Title of an email message containing an account activation URL.'), static=False, field=CharField(max_length=160)),
            pref(SIGNUP_VERIFY_EMAIL_BODY, verbose_name=_('Message body'), help_text=_('<b>NOTE:</b> Message body must include `%(url)s` marker to indicate a place to put an activation URL at.'), static=False),

            pref(SIGNUP_VERIFY_EMAIL_SUCCESS_TEXT, verbose_name=_('Verification success notice'), help_text=_('A message shown to a user after he has followed an account activation URL if activation was a success.'), static=False),
            pref(SIGNUP_VERIFY_EMAIL_ERROR_TEXT, verbose_name=_('Verification error notice'), help_text=_('A message shown to a user after he has followed an account activation URL if there was an error during an activation process.'), static=False),
        ))
示例#2
0
# -*- coding: utf-8 -*-

from django.utils.translation import ugettext_lazy as _

from django.conf import settings
from django.db import models

MAX_LIST_SIZE = getattr(settings, 'LOGS_MAX_LIST_SIZE', 200)

if 'siteprefs' in settings.INSTALLED_APPS:
    # Respect those users who doesn't have siteprefs installed.
    from siteprefs.toolbox import patch_locals, register_prefs, pref

    patch_locals()  # That's bootstrap.

    register_prefs(
        pref(MAX_LIST_SIZE,
             verbose_name=_('Maximum number of logs shown to the user'),
             static=False,
             field=models.IntegerField(blank=True)), )
示例#3
0
    _('Unable to verify an e-mail. User account was not activated.'))

SIGNUP_VERIFY_EMAIL_USE_GENERIC_CONFIRMATION = getattr(
    settings, 'SIGNUP_VERIFY_EMAIL_USE_GENERIC_CONFIRMATION', False)
SIGNUP_VERIFY_EMAIL_VIEW_NAME = getattr(
    settings, 'SITEGATE_SIGNUP_VERIFY_EMAIL_VIEW_NAME',
    SIGNUP_VERIFY_EMAIL_USE_GENERIC_CONFIRMATION and 'generic_confirmation'
    or 'verify_email')
SIGNUP_VERIFY_EMAIL_GENERIC_VIEW_WHAT_ARG = getattr(
    settings, 'SIGNUP_VERIFY_EMAIL_GENERIC_VIEW_WHAT_ARG', 'email')

try:
    from siteprefs.toolbox import patch_locals, register_prefs, pref, pref_group
    from django.db.models import CharField

    patch_locals()
    register_prefs(
        pref(SIGNIN_ENABLED, verbose_name=_('Signin enabled'), static=False),
        pref(
            SIGNIN_DISABLED_TEXT,
            verbose_name=_('Sign in disabled text'),
            help_text=
            _('This text is shown instead of a signin form when sign in in disabled.'
              ),
            static=False),
        pref(SIGNUP_ENABLED, verbose_name=_('Signup enabled'), static=False),
        pref(
            SIGNUP_DISABLED_TEXT,
            verbose_name=_('Sign up disabled text'),
            help_text=
            _('This text is shown instead of a signup form when sign up in disabled.'
示例#4
0
# Get the plugin path in the sys.path
plugin_folder = PLUGIN_DIRECTORY
if not os.path.isabs(plugin_folder):
    plugin_folder = os.path.join(settings.BASE_DIR, plugin_folder)
if plugin_folder not in sys.path:
    sys.path.insert(0, plugin_folder)

# LOGS
# ------------------------------------------------------------------------------
MAX_LOG_LIST_SIZE = getattr(settings, 'LOGS_MAX_LIST_SIZE', 200)

# MISCELLANEOUS
# ------------------------------------------------------------------------------
HELP_URL = getattr(settings, 'ONTASK_HELP_URL', '')

patch_locals()  # That's for bootstrapping.

register_prefs(
    pref_group(
        _('Notification Emails'),
        (
            pref(
                NOTIFICATION_TEMPLATE,
                verbose_name=_('Template to send email notification'),
                static=False,
                field=models.TextField()),
            pref(
                NOTIFICATION_SUBJECT,
                verbose_name=_('Subject line for notification messages'),
                static=False,
                field=models.CharField(max_length=1024)),
示例#5
0
PLAN_PUPIL_TEACHER_SHORTCUT = getattr(settings, 'PLAN_PUPIL_TEACHER_SHORTCUT', False)
PLAN_PUPIL_SUBJECT_FULLNAME = getattr(settings, 'PLAN_PUPIL_SUBJECT_FULLNAME', False)
PLAN_PUPIL_SUBJECT_SHORTCUT = getattr(settings, 'PLAN_PUPIL_SUBJECT_SHORTCUT', False)

def get(name):
	if hasattr(name, 'get_value'):
		return getattr(name, 'get_value')()
	else:
		return name

# to allow to edit it online:
# To be sure our app is still functional without django-siteprefs
# we use this try-except block.
try:
	from siteprefs.toolbox import patch_locals, register_prefs, pref_group, pref
	patch_locals()  # This bootstrap is required before `register_prefs` step.

	# And that's how we expose our options to Admin.
	register_prefs(
		pref_group(
			_('Standin parser settings'), (
				PLAN_FILES_ENCODING, PLAN_PARSER_MODEL, PLAN_PARSER_REGEX_MOVED_TO, PLAN_PARSER_REGEX_MOVED_FROM
			),
			static=False
		),
		pref(
			PLAN_PUPIL_TEACHER_FULLNAME,
			field=BooleanField(),
			static=False,
			verbose_name=_('Show full name of teachers'),
			category=_('Standin pupil view')