Skip to content

Commit be8eb02

Browse files
committed
models: Add Note model
Signed-off-by: andrepapoti <[email protected]>
1 parent 7494873 commit be8eb02

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

patchwork/models.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ def validate_regex_compiles(regex_string):
3333
raise ValidationError('Invalid regular expression entered!')
3434

3535

36+
class TimestampMixin(models.Model):
37+
updated_at = models.DateTimeField(auto_now=True)
38+
created_at = models.DateTimeField(auto_now_add=True)
39+
40+
class Meta:
41+
abstract = True
42+
43+
3644
class Person(models.Model):
3745
# properties
3846

@@ -823,6 +831,18 @@ class Meta:
823831
]
824832

825833

834+
class Note(TimestampMixin, models.Model):
835+
patch = models.ForeignKey(
836+
Patch,
837+
related_name='note',
838+
related_query_name='note',
839+
on_delete=models.CASCADE,
840+
)
841+
submitter = models.ForeignKey(User, on_delete=models.CASCADE)
842+
content = models.TextField(null=False, blank=True)
843+
maintainer_only = models.BooleanField(default=True)
844+
845+
826846
class Series(FilenameMixin, models.Model):
827847
"""A collection of patches."""
828848

0 commit comments

Comments
 (0)