Notes & ideas

Writing about code, systems, and the things I learn.

A collection of practical notes from building backend software and exploring technology.

ARTICLE

Aggregating and Annotating Objects

The Django web framework includes a default object-relational mapping layer (ORM) for interacting with data from relational databases such as SQLite,…

Read article
ARTICLE

Base64-Encoding an Image in Python

Binary images can be converted to Base64 text when they need to be embedded in JSON, HTML, email, or another text-based format. Open the file in bina…

Read article
ARTICLE

Context in Views

In Django REST Framework, the `APIView` class and the `ModelViewSet` class handle the context dictionary differently, which may explain the differenc…

Read article
ARTICLE

Connecting to a PostgreSQL Database

Here are a few steps you can take to resolve connect to db with another IP: Verify the PostgreSQL server is running: Ensure that the PostgreSQL serve…

Read article
ARTICLE

APIView vs. ViewSet in Django REST Framework

In Django REST Framework (DRF), you can choose between `APIView` and `ViewSet` depending on your specific requirements and preferences. `APIView` is …

Read article
ARTICLE

Setting Up PostgreSQL

To create a database and an owner with a password in PostgreSQL, you can follow these steps: 1. First, make sure you have PostgreSQL installed and ru…

Read article
ARTICLE

Accessing a PostgreSQL Server Locally

To access and use your PostgreSQL database on your local machine, you will first need to ensure that you have a PostgreSQL server installed on your l…

Read article
ARTICLE

Common Serializer Methods in Django REST Framework

In Django, serializers are used to convert complex data types, such as Django model instances, into a format (e.g., JSON, XML) that can be easily ren…

Read article
ARTICLE

Aggregation in Django

Django’s aggregate() method calculates a summary value across a queryset. In this example, Sum totals the hours worked by one teammate for each repor…

Read article
ARTICLE

Permissions in Django

1) Custom PermissionsTo create custom permissions for a given model object, use the permissions model Meta attribute.This example Task model creates …

Read article