Add __str__ to models, remove null=True in CharField and TextField
This commit is contained in:
parent
4a9c37905c
commit
53c4e38771
14 changed files with 168 additions and 15 deletions
|
|
@ -44,12 +44,14 @@ class Changelog(models.Model):
|
|||
)
|
||||
|
||||
previous = models.TextField(
|
||||
null=True,
|
||||
blank=True,
|
||||
default="",
|
||||
verbose_name=_('previous data'),
|
||||
)
|
||||
|
||||
data = models.TextField(
|
||||
null=True,
|
||||
blank=True,
|
||||
default="",
|
||||
verbose_name=_('new data'),
|
||||
)
|
||||
|
||||
|
|
@ -80,3 +82,7 @@ class Changelog(models.Model):
|
|||
class Meta:
|
||||
verbose_name = _("changelog")
|
||||
verbose_name_plural = _("changelogs")
|
||||
|
||||
def __str__(self):
|
||||
return _("Changelog of type \"{action}\" for model {model} at {timestamp}").format(
|
||||
action=self.get_action_display(), model=str(self.model), timestamp=str(self.timestamp))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue