Site admin + fin
This commit is contained in:
parent
a9b7a27df2
commit
15ca09d3ab
6 changed files with 31 additions and 3 deletions
BIN
admin.png
Normal file
BIN
admin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
Binary file not shown.
|
@ -1,3 +1,5 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
from .models import Article
|
||||
|
||||
admin.site.register(Article)
|
||||
|
|
Binary file not shown.
30
formation.md
30
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/<int:pk>`)
|
||||
- Créer l'url dédiée dans `blog/urls.py` (de la forme `article/<int:pk>`)
|
||||
- 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
|
||||
|
|
BIN
formation.pdf
BIN
formation.pdf
Binary file not shown.
Loading…
Reference in a new issue