Add post modify view
This allows moderators to modify posts (add sticky, etc). Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -68,7 +68,7 @@ class Board(models.Model):
|
||||
return self.max_pages * self.threads_per_page
|
||||
|
||||
def prune_threads(self):
|
||||
to_remove = self.threads.order_by("-last_bump")[self.max_threads :]
|
||||
to_remove = self.threads.order_by("-sticky", "-last_bump")[self.max_threads :]
|
||||
for thread in to_remove:
|
||||
thread.delete()
|
||||
|
||||
@@ -93,6 +93,8 @@ class Post(models.Model):
|
||||
ip = models.GenericIPAddressField()
|
||||
# Capcode
|
||||
capcode = models.ForeignKey("Capcode", null=True, blank=True, on_delete=SET_NULL)
|
||||
# Post is stickied
|
||||
sticky = models.BooleanField(default=False, blank=True)
|
||||
# Creation time
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
# Last bump time
|
||||
@@ -116,6 +118,9 @@ class Post(models.Model):
|
||||
image_width = models.IntegerField(null=True)
|
||||
image_height = models.IntegerField(null=True)
|
||||
|
||||
class Meta:
|
||||
permissions = [("set_sticky", "Can sticky post")]
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if self.image:
|
||||
self.original_image_name = Path(self.image.name).parts[-1]
|
||||
|
||||
Reference in New Issue
Block a user