Django project with personal organization tools
- Made model and set up fields for our model (models.py)
- Made a view that queries the model and renders the template from data in the model (view.py)
- Made a template that shows the data (index.html)
- Made a url that matches a path to the view. (url.py)
djorg - refers to overall project djorg/djorg/urls.py - inner djorg folder refers to the settings for this project
- ./manage.py shell: django and python shell automatically has all django stuff available to it, like import models to database, django stuff
- from bookmarks.model import Bookmark: import bookmark model
- dir(Bookmark): view object
- Bookmarks.objects.all(): query set to return all bookmarks
- len(Bookmark.object.count(): return count of all bookmarks
- dir(Bookmark.objects): view
- ./manage.py shell
- from bookmark.models import Bookmark
- bookmark = Bookmark(name="Lambda School", url="https://lambdaschool.com") - instantiate
- bookmark.save() - can view using Bookmarks.objects.all(), returns which is an iterable, so not quite a python list but almost like it