Daily Reading 27
Django Models
###
Explain the purpose and basic structure of Django models. How do they help in creating and managing database schema in a Django application?
A django model, much like a model in other contexts, defines how a data storage system is structured. In broad strokes, an example could be something like “what key value pairs exist in this spread sheet? what are they called? what are the character limits? What data types do they allow?” The model however, is divorced from the database itself, and django handles updating or modifying the database, based on your actions in the context of the rules established by the model.
Describe the primary features and functionality of the Django Admin interface. How can it be customized to suit the specific needs of a project?
The admin interface for django will let you create and test models, practice data entry into those models, do direct non-test modifications of data, and other administrative tasks relating to database handling, that are either too sensitive or needlessly verbose to a casual, non-administrative user. The admin interface in short allows you full read and write access to all models and database structures you have.
Briefly outline the key components and workflow of a Django application, as discussed in the Beginner’s Guide to Django. How do these components interact with each other to create a functional web application?
Views: Receives httprequest objects, and depending on the data within, returns an httpresponse object in turn.
urls.py: A manifest of the subpages belonging to your website. you have a home directory by default, but do you have a example.com/about page? how about example.com/store? the urls.py will list all of them.
settings.py: All of your installed apps, configurations for your project, your secret key, the toggle for debug are all located here.
models.py: A list of your data format models, which django automatically parses and converts into database tables. What statistics are you saving? what format of data is the user allowed to modify, and where? how many “sockets” are there?