##// END OF EJS Templates
Added thread bumping.
neko259 -
r25:beac4c3a default
parent child Browse files
Show More
@@ -19,12 +19,18 b' class PostManager(models.Manager):'
19 parent=parent_id,
19 parent=parent_id,
20 image=image,
20 image=image,
21 poster_ip=ip,
21 poster_ip=ip,
22 poster_user_agent=UNKNOWN_UA)
22 poster_user_agent=UNKNOWN_UA,
23 last_edit_time=timezone.now())
23
24
24 if tags:
25 if tags:
25 for tag in tags:
26 for tag in tags:
26 post.tags.add(tag)
27 post.tags.add(tag)
27
28
29 if parent_id != NO_PARENT:
30 parent = self.get(id=parent_id)
31 parent.last_edit_time=timezone.now()
32 parent.save()
33
28 return post
34 return post
29
35
30 def delete_post(self, post):
36 def delete_post(self, post):
@@ -43,6 +49,7 b' class PostManager(models.Manager):'
43 threads = self.filter(parent=NO_PARENT)
49 threads = self.filter(parent=NO_PARENT)
44 else:
50 else:
45 threads = self.filter(parent=NO_PARENT, tag=tag)
51 threads = self.filter(parent=NO_PARENT, tag=tag)
52 threads = list(threads.order_by('-last_edit_time'))
46
53
47 return threads
54 return threads
48
55
@@ -84,6 +91,7 b' class Post(models.Model):'
84 poster_user_agent = models.TextField()
91 poster_user_agent = models.TextField()
85 parent = models.BigIntegerField()
92 parent = models.BigIntegerField()
86 tags = models.ManyToManyField(Tag)
93 tags = models.ManyToManyField(Tag)
94 last_edit_time = models.DateTimeField()
87
95
88 def __unicode__(self):
96 def __unicode__(self):
89 return self.title + ' (' + self.text + ')'
97 return self.title + ' (' + self.text + ')'
General Comments 0
You need to be logged in to leave comments. Login now