Skip to content
Snippets Groups Projects
Select Git revision
  • v0.2.60
  • master default protected
  • exponential-backoff-login
  • v1.9.2
  • v1.9.0
  • v1.8.8
  • v1.8.7
  • v1.8.5
  • v1.8.4
  • v1.8.2
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0.1
  • v1.0
  • v0.2.80
  • v0.2.79
  • v0.2.78
23 results

django-basetheme-bootstrap

  • Clone with SSH
  • Clone with HTTPS
  • pipeline status coverage report

    django-basetheme-bootstrap

    A module handling basic fonctionnality needed in django project such as base.html using bootstrap, account settings, preferences management, ...

    Quick start

    1. Add "basetheme_bootstrap" to your INSTALLED_APPS setting like this (while not forgetting crispy_forms). Note that basetheme_bootstrap have to be before django.contrib.admin to override the default template for password reset.
    INSTALLED_APPS = [
        ...
        'crispy_forms',
        'basetheme_bootstrap',
        ...
        'django.contrib.admin',
    ]
    1. Add the context_processors::
    TEMPLATES = [
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'DIRS': [],
            'APP_DIRS': True,
            'OPTIONS': {
                'context_processors': [
                    ...
                    'basetheme_bootstrap.context_processors.processors',
                ],
            },
        },
    ]
    1. Adjust the configuration::
    ################################################################################
    # django-crispy-forms
    ################################################################################
    CRISPY_TEMPLATE_PACK = 'bootstrap4'
    
    ################################################################################
    # basetheme_bootstrap
    ################################################################################
    BASETHEME_BOOTSTRAP_TEMPLATE_LOCATION_PROJECT = "test_app_1"
    BASETHEME_BOOTSTRAP_USER_PREFERENCE_MODEL_ENABLED = True
    BASETHEME_BOOTSTRAP_USER_PREFERENCE_MODEL_LOCATION_APP = "test_app_1"
    BASETHEME_BOOTSTRAP_USER_PREFERENCE_MODEL_NAME = "MyUserPreferences"
    BASETHEME_BOOTSTRAP_USERNAME_IS_EMAIL = False
    BASETHEME_BOOTSTRAP_FIRST_LAST_NAME_REQUIRED = False
    BASETHEME_BOOTSTRAP_VALIDATE_EMAIL_BEFORE_ACTIVATION = False
    
    ################################################################################
    1. Include the polls URLconf in your project urls.py like this::
    from django.urls import path, include
    
    path('', include('basetheme_bootstrap.urls')),
    1. Run python manage.py migrate to create the UserPreferences model if you decided to have one.

    2. Make your templates extends base template frombasetheme_bootstrap, or even better create your own base.html which extends the one from basetheme_bootstrap::

    {% extends "basetheme_bootstrap/base4.html" %}

    Cheat sheet

    mkdir -p locale && python manage.py makemessages -l en -l fr --no-location && rm -rf ./locale