1 hour ago · Tech · hide · 0 comments

Python A-Z is a blog series about Python. Each day, I share insights, ideas and examples for different parts of Python development that match with the letter of the day. Blaugust is an annual blogging festival in August where the goal is to write a blog post every day of the month. Last year when I gave a talk Love Letter to Django in a local meetup, my main thread was about its ORM (Object–relational mapping) and a few things it enables. I’m a big fan of ORM as a model: abstracting the database layer behind models that model the business logic of your application rather than writing raw SQL at the end of every function call path makes writing program logic way more enjoyable. Here’s a small excerpt from one of my apps. from django.db import models from django.conf import settings from api.models import Card class Collection(models.Model): owner = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.CASCADE, ) name = models.CharField(blank=True, null=True) def __str__(self):…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.