回答編集履歴
1
修正
test
CHANGED
@@ -12,12 +12,18 @@
|
|
12
12
|
|
13
13
|
date = models.DateTimeField('日付', auto_now=True)
|
14
14
|
|
15
|
-
nextdate = models.DateTimeField(
|
15
|
+
nextdate = models.DateTimeField(required=False)
|
16
16
|
|
17
17
|
def save(self, *args, **kwargs):
|
18
18
|
|
19
|
+
if self.date is None:
|
20
|
+
|
21
|
+
self.nextdate = timezone.now() + datetime.timedelta(weeks=1)
|
22
|
+
|
23
|
+
else:
|
24
|
+
|
19
|
-
self.nextdate = self.date + datetime.timedelta(weeks=1)
|
25
|
+
self.nextdate = self.date + datetime.timedelta(weeks=1)
|
20
26
|
|
21
27
|
super().save(*args, **kwargs)
|
22
28
|
|
23
|
-
```
|
29
|
+
```
|