Show More
@@ -19,12 +19,18 b' class PostManager(models.Manager):' | |||
|
19 | 19 | parent=parent_id, |
|
20 | 20 | image=image, |
|
21 | 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 | 25 | if tags: |
|
25 | 26 | for tag in tags: |
|
26 | 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 | 34 | return post |
|
29 | 35 | |
|
30 | 36 | def delete_post(self, post): |
@@ -43,6 +49,7 b' class PostManager(models.Manager):' | |||
|
43 | 49 | threads = self.filter(parent=NO_PARENT) |
|
44 | 50 | else: |
|
45 | 51 | threads = self.filter(parent=NO_PARENT, tag=tag) |
|
52 | threads = list(threads.order_by('-last_edit_time')) | |
|
46 | 53 | |
|
47 | 54 | return threads |
|
48 | 55 | |
@@ -84,6 +91,7 b' class Post(models.Model):' | |||
|
84 | 91 | poster_user_agent = models.TextField() |
|
85 | 92 | parent = models.BigIntegerField() |
|
86 | 93 | tags = models.ManyToManyField(Tag) |
|
94 | last_edit_time = models.DateTimeField() | |
|
87 | 95 | |
|
88 | 96 | def __unicode__(self): |
|
89 | 97 | return self.title + ' (' + self.text + ')' |
General Comments 0
You need to be logged in to leave comments.
Login now