One of the reasons that I migrated to django is because of the
underlying functionality.. With that said I would use a separate table
or file, whichever you are comfortable with , to store the changing
time delta variable.
You could dynamically retrieve this variable in the view or, the
example that django provides is to create a function in the models.py
and call that function from the model that you wanted to use the time
delta
https://docs.djangoproject.com/en/1.3/topics/db/managers/
The code on this page that I am referring to is:
class PollManager(models.Manager):
def with_counts(self):
from django.db import connection
cursor = connection.cursor()
cursor.execute("""
SELECT
p.id, p.question, p.poll_date, COUNT(*)
FROM polls_opinionpoll p, polls_response r
WHERE
p.id = r.poll_id
GROUP BY 1, 2, 3
ORDER BY 3 DESC""")
result_list = []
for row in cursor.fetchall():
p = self.model(id=row[0], question=row[1],
poll_date=row[2])
p.num_responses = row[3]
result_list.append(p)
return result_list
class OpinionPoll(models.Model):
question = models.CharField(max_length=200)
poll_date = models.DateField()
objects = PollManager()
******************************************
The function that you want would be repalced with the much simpler sql
select timedelta from time_delta ##table