Skip to content

Commit caf054a

Browse files
andrepapotivictor-accarini
authored andcommitted
models: Add Note model
Signed-off-by: andrepapoti <andrepapoti@gmail.com>
1 parent 16d23ea commit caf054a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

patchwork/models.py

Lines changed: 19 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,17 @@ class Meta:
823831
]
824832

825833

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

0 commit comments

Comments
 (0)