Ejemplo n.º 1
0
    def ready(self):
        super().ready()
        register(check_data_writable)
        register(check_mail_connection, deploy=True)
        register(check_celery, deploy=True)
        register(check_database, deploy=True)
        register(check_cache, deploy=True)
        register(check_settings, deploy=True)
        register(check_templates, deploy=True)
        register(check_site, deploy=True)
        register(check_perms, deploy=True)
        register(check_errors, deploy=True)
        register(check_version)

        monkey_patch_translate()

        init_error_collection()

        engine = settings.DATABASES["default"]["ENGINE"]
        if engine == "django.db.backends.postgresql":
            CharField.register_lookup(SearchLookup)
            TextField.register_lookup(SearchLookup)
            CharField.register_lookup(PostgreSQLSubstringLookup)
            TextField.register_lookup(PostgreSQLSubstringLookup)
        elif engine == "django.db.backends.mysql":
            CharField.register_lookup(MySQLSearchLookup)
            TextField.register_lookup(MySQLSearchLookup)
            CharField.register_lookup(MySQLSubstringLookup)
            TextField.register_lookup(MySQLSubstringLookup)
        else:
            raise Exception("Unsupported database: {}".format(engine))
Ejemplo n.º 2
0
    def ready(self):
        super(UtilsConfig, self).ready()
        register(check_requirements)
        register(check_data_writable)
        register(check_mail_connection, deploy=True)
        register(check_celery, deploy=True)
        register(check_database, deploy=True)
        register(check_cache, deploy=True)
        register(check_settings, deploy=True)
        register(check_templates, deploy=True)
        register(check_site, deploy=True)
        register(check_perms, deploy=True)
        register(check_errors, deploy=True)
        register(check_python, deploy=True)

        monkey_patch_translate()
Ejemplo n.º 3
0
    def ready(self):
        super(UtilsConfig, self).ready()
        register(check_requirements)
        register(check_data_writable)
        register(check_mail_connection, deploy=True)
        register(check_fonts)
        register(check_celery, deploy=True)
        register(check_database, deploy=True)
        register(check_cache, deploy=True)
        register(check_settings, deploy=True)
        register(check_templates, deploy=True)
        register(check_site, deploy=True)
        register(check_perms, deploy=True)
        register(check_errors, deploy=True)
        register(check_python, deploy=True)

        monkey_patch_translate()
Ejemplo n.º 4
0
    def ready(self):
        super().ready()
        register(check_data_writable)
        register(check_mail_connection, deploy=True)
        register(check_celery, deploy=True)
        register(check_database, deploy=True)
        register(check_cache, deploy=True)
        register(check_settings, deploy=True)
        register(check_templates, deploy=True)
        register(check_site, deploy=True)
        register(check_perms, deploy=True)
        register(check_errors, deploy=True)
        register(check_version)

        monkey_patch_translate()

        init_error_collection()
Ejemplo n.º 5
0
        payment = Payment.objects.create(
            amount=subscription.get_amount(),
            # pylint: disable=no-member
            description="Weblate: {}".format(subscription.get_package_display()),
            recurring=subscription.get_repeat(),
            extra={"subscription": subscription.pk},
            customer=get_customer(request),
        )
    return redirect(payment.get_payment_url())


@login_required
def subscription_new(request):
    plan = request.GET.get("plan")
    if not Package.objects.filter(name=plan).exists():
        return redirect("support")
    subscription = Subscription(package=plan)
    with override("en"):
        payment = Payment.objects.create(
            amount=subscription.get_amount(),
            # pylint: disable=no-member
            description="Weblate: {}".format(subscription.get_package_display()),
            recurring=subscription.get_repeat(),
            extra={"subscription": plan, "service": request.GET.get("service")},
            customer=get_customer(request),
        )
    return redirect(payment.get_payment_url())


monkey_patch_translate()