Thursday, August 31, 2017

Re: Weird date math bug?

On 1 September 2017 at 14:57, James Schneider <> wrote:
I'm guessing that ChemoRegime.regime_age() contains line 95.

ChemoRegime defines the stop_date field with null=True and blank=True. I'm guessing this is because patients may not have yet stopped treatment, so they have no stop_date.

With that in mind, self.stop_date may be None in Python (and Null in the DB). Subtracting None from a real object is not supported.

Ensure that stop_date has a date value before doing date math with it.


I am so embarrassed. Thank you James, spot on.


You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment