blog Descriptions and More Links

Tags:
django

I have several Django projects, like my timebox or chore tracker project.

Two fields I will often add to most models is some kind of description/memo field and a url/more field.

from django.db import models

class Project(models.Model):
    # most of the model specific bits
    ...
    # common fields I add.
    description = models.TextField(blank=True)
    url = models.URLField(blank=True)

I will typically allow either to be blank, since both are intended to be optional.

A name/title might be enough as a quick hint or label, but often having a longer description/memo field is essential to provide extra detail once you have enough objects. I have mostly kept it as a plain text description (I will often use {{ obj.description|linebreaks }} to allow a bit of formatting), though other times I will consider allowing a full markdown description.

The url/more field is added for those times when the source of truth might be in another system that I want to reference. URLs are one of the best features of the web, and hopefully all the cool uris do not change. For similar reasons, when I am working with iCalendar, I am glad the rfc specifies a URL field to link to other systems.