-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmodels.py
39 lines (32 loc) · 926 Bytes
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from datetime import timedelta
from django.db import models
class UpdatesModel(models.Model):
"""
Creates an abstract model to store the date and time of the last update.
"""
updated = models.DateTimeField(
verbose_name='Update date',
auto_now_add=True,
db_index=True
)
duration = models.DurationField(default=timedelta())
class Meta:
abstract = True
class InfoLoop(models.Model):
"""
Creates a model to store data about the launch and run time of the
application.
"""
value = models.BooleanField(default=False)
started = models.DateTimeField(
verbose_name='Started date',
auto_now_add=True
)
stopped = models.DateTimeField(
verbose_name='Stopped date',
blank=True,
null=True
)
duration = models.DurationField(default=timedelta())
class Meta:
ordering = ['-started']