U bekijkt momenteel de Netherlands versie van de site.
Wilt u overschakelen naar uw lokale site?
12 MIN LEESTIJD

Code a cataloguing application in Python

Strap in kids! Using Python and the Django framework, Matt Holder can help you create a web-based cataloguing application.

DJANGO

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.

QUICK TIP

More featurepacked source code for this project can be downloaded from https://github.com/mattmole/LXF-Django-Project

Part One!

Don’t miss next issue, subscribe on page 16!

We’re going to start the process of creating an application that can be used to catalogue and search magazine articles, with the idea that once filled in, you won’t need to rifle through that massive pile of old issues to find a particular article. Consideration will be made to the fact that a publisher can have multiple magazines assigned, articles can appear in multiple magazines and that a magazine can have multiple issues.

The technology we are using to accomplish this is called Django. This is a library for the Python programming language, which allows web applications to be created. Similar to Python itself, Django comes with ‘batteries included’ and has some of the features we require built-in with its provided admin interface.

Django operates using the Model-View-Controller (MVC) paradigm, which means that the program is split into these three areas. Model refers to the data and how it is stored in a database. Django supports a wide range of databases, but for our purposes, a simple SQlite database suffices. Database access is via a database ORM (object-relational mapping), which means that Django provides Python objects to interact with the database and doesn’t require SQL statements to be used directly. The second part of MVC is View. This means how the application displays the information stored in the database and how it is interacted with. Finally, Controller refers to the logic that ties together how the database stores the data (Model) and how it is displayed (View).

The ORM used by Django provides methods that can be used to follow the relationships defined by our model. For example, we could use a method to display all articles where a certain tag is defined or display all magazines registered to a publisher.

Ontgrendel dit artikel en nog veel meer met
Je kunt genieten:
Geniet volledig van deze editie
Direct toegang tot 600+ titels
Duizenden oude edities
Geen contract of verplichting
ABONNEER NU
30 dagen proberen, dan gewoon €11,99 / maand. Op elk moment opzeggen. Alleen nieuwe abonnees.


Meer informatie
Pocketmags Plus
Pocketmags Plus

Dit artikel komt uit...


View Issues
Linux Format
December 2022
IN DE WINKEL BEKIJKEN

Andere artikelen in dit nummer


