- Django-admin startproject todo (inter to todo folder)
- Python manage.py migrate
- Python manage.py createsuperuser
- Register superuser
- Python manage.py runserver
- 127.0.0.1:8000/admin -> log in
- Python Manage.py startapp tasks
- Add 'tasks' in settings.py in todo
- Add this in view.py in tasks
- Add templates in tasks
- add this in list.html
<h3>To Do</h3>
- To return an actual template in view.py change return next to
- Create a model called task
- >>python manage.py makemigrations
- >>python manage.py migrate
- Register admin.py in tasks
- Check 127.0.0.1:8000/admin
- Create post : Add Task --> title: pick mike --> save
- Render this these out in the template
- Add this in list.html
- Add this in urls.py in todo to connect between todo and tasks
- Create forms.py in tasks
It's gonna create all the Form fields for us and it's very easy to import it
into our template
- Add this one in forms.py
- Add this in views to import forms
- Add this in list.html
- Add this in view.py
- Create update_task.html
- Add this in update_task.html
- add UpdateTask in view.py
- Add this in urls.py in tasks
- Add this in list.html
- Add this in views.py in tasks
- Add this in update_task.html
+ add in form
- Add this in views.py in tasks
- grab a POST and redirect
- Create delete.html
- Create new function in views.py in tasks
- Add new path in urls.py in tasks
- Add new url route to delete in list.html
- Add this in delete.html
- Add this in views.py in tasks
- Add this in list.html
- Add css code above html in list.html
<style> |
|
|
body{ |
|
background-color: #638CB8; |
|
} |
|
input{ |
|
width: 100%; |
|
padding: 12px 20px; |
|
margin: 8px 0; |
|
box-sizing: border-box; |
|
} |
|
input::placeholder { |
|
color: #d3d3d3; |
|
} |
|
.submit{ |
|
background-color: #6BA3E8; |
|
} |
|
.center-column{ |
|
width:600px; |
|
margin: 20px auto; |
|
padding:20px; |
|
background-color: #fff; |
|
border-radius: 3px; |
|
box-shadow: 6px 2px 30px 0px rgba(0,0,0,0.75); |
|
} |
|
.item-row{ |
|
background-color: #906abd; |
|
margin: 10px; |
|
padding: 20px; |
|
border-radius: 3px; |
|
color: #fff; |
|
font-size: 16px; |
|
box-shadow: 0px -1px 10px -4px rgba(0,0,0,0.75); |
|
} |
|
.btn-danger{ |
|
background-color: #ffae19; |
|
border-color: #e59400; |
|
} |
|
</style> |
- Add this code in list.html to decorate with css
- Add this in form.py
'Back-end > Django' 카테고리의 다른 글
Django Blog 만들기 - part 3 : 템플릿 (0) | 2020.08.21 |
---|---|
Django Blog 만들기 - part 2 : 어플리케이션과 라우트 (0) | 2020.08.20 |
Django Blog 만들기 - part 1 : 시작하기 (0) | 2020.08.20 |
포트폴리오 웹사이트 만들기 with Django (0) | 2020.08.18 |
Django REST framework 기본 익히기 (0) | 2020.08.18 |