DJANGO
Code an admin back-end in Django
Continuing with our magazine cataloguing application, Matt Holder explains how to create admin controls and basic view functions.
Credit: www.djangoproject.com
OUR EXPERT
Matt Holder
has been a fan of the open source methodology for over two decades and uses Linux and other tools where possible.
More featurepacked source code for this project can be downloaded from https:// github.com/ mattmole/LXF-Django-Project.
L ast issue we began a project to catalogue magazine articles, which makes it a lot easier to search for interesting topics, rather than hunting through a pile of magazines. During the tutorial, we introduced Django, which is a Python web framework, and designed our first models, which are how the data is stored in the database, including relationships between different database tables.
Django uses an object-relational mapper (ORM) to interact with the underlying SQL database, allowing for data to be interacted with as Pythonic objects, and this was also introduced. We also introduced Model-View-Controller (MVC) concepts, which are used to provide clear separation between the storage of data, processing of this data and how it is displayed or interacted with by the user. Finally, we introduced the shell, which is a way to interact with information stored in the database, without needing to add the test code into the project structure.
Before beginning, copy the models from models.py from GitHub (see Quick Tip bottom-left) and then run python ../manage.py makemigrations and python manage.py migrate .