banner.py
13 lines
| 335 B
| text/x-python
|
PythonLexer
|
r1148 | from django.db import models | ||
class Banner(models.Model): | ||||
title = models.TextField() | ||||
|
r1418 | text = models.TextField(blank=True, null=True) | ||
|
r1986 | post = models.ForeignKey('Post', on_delete=models.CASCADE) | ||
|
r1148 | |||
def __str__(self): | ||||
return self.title | ||||
|
r1418 | |||
def get_text(self) -> str: | ||||
return self.text or self.post.get_text() | ||||