From fd5bbcd5657605b44136538e60c79b2fa3ace212 Mon Sep 17 00:00:00 2001 From: Bryan Brancotte <bryan.brancotte@pasteur.fr> Date: Thu, 28 Mar 2019 13:27:51 +0100 Subject: [PATCH] Show Quick start in the md too --- README.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++- README.rst | 2 ++ 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4d80dd9..971451a 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,74 @@ A module handling basic fonctionnality needed in django project such as base.html using bootstrap, account settings, preferences management, ... -# Cheat sheet +# Quick start + +1. Add "basetheme_bootstrap" to your INSTALLED_APPS setting like this (while not forgetting `crispy_forms`) + +```python +INSTALLED_APPS = [ + ... + 'crispy_forms', + 'basetheme_bootstrap', +] +``` + +2. Add the context_processors:: + +```python +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + ... + 'basetheme_bootstrap.context_processors.processors', + ], + }, + }, +] +``` + +3. Adjust the configuration:: + + +```python +################################################################################ +# 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" +################################################################################ ``` + +3. Include the polls URLconf in your project urls.py like this:: + +```python +from django.urls import path, include + +path('', include('basetheme_bootstrap.urls')), +``` + +3. Run `python manage.py migrate` to create the UserPreferences model if you decided to have one. + +4. Make your templates extends base template from`basetheme_bootstrap`, or even better create your own base.html which extends the one from `basetheme_bootstrap`:: + +```html +{% extends "basetheme_bootstrap/base4.html" %} +``` + +# Cheat sheet + +```bash mkdir -p locale && python manage.py makemessages -l en -l fr --no-location && rm -rf ./locale ``` \ No newline at end of file diff --git a/README.rst b/README.rst index 636f87d..9d4095d 100644 --- a/README.rst +++ b/README.rst @@ -53,6 +53,8 @@ Quick start 3. Include the polls URLconf in your project urls.py like this:: + from django.urls import path, include + path('', include('basetheme_bootstrap.urls')), 3. Run `python manage.py migrate` to create the UserPreferences model if you decided to have one. -- GitLab