diff --git a/admin.png b/admin.png new file mode 100644 index 0000000..ab34218 Binary files /dev/null and b/admin.png differ diff --git a/exemple/mon_site/blog/__pycache__/admin.cpython-36.pyc b/exemple/mon_site/blog/__pycache__/admin.cpython-36.pyc index 6955d48..f36a235 100644 Binary files a/exemple/mon_site/blog/__pycache__/admin.cpython-36.pyc and b/exemple/mon_site/blog/__pycache__/admin.cpython-36.pyc differ diff --git a/exemple/mon_site/blog/admin.py b/exemple/mon_site/blog/admin.py index 8c38f3f..2234d17 100644 --- a/exemple/mon_site/blog/admin.py +++ b/exemple/mon_site/blog/admin.py @@ -1,3 +1,5 @@ from django.contrib import admin -# Register your models here. +from .models import Article + +admin.site.register(Article) diff --git a/exemple/mon_site/db.sqlite3 b/exemple/mon_site/db.sqlite3 index 8b405c0..7d96bcc 100644 Binary files a/exemple/mon_site/db.sqlite3 and b/exemple/mon_site/db.sqlite3 differ diff --git a/formation.md b/formation.md index e8e4e1a..a33c8fc 100644 --- a/formation.md +++ b/formation.md @@ -452,7 +452,7 @@ Objectif : - Créer la vue dédiée (`def view_article(request, pk):`) - La remplir (conseil regarder `django.shortcuts.get_object_or_404`) -- Créer l'url dédiée dans `blog/urls.py` (elle sera de la forme `article/`) +- Créer l'url dédiée dans `blog/urls.py` (de la forme `article/`) - Créer le template associé (dans `blog/templates/blog/view_article.html`) --- @@ -560,10 +560,36 @@ Dans `templates/base.html` : # Site admin +Enregistrer son modèle (dans `blog/admin.py`) : +```python +from django.contrib import admin + +from .models import Article + +admin.site.register(Article) +``` +Créer un superuser : +```bash +./manage.py createsuperuser +``` + +→ On peut éditer ses modèles ! rdv [http://127.0.0.1:8000/admin](http://127.0.0.1:8000/admin) + --- -# Forms +![](admin.png) + +--- +# Quoi faire maintenant ? +- Formulaires +- Gestion des utilisateurs +- Les fichiers statiques (css) +- Le déploiement en production +- Les test unitaires :angel: +- ... + +# >> docs.djangoproject.com << --- # Sites intéressants diff --git a/formation.pdf b/formation.pdf index d40058c..6d4a9b1 100644 Binary files a/formation.pdf and b/formation.pdf differ