python code style

This commit is contained in:
Michael Shamoon 2022-08-07 17:45:49 -07:00
parent 5c1e09cc48
commit d5018af2a3
2 changed files with 13 additions and 7 deletions

View File

@ -127,8 +127,11 @@ class Command(BaseCommand):
serializers.serialize("json", DocumentType.objects.all()), serializers.serialize("json", DocumentType.objects.all()),
) )
manifest += json.loads( manifest += (
serializers.serialize("json", Comment.objects.all())), json.loads(
serializers.serialize("json", Comment.objects.all()),
),
)
documents = Document.objects.order_by("id") documents = Document.objects.order_by("id")
document_map = {d.pk: d for d in documents} document_map = {d.pk: d for d in documents}

View File

@ -538,16 +538,19 @@ class PaperlessTask(models.Model):
) )
acknowledged = models.BooleanField(default=False) acknowledged = models.BooleanField(default=False)
class Comment(models.Model): class Comment(models.Model):
comment = models.TextField( comment = models.TextField(
_("content"), _("content"),
blank=True, blank=True,
help_text=_("Comment for the document") help_text=_("Comment for the document"),
) )
created = models.DateTimeField( created = models.DateTimeField(
_("created"), _("created"),
default=timezone.now, db_index=True) default=timezone.now,
db_index=True,
)
document = models.ForeignKey( document = models.ForeignKey(
Document, Document,
@ -555,7 +558,7 @@ class Comment(models.Model):
null=True, null=True,
related_name="documents", related_name="documents",
on_delete=models.CASCADE, on_delete=models.CASCADE,
verbose_name=_("document") verbose_name=_("document"),
) )
user = models.ForeignKey( user = models.ForeignKey(
@ -564,7 +567,7 @@ class Comment(models.Model):
null=True, null=True,
related_name="users", related_name="users",
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
verbose_name=_("user") verbose_name=_("user"),
) )
class Meta: class Meta:
@ -573,4 +576,4 @@ class Comment(models.Model):
verbose_name_plural = _("comments") verbose_name_plural = _("comments")
def __str__(self): def __str__(self):
return self.content return self.content