WELCOME
Keeping it personal
What do you do when the developer of
REGULARS AT A GLANCE
Copilot challenged over fair use stance
Microsoft’s Copilot raids open source code for its AI.
Who pays for H.264?
Confusion over the H.264 patents causes distros to drop support.
Ad-blocking to get harder
Chrome’s shift to Manifest V3 extensions looms.
SERVER SECURITY
Keith Edmunds is MD of Tiger Computing, which
WESTON FRONT
Marius Vlad is a senior software engineer at
Say hello to Ubuntu Pro
Canonical spins a Pro version out of its Advantage support.
Ancient history slows AMD
Twenty-year-old sticking plaster proves a hindrance.
Blender to get Wayland added in 3.4
Native support to be added in 3.4.
Distro watch
What’s behind the free software sofa?
END OF THE LINE!
Donnie Berkholz is senior vice president, product, at
BYE, 486!
Jon Masters is a kernel hacker who’s been
Kernel Watch
Jon Masters keeps an eye out for all the latest happenings in the Linux kernel, so you don’t have to.
Answers
Got a burning question about open source or the kernel? Whatever your level, email it to answers@linuxformat.com
Mailserver
WRITE TO US Do you have a burning
Automatically provision devices with Ansible
Embrace laziness with Matthew Holder and auto-configure your systems by installing packages and adding files with Ansible.
HotPicks
THE BEST NEW OPEN SOURCE SOFTWARE ON THE PLANET
ESCAPE WINDOWS
Don’t get trapped by security modules, hardware and memory demands, or privacy concerns – we have the escape route: Linux!
LINUX FORMAT
The #1 open source mag
REVIEWS
Intel Arc A750
Intel’s affordable Arc GPU is pretty competitive, thinks Jacob Ridley.
Ubuntu 22.10
Michael Reed examines the latest Ubuntu release and finds that it’s a solid offering but unlikely to get your heart racing.
Crux 3.7
Michael Reed examines a Linux distro that caters for experts as well as intermediate users who want to improve their Linux skills.
The Excavation of Hob’s Barrow
The Management loves digging up dirt, especially on Ian Evenden.
Raspberry Pi OS 09.22
Les Pounder explores the latest Raspberry Pi OS in a decade of releases that saw it become the gold standard for single-board computer OSes.
Pimoroni Tufty 2040
Make a full-colour badge or display live sensor data, using an RP2040 chip. Les Pounder mulls the possibilities.
ROUNDUP
Vector drawing apps
Whether for works of art, accurate diagrams or informative charts, Michael Reed finds that each of these five applications has its strengths.
Illustration creation
Features that are mostly relevant to artists and illustrators.
Charts and diagrams
Specialised tools for easily made professional-looking diagrams.
User interface and experience
Looking for efficiency and intuitiveness.
Documentation and online help
Top-notch features are little use if you can’t figure out how to use them.
Extensions and plugins
Sometimes they get you past a brick wall; sometimes they add finesse.
Text handling
A picture paints a thousand words, but words can enhance a drawing.
Other features
Does an application have a worthwhile extra that others lack?
The Verdict
Vector drawing applications
PROTECT YOUR PRIVACY
In a world where the concept of online privacy is an afterthought at best, David Rutland looks at the hazards of the digital landscape and what you can do to protect yourself.
The end of ad-blockers
Manifest V3 will cripple or kill ad-blockers for Chrome, Edge, Opera and more. Why would Google do that?
Firefox extensions
Let’s defend our browsing with some pointy plugins that’ll keep the wolves at bay.
Peeling open Tor 12
We might not be in a position to share state secrets with foreign governments, but if we were, we’d use the Tor Browser.
Pi USER
DeepMind partners with the Pi Foundation
Old McDonald had a Pi, AI, AI, oh. And with that Pi he did machine learning, AI, AI, oooooh…
Gender balance in IT
Encouraging more women to study computing.
Arduino to Pi GPIO comms using Python
Like a snake charmer, Les Pounder uses his skills to persuade an Arduino to talk to a Raspberry Pi via Python.
Make a model train scale-speed monitor
Sean Conway feels the need for scale-model speed! So, he prototypes a Raspberry Pi-based measuring device with a few basic sensors.
IN DEPTH
3D PRINT EVOLUTION
From dinosaurs to biotech, Alastair Jennings takes a look at where 3D printing has been and what the future holds.
TUTORIALS
Terminal screencasting
Desperate to show off his terminal prowess, Shashank Sharma puts on his best Darth Vader voice and screencasts to the world live!
Turbo charging your desktop search
Nick Peers discovers how to configure the Cerebro search tool so it meets its promise of being a “productivity booster with a brain”.
A floppy-drive sized assembly based OS
Stepping out of his comfort zone, Michael Reed explores MenuetOS and its fork KolibriOS, two highly unusual operating systems.
Data recovery and secure deletion
Mike Bedford investigates recovering files from damaged disks and how to make sure that what you delete is gone for good.
Quick and easy website creation with Publii
Nick Baird guides you through the creation and deployment of a static website without touching a single line of code.
TOP OF THE FOSS!
Kinetic Kudu emerges from the bush
Nick Peers reveals how to upgrade to the latest version of Ubuntu, plus showcases its most notable new features.
CODING ACADEMY
Using eBPF to trace disk transfer actions
Never one to hold back on providing input, Mihalis Tsoukalos explains how to keep a track of disk I/O using eBPF
Recreate classic retro platform games
Recreating classic games is easy for Andrew Smith. He finds avoiding pixel-art bad guys somewhat more difficult!
Chat
X
Pocketmags ondersteuning