Message from discussion
'NoneType' object has no attribute 'datetime' bug?
Received: by 10.14.211.196 with SMTP id w44mr8739932eeo.0.1343650662021;
Mon, 30 Jul 2012 05:17:42 -0700 (PDT)
X-BeenThere: django-users@googlegroups.com
Received: by 10.14.182.67 with SMTP id n43ls254721eem.4.gmail; Mon, 30 Jul
2012 05:16:43 -0700 (PDT)
Received: by 10.14.205.195 with SMTP id j43mr8729094eeo.3.1343650603200;
Mon, 30 Jul 2012 05:16:43 -0700 (PDT)
Received: by 10.14.205.195 with SMTP id j43mr8729093eeo.3.1343650603190;
Mon, 30 Jul 2012 05:16:43 -0700 (PDT)
Return-Path: <m.r.sopa...@gmail.com>
Received: from mail-ey0-f177.google.com (mail-ey0-f177.google.com [209.85.215.177])
by gmr-mx.google.com with ESMTPS id v42si14705979eep.0.2012.07.30.05.16.43
(version=TLSv1/SSLv3 cipher=OTHER);
Mon, 30 Jul 2012 05:16:43 -0700 (PDT)
Received-SPF: pass (google.com: domain of m.r.sopa...@gmail.com designates 209.85.215.177 as permitted sender) client-ip=209.85.215.177;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of m.r.sopa...@gmail.com designates 209.85.215.177 as permitted sender) smtp.mail=m.r.sopa...@gmail.com; dkim=pass header...@gmail.com
Received: by eaaq12 with SMTP id q12so1189899eaa.22
for <django-users@googlegroups.com>; Mon, 30 Jul 2012 05:16:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=message-id:date:from:user-agent:mime-version:to:subject:references
:in-reply-to:content-type:content-transfer-encoding;
bh=qgbEyAyt2hXBbz70ycj/g252a940O+mqYluDyHM1BFY=;
b=FZfrPEBjcTw5Gv4n878xQSdyJD9kH8nBaBbEGdCxCWUHJy5nBzepeA1Qe9pXcQKLCo
ARfn6yLUmgnO4nUdpaJ2YVS+RSFy6I8ELgQu4ZFamDE7gvOOENx7kT/TuVGkZOjr4qQf
2POqmphSXkfClYv7HRp9S8WaIe8iz120km0CalM+zXPZkesFxOEpFvfbsTMTzNYGUBW9
0fQX8V96gZCnoBwEJE1JS/EUP7L/MMMhqW/oWrvycUmFxLsB8tbSqSXAmsimYs+/TBX6
vjKLvZpdKqkFfi26Tx9n0lU/NjWJPEDkvWX0rNDgRtJPr3cg1Hs3d7QGZlYqX5i1g9Qx
GC1g==
Received: by 10.14.178.67 with SMTP id e43mr11808840eem.44.1343650603082;
Mon, 30 Jul 2012 05:16:43 -0700 (PDT)
Return-Path: <m.r.sopa...@gmail.com>
Received: from [192.168.0.11] (46-129-107-107.dynamic.upc.nl. [46.129.107.107])
by mx.google.com with ESMTPS id t6sm27818968eeo.17.2012.07.30.05.16.41
(version=SSLv3 cipher=OTHER);
Mon, 30 Jul 2012 05:16:42 -0700 (PDT)
Message-ID: <50167B27.1000...@gmail.com>
Date: Mon, 30 Jul 2012 14:16:39 +0200
From: Melvyn Sopacua <m.r.sopa...@gmail.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0
MIME-Version: 1.0
To: django-users@googlegroups.com
Subject: Re: 'NoneType' object has no attribute 'datetime' bug?
References: <296ab1f0-fa4e-45d2-816d-aa7dca13f680@googlegroups.com>
In-Reply-To: <296ab1f0-fa4e-45d2-816d-aa7dca13f680@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
On 14-7-2012 14:01, dobrysmak wrote:
> def close_coupon(self):
> current_date = datetime.datetime.now() today =
> datetime.datetime.combine(datetime.date.today(), datetime.time(19,30))
> .
> .
> end_date = current_date
This function is stripped down I suppose, because it does nothing useful:
- it changes a few local variables (not values of the model)
- today is unused
- end_date is set to current_date which seems odd.
My guess is that you want the end_date set to half past seven of the
current_date:
def close_coupon(self) :
from django.utils import timezone
current_date = timezone.now()
end_date = current_date.replace(hour=19, minutes=30)
self.current_date = current_date
self.end_date = end_date
--
Melvyn Sopacua