fix: make issue description null (#183)

* fix: make issue description null

* fix: put none check during stripping html
This commit is contained in:
pablohashescobar 2023-01-26 11:40:59 +05:30 committed by GitHub
parent 502e15ddf0
commit 6e99c007a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,9 +32,9 @@ class Issue(ProjectBaseModel):
related_name="state_issue",
)
name = models.CharField(max_length=255, verbose_name="Issue Name")
description = models.JSONField(blank=True)
description_html = models.TextField(blank=True)
description_stripped = models.TextField(blank=True)
description = models.JSONField(blank=True, null=True)
description_html = models.TextField(blank=True, null=True)
description_stripped = models.TextField(blank=True, null=True)
priority = models.CharField(
max_length=30,
choices=PRIORITY_CHOICES,
@ -84,10 +84,12 @@ class Issue(ProjectBaseModel):
)
except ImportError:
pass
# Strip the html tags using html parser
self.description_stripped = (
strip_tags(self.description_html) if self.description_html != "" else ""
None
if (self.description_html == "" or self.description_html is None)
else strip_tags(self.description_html)
)
super(Issue, self).save(*args, **kwargs)
@ -211,10 +213,11 @@ class IssueComment(ProjectBaseModel):
)
def save(self, *args, **kwargs):
self.comment_stripped = strip_tags(self.comment_html) if self.comment_html != "" else ""
self.comment_stripped = (
strip_tags(self.comment_html) if self.comment_html != "" else ""
)
return super(IssueComment, self).save(*args, **kwargs)
class Meta:
verbose_name = "Issue Comment"
verbose_name_plural = "Issue Comments"