Beginning Blog – Django Web Development With Python 6
In this sixth Django web development with Python tutorial, we’re going to cover working with models in Django. Our plan is to add the final element of our website: a blog. So far, we’ve worked with views and a controller, but have not really done anything with models.
First off, what are models? Models contain “meta data” regarding your application’s data. Generally, these models are used to describe just the elements in your database, but they can be built up to be much more than just that.
Second, we know we want to make a blog. Is this blog a part of our “personal” website, or would it make more sense to be its own app? It could be a part of our personal app, but it really ought to be its own entirely. Plus, chances are, we’re going to want to incorporate a blog on other apps, so let’s make a new app: python manage.py startapp blog.
We just added a new app. What is the first thing we should do? Right, install it!
text-based tutorial and sample code: