monim67/django-bootstrap-datepicker-plus

View on GitHub
dev/mysite/settings.py

Summary

Maintainability
A
0 mins
Test Coverage
"""Django settings for mysite project.

Generated by 'django-admin startproject' using Django 2.1.

For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""

import os
import sys

import django_stubs_ext

django_stubs_ext.monkeypatch()

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", ".."))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "w5&=-n_fl2*ncll8*k31)+s@4x4@cg+0o0p28%zcw2l$1_1$gx"

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ["localhost"]

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"

# Application definition

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "bootstrap3",
    "bootstrap4",
    "django_bootstrap5",
    "crispy_forms",
    "crispy_bootstrap5",
    "django_filters",
    "bootstrap_modal_forms",
    "bootstrap_datepicker_plus",
    "dev.myapp.apps.MyappConfig",
]

MIDDLEWARE = [
    "django.middleware.security.SecurityMiddleware",
    "django.contrib.sessions.middleware.SessionMiddleware",
    "django.middleware.common.CommonMiddleware",
    "django.middleware.csrf.CsrfViewMiddleware",
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "django.contrib.messages.middleware.MessageMiddleware",
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = "dev.mysite.urls"

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
                "dev.mysite.context_processors.site_context",
            ],
        },
    },
]

WSGI_APPLICATION = "dev.mysite.wsgi.application"


# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": os.path.join(BASE_DIR, "db.sqlite3"),
    }
}


# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
    },
    {
        "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
    },
    {
        "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
    },
    {
        "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
    },
]


# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/

LANGUAGE_CODE = "en-us"

TIME_ZONE = "UTC"

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/

STATIC_URL = "/static/"

CRISPY_ALLOWED_TEMPLATE_PACKS = ("bootstrap3", "bootstrap4", "bootstrap5")

BOOTSTRAP_DATEPICKER_PLUS = {
    # Options for all input widgets
    # More options: https://getdatepicker.com/4/Options/
    "options": {
        # "locale": "bn",
        "showClose": True,
        "showClear": True,
        "showTodayButton": True,
        "allowInputToggle": True,
    },
    # You can set date and event hook options using JavaScript, usage in README.
    # You can also set options for specific variant widgets only which overrides above options.
    "variant_options": {
        # "date": {
        #     "format": "MM/DD/YYYY",
        # },
        # "datetime": {
        #     "format": "MM/DD/YYYY HH:mm",
        # },
        "month": {
            "format": "MMMM, YYYY",
        },
    },
    #
    # HTML attributes for widget <input> element
    # "attrs": {
    #     "class": "input",
    # },
    #
    # Override input addon icon classes
    "addon_icon_classes": {
        "month": "bi-calendar-month",
    },
    #
    # HTML template to render the html input
    # example: https://github.com/monim67/django-bootstrap-datepicker-plus/blob/5.0.0/dev/myapp/templates/myapp/custom-input.html
    #
    # "template_name": "your-app/custom-input.html",
    #
    # Advanced: Choose where from static JS/CSS files are served.
    # defaults: https://github.com/monim67/django-bootstrap-datepicker-plus/blob/5.0.0/src/bootstrap_datepicker_plus/settings.py#L16
    # To serve from any other preferred CDN, just update the options below.
    # You can also set them to None if you already have the following resources
    # included into your template.
    #
    # "datetimepicker_js_url": "https://..",
    # "datetimepicker_css_url": "https://..",
    # "momentjs_url": None,  # If you already have momentjs added into your template
    # "bootstrap_icon_css_url": None,  # If you don't need bootstrap icons
    #
    # If you want to serve static files yourself without CDN (from staticfiles) and
    # you know how to serve django static files on production server (DEBUG=False)
    # Then download the js/css files to any of your static directory, update the js/css
    # urls above and set the following option
    #
    # "app_static_url": "bootstrap_datepicker_plus/",
}