当前位置: 首页>>代码示例>>Python>>正文


Python settings.PLATFORM_NAME属性代码示例

本文整理汇总了Python中django.conf.settings.PLATFORM_NAME属性的典型用法代码示例。如果您正苦于以下问题:Python settings.PLATFORM_NAME属性的具体用法?Python settings.PLATFORM_NAME怎么用?Python settings.PLATFORM_NAME使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在django.conf.settings的用法示例。


在下文中一共展示了settings.PLATFORM_NAME属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_pending_enrollment_message

# 需要导入模块: from django.conf import settings [as 别名]
# 或者: from django.conf.settings import PLATFORM_NAME [as 别名]
def get_pending_enrollment_message(cls, pending_users, enrolled_in):
        """
        Create message for the users who were enrolled in a course.

        Args:
            users: An iterable of PendingEnterpriseCustomerUsers who were successfully linked with a pending enrollment
            enrolled_in (str): A string identifier for the course the pending users were linked to

        Returns:
            tuple: A 2-tuple containing a message type and message text
        """
        pending_emails = [pending_user.user_email for pending_user in pending_users]
        return (
            'warning',
            _(
                "The following learners do not have an account on "
                "{platform_name}. They have not been enrolled in "
                "{enrolled_in}. When these learners create an account, they will "
                "be enrolled automatically: {pending_email_list}"
            ).format(
                platform_name=settings.PLATFORM_NAME,
                enrolled_in=enrolled_in,
                pending_email_list=', '.join(pending_emails),
            )
        ) 
开发者ID:edx,项目名称:edx-enterprise,代码行数:27,代码来源:views.py

示例2: test_send_email_for_reviewed

# 需要导入模块: from django.conf import settings [as 别名]
# 或者: from django.conf.settings import PLATFORM_NAME [as 别名]
def test_send_email_for_reviewed(self):
        """
        Verify that send_email_for_reviewed's happy path works as expected
        """
        self.assertEmailSent(
            emails.send_email_for_reviewed,
            '^Review complete: {}$'.format(self.course_run.title),
            [self.editor, self.editor2],
            both_regexes=[
                'Dear course team,',
                'The course run about page is now published.',
                'Note: This email address is unable to receive replies.',
            ],
            html_regexes=[
                'The <a href="%s">%s course run</a> of %s has been reviewed and approved by %s.' %
                (self.publisher_url, self.run_num, self.course_run.title, settings.PLATFORM_NAME),
                'For questions or comments, please contact '
                '<a href="mailto:pc@example.com">your Project Coordinator</a>.',
            ],
            text_regexes=[
                'The %s course run of %s has been reviewed and approved by %s.' %
                (self.run_num, self.course_run.title, settings.PLATFORM_NAME),
                '\n\nView the course run in Publisher: %s\n' % self.publisher_url,
                'For questions or comments, please contact your Project Coordinator at pc@example.com.',
            ],
        ) 
开发者ID:edx,项目名称:course-discovery,代码行数:28,代码来源:test_emails.py

示例3: core

# 需要导入模块: from django.conf import settings [as 别名]
# 或者: from django.conf.settings import PLATFORM_NAME [as 别名]
def core(_request):
    """ Site-wide context processor. """
    return {
        'platform_name': settings.PLATFORM_NAME,
        'language_bidi': get_language_bidi()
    } 
开发者ID:edx,项目名称:course-discovery,代码行数:8,代码来源:context_processors.py

示例4: login_page

# 需要导入模块: from django.conf import settings [as 别名]
# 或者: from django.conf.settings import PLATFORM_NAME [as 别名]
def login_page(request):
    """
    Display the login form.
    """
    csrf_token = csrf(request)['csrf_token']
    if (settings.FEATURES['AUTH_USE_CERTIFICATES'] and
            ssl_get_cert_from_request(request)):
        # SSL login doesn't require a login view, so redirect
        # to course now that the user is authenticated via
        # the decorator.
        next_url = request.GET.get('next')
        if next_url:
            return redirect(next_url)
        else:
            return redirect('/course/')
    if settings.FEATURES.get('AUTH_USE_CAS'):
        # If CAS is enabled, redirect auth handling to there
        return redirect(reverse('cas-login'))

    return render_to_response(
        'login.html',
        {
            'csrf': csrf_token,
            'forgot_password_link': "//{base}/login#forgot-password-modal".format(base=settings.LMS_BASE),
            'platform_name': microsite.get_value('platform_name', settings.PLATFORM_NAME),
        }
    ) 
开发者ID:jruiperezv,项目名称:ANALYSE,代码行数:29,代码来源:public.py

示例5: common

# 需要导入模块: from django.conf import settings [as 别名]
# 或者: from django.conf.settings import PLATFORM_NAME [as 别名]
def common(_request):
    return {
        'support_email': settings.SUPPORT_EMAIL,
        'full_application_name': settings.FULL_APPLICATION_NAME,
        'platform_name': settings.PLATFORM_NAME,
        'application_name': settings.APPLICATION_NAME,
        'footer_links': settings.FOOTER_LINKS,
    } 
