models.py 908 Bytes
Newer Older
1
import datetime
dorothee.kueppers's avatar
dorothee.kueppers committed
2

3
4
from django.db import models
from recurrence.fields import RecurrenceField
5
6


7
8
class Selection(models.Model):
    total_time = models.IntegerField(default=0)  # in minutes
dorothee.kueppers's avatar
dorothee.kueppers committed
9
10
11
    active = models.BooleanField(default=False)
    started = models.DateTimeField(default=datetime.datetime.today)
    endtime = models.DateTimeField()
12
13

    def __str__(self):
dorothee.kueppers's avatar
dorothee.kueppers committed
14
        return f'Aufgabenliste {self.pk}, Gesamtdauer: {self.total_time.__str__()}'
15
16


Hänzelmann, Antje's avatar
Hänzelmann, Antje committed
17
class Todo(models.Model):
18
19
    text = models.CharField(max_length=200)
    complete = models.BooleanField(default=False)
20
21
22
    duration = models.IntegerField(default=15)
    created = models.DateField(default=datetime.date.today)
    rank = models.IntegerField(default=1)
23
    recurrences = RecurrenceField(blank=True, null=True)
24
    selection = models.ForeignKey(Selection, on_delete=models.SET_NULL, null=True)
Hänzelmann, Antje's avatar
Hänzelmann, Antje committed
25
26

    def __str__(self):
dorothee.kueppers's avatar
dorothee.kueppers committed
27
        return self.text