essensplan/cal/models.py

14 lines
645 B
Python
Raw Normal View History

2018-07-02 06:06:17 +00:00
from django.db import models
from django.urls import reverse
2018-07-25 06:10:26 +00:00
class Event(models.Model):
2020-05-16 19:06:08 +00:00
date = models.DateField()
brekky = models.CharField(max_length=255, blank=True, null=True)
lunch = models.CharField(max_length=255, blank=True, null=True)
dinner = models.CharField(max_length=255, blank=True, null=True)
@property
def get_html_url(self):
url = reverse('cal:event_edit', args=(self.id,))
2020-05-16 19:06:08 +00:00
return f'<a href="{url}" style="color:burlywood;"> {self.brekky or "-"} </a><br/><a href="{url}" style="color:blue;"> {self.lunch or "-"} </a><br/><a href="{url}" style="color:green;"> {self.dinner or "-"} </a>'