开发者ID:edx,项目名称:edx-analytics-dashboard,代码行数:10,代码来源:context_processors.py

示例6: test_get_program_enrollment_page_no_price_info_found_message

# 需要导入模块: from django.conf import settings [as 别名]
# 或者: from django.conf.settings import PLATFORM_NAME [as 别名]
def test_get_program_enrollment_page_no_price_info_found_message(
            self,
            program_data_extender_mock,
            course_catalog_api_client_mock,
            embargo_api_mock,
            *args
    ):  # pylint: disable=unused-argument,invalid-name
        """
        The message about no price information found is rendered if the program extender fails to get price info.
        """
        self._setup_embargo_api(embargo_api_mock)
        program_data_extender_mock = self._setup_program_data_extender(program_data_extender_mock)
        program_data_extender_mock.return_value.extend.return_value['discount_data'] = {}
        setup_course_catalog_api_client_mock(course_catalog_api_client_mock)
        enterprise_customer = EnterpriseCustomerFactory(name='Starfleet Academy')
        program_enrollment_page_url = reverse(
            'enterprise_program_enrollment_page',
            args=[enterprise_customer.uuid, self.dummy_program_uuid],
        )

        self._login()
        response = self.client.get(program_enrollment_page_url)
        messages = self._get_messages_from_response_cookies(response)
        assert messages
        self._assert_request_message(
            messages[0],
            'warning',
            (
                '<strong>We could not gather price information for <em>Program Title 1</em>.</strong> '
                '<span>If you continue to have these issues, please contact '
                '<a href="{enterprise_support_link}" target="_blank">{platform_name} support</a>.</span>'
            ).format(
                enterprise_support_link=settings.ENTERPRISE_SUPPORT_URL,
                platform_name=settings.PLATFORM_NAME,
            )
        ) 
开发者ID:edx,项目名称:edx-enterprise,代码行数:38,代码来源:test_program_enrollment_view.py

示例7: get_global_context

# 需要导入模块: from django.conf import settings [as 别名]
# 或者: from django.conf.settings import PLATFORM_NAME [as 别名]
def get_global_context(request, enterprise_customer=None):
    """
    Get the set of variables that are needed by default across views.
    """
    platform_name = get_configuration_value("PLATFORM_NAME", settings.PLATFORM_NAME)
    # pylint: disable=no-member
    context = {
        'enterprise_customer': enterprise_customer,
        'LMS_SEGMENT_KEY': settings.LMS_SEGMENT_KEY,
        'LANGUAGE_CODE': get_language_from_request(request),
        'tagline': get_configuration_value("ENTERPRISE_TAGLINE", settings.ENTERPRISE_TAGLINE),
        'platform_description': get_configuration_value(
            "PLATFORM_DESCRIPTION",
            settings.PLATFORM_DESCRIPTION,
        ),
        'LMS_ROOT_URL': settings.LMS_ROOT_URL,
        'platform_name': platform_name,
        'header_logo_alt_text': _('{platform_name} home page').format(platform_name=platform_name),
        'welcome_text': constants.WELCOME_TEXT.format(platform_name=platform_name),
    }

    if enterprise_customer is not None:
        context.update({
            'enterprise_welcome_text': constants.ENTERPRISE_WELCOME_TEXT.format(
                enterprise_customer_name=enterprise_customer.name,
                platform_name=platform_name,
                strong_start='<strong>',
                strong_end='</strong>',
                line_break='<br/>',
                privacy_policy_link_start="<a href='{pp_url}' target='_blank'>".format(
                    pp_url=get_configuration_value('PRIVACY', 'https://www.edx.org/edx-privacy-policy', type='url'),
                ),
                privacy_policy_link_end="</a>",
            ),
        })

    return context 
开发者ID:edx,项目名称:edx-enterprise,代码行数:39,代码来源:views.py

示例8: add_consent_declined_message

# 需要导入模块: from django.conf import settings [as 别名]
# 或者: from django.conf.settings import PLATFORM_NAME [as 别名]
def add_consent_declined_message(request, enterprise_customer, item):
    """
    Add a message to the Django messages store indicating that the user has declined data sharing consent.

    Arguments:
        request (HttpRequest): The current request.
        enterprise_customer (EnterpriseCustomer): The EnterpriseCustomer associated with this request.
        item (str): A string containing information about the item for which consent was declined.
    """
    messages.warning(
        request,
        _(
            '{strong_start}We could not enroll you in {em_start}{item}{em_end}.{strong_end} '
            '{span_start}If you have questions or concerns about sharing your data, please contact your learning '
            'manager at {enterprise_customer_name}, or contact {link_start}{platform_name} support{link_end}.{span_end}'
        ).format(
            item=item,
            em_start='<em>',
            em_end='</em>',
            enterprise_customer_name=enterprise_customer.name,
            link_start='<a href="{support_link}" target="_blank">'.format(
                support_link=get_configuration_value('ENTERPRISE_SUPPORT_URL', settings.ENTERPRISE_SUPPORT_URL),
            ),
            platform_name=get_configuration_value('PLATFORM_NAME', settings.PLATFORM_NAME),
            link_end='</a>',
            span_start='<span>',
            span_end='</span>',
            strong_start='<strong>',
            strong_end='</strong>',
        )
    ) 
