Professional Documents
Culture Documents
Django Revisions
Django Revisions
mkdir proj
cd proj
pipenv install django==2.1
pipenv shell
django-admin startproject proj .
./manage.py runserver http://127.0.0.1:8000/
python manage.py startapp app
add the app to NSTALLED_APPS settings.py project level
URL -> View -> Model (typically) -> Template
edit the settings.py TEMPLATES = 'DIRS':[os.path.join(BASE_DIR, 'templates')]
TESTS
pour exiger qune action soit faite par un user connecte, LoginRequired mixin
django.contrib.auth.mixins (LoginRequiredMixin)
class ArticleCreateView(LoginRequiredMixin, CreateView)
... login_url='login' # automatiquemt redirige au login dabord.
pour Create, List, Detail, Delete, Update