2👍
-
pub_date
refers tocoltrane.models.Entry
attributepub_date
see the source -
from django.conf import settings
imports your projectsettings.py
so you have to define your settings inside yourproject/settings.py
file. Here are some docs on the official docs about using settings in python code
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
- [Answered ]-Form validate like GenericView
- [Answered ]-Filtering a Django queryset once a slice has been taken
- [Answered ]-Updating account balance with django
Source:stackexchange.com