开发者ID:edx,项目名称:edx-enterprise,代码行数:33,代码来源:messages.py

示例9: start_exam_callback

# 需要导入模块: from django.conf import settings [as 别名]
# 或者: from django.conf.settings import PLATFORM_NAME [as 别名]
def start_exam_callback(request, attempt_code):  # pylint: disable=unused-argument
    """
    A callback endpoint which is called when SoftwareSecure completes
    the proctoring setup and the exam should be started.

    This is an authenticated endpoint and the attempt_code is passed in
    as part of the URL path

    IMPORTANT: This is an unauthenticated endpoint, so be VERY CAREFUL about extending
    this endpoint
    """
    attempt = get_exam_attempt_by_code(attempt_code)
    if not attempt:
        log.warning(u"Attempt code %r cannot be found.", attempt_code)
        return HttpResponse(
            content='You have entered an exam code that is not valid.',
            status=404
        )
    proctored_exam_id = attempt['proctored_exam']['id']
    attempt_status = attempt['status']
    user_id = attempt['user']['id']
    if attempt_status in [ProctoredExamStudentAttemptStatus.created,
                          ProctoredExamStudentAttemptStatus.download_software_clicked]:
        mark_exam_attempt_as_ready(proctored_exam_id, user_id)

    # if a user attempts to re-enter an exam that has not yet been submitted, submit the exam
    if ProctoredExamStudentAttemptStatus.is_in_progress_status(attempt_status):
        update_attempt_status(proctored_exam_id, user_id, ProctoredExamStudentAttemptStatus.submitted)
    else:
        log.warning(u"Attempted to enter proctored exam attempt {attempt_id} when status was {attempt_status}"
                    .format(
                        attempt_id=attempt['id'],
                        attempt_status=attempt_status,
                    ))

    if switch_is_active(RPNOWV4_WAFFLE_NAME):  # pylint: disable=illegal-waffle-usage
        course_id = attempt['proctored_exam']['course_id']
        content_id = attempt['proctored_exam']['content_id']

        exam_url = ''
        try:
            exam_url = reverse('jump_to', args=[course_id, content_id])
        except NoReverseMatch:
            log.exception(u"BLOCKING ERROR: Can't find course info url for course %s", course_id)
        response = HttpResponseRedirect(exam_url)
        response.set_signed_cookie('exam', attempt['attempt_code'])
        return response

    template = loader.get_template('proctored_exam/proctoring_launch_callback.html')

    return HttpResponse(
        template.render({
            'platform_name': settings.PLATFORM_NAME,
            'link_urls': settings.PROCTORING_SETTINGS.get('LINK_URLS', {})
        })
    ) 
开发者ID:edx,项目名称:edx-proctoring,代码行数:58,代码来源:callbacks.py

示例10: test_get_program_enrollment_page_consent_message

# 需要导入模块: from django.conf import settings [as 别名]
# 或者: from django.conf.settings import PLATFORM_NAME [as 别名]
def test_get_program_enrollment_page_consent_message(
            self,
            consent_granted,
            program_data_extender_mock,
            course_catalog_api_client_mock,
            embargo_api_mock,
            *args
    ):  # pylint: disable=unused-argument,invalid-name
        """
        The DSC-declined message is rendered if DSC is not given.
        """
        self._setup_embargo_api(embargo_api_mock)
        self._setup_program_data_extender(program_data_extender_mock)
        setup_course_catalog_api_client_mock(course_catalog_api_client_mock)
        enterprise_customer = EnterpriseCustomerFactory(name='Starfleet Academy')
        enterprise_customer_user = EnterpriseCustomerUserFactory(
            enterprise_customer=enterprise_customer,
            user_id=self.user.id
        )
        for dummy_course_id in self.demo_course_ids:
            DataSharingConsentFactory(
                course_id=dummy_course_id,
                granted=consent_granted,
                enterprise_customer=enterprise_customer,
                username=enterprise_customer_user.username,
            )
        program_enrollment_page_url = reverse(
            'enterprise_program_enrollment_page',
            args=[enterprise_customer.uuid, self.dummy_program_uuid],
        )

        self._login()
        response = self.client.get(program_enrollment_page_url)
        messages = self._get_messages_from_response_cookies(response)
        if consent_granted:
            assert not messages
        else:
            assert messages
            self._assert_request_message(
                messages[0],
                'warning',
                (
                    '<strong>We could not enroll you in <em>Program Title 1</em>.</strong> '
                    '<span>If you have questions or concerns about sharing your data, please '
                    'contact your learning manager at Starfleet Academy, or contact '
                    '<a href="{enterprise_support_link}" target="_blank">{platform_name} support</a>.</span>'
                ).format(
                    enterprise_support_link=settings.ENTERPRISE_SUPPORT_URL,
                    platform_name=settings.PLATFORM_NAME,
                )
            ) 
开发者ID:edx,项目名称:edx-enterprise,代码行数:53,代码来源:test_program_enrollment_view.py


注:本文中的django.conf.settings.PLATFORM_NAME属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。