[Answered ]-Practical Django Projects – Pages 71 and 80

2👍

  1. pub_date refers to coltrane.models.Entry attribute pub_date see the source

  2. from django.conf import settings imports your project settings.py so you have to define your settings inside your project/settings.py file. Here are some docs on the official docs about using settings in python code

👤aminho

0👍

pub_date is referencing a field defined in the Entry model. Django will look up the field by name later, which is why it’s in quotes (otherwise it would trigger an NameError).

In models.py, you should have something like:

class Entry(models.Model):
    ...
    pub_date = models.DateField(...)

The settings file is typically called settings.py, and is located in your project’s root folder (next to manage.py, etc.).

👤Seth

Leave a comment