##// END OF EJS Templates
Using opening post ID from cache, not passing it to the post view
neko259 -
r621:59a1deab default
parent child Browse files
Show More
@@ -291,7 +291,7 b' class Post(models.Model):'
291 291 thread.last_edit_time = edit_time
292 292 thread.save()
293 293
294 def get_url(self, opening_id=None):
294 def get_url(self):
295 295 """
296 296 Get full url to this post
297 297 """
@@ -300,9 +300,7 b' class Post(models.Model):'
300 300 link = cache.get(cache_key)
301 301
302 302 if not link:
303 if not opening_id:
304 opening_post = self.get_thread().get_opening_post()
305 opening_id = opening_post.id
303 opening_id = self.get_thread().get_opening_post_id()
306 304
307 305 if self.id != opening_id:
308 306 link = reverse('thread', kwargs={
@@ -31,7 +31,7 b''
31 31 <div class="message">
32 32 <div class="post-info">
33 33 <span class="title">{{ post.title }}</span>
34 <a class="post_id" href="{% post_object_url post opening_post_id %}">
34 <a class="post_id" href="{% post_object_url post %}">
35 35 ({{ post.id }}) </a>
36 36 [<span class="pub_time">{{ post.pub_time }}</span>]
37 37 {% if thread.archived %}
@@ -73,7 +73,7 b''
73 73 <div class="refmap">
74 74 {% trans "Replies" %}:
75 75 {% for ref_post in refposts %}
76 <a href="{% post_object_url ref_post opening_post_id %}">&gt;&gt;{{ ref_post.id }}</a
76 <a href="{% post_object_url ref_post %}">&gt;&gt;{{ ref_post.id }}</a
77 77 >{% if not forloop.last %},{% endif %}
78 78 {% endfor %}
79 79 </div>
@@ -20,25 +20,17 b' actions = ['
20 20 @register.simple_tag(name='post_url')
21 21 def post_url(*args, **kwargs):
22 22 post_id = args[0]
23 if len(args) > 1:
24 opening_post_id = args[1]
25 else:
26 opening_post_id = None
27 23
28 24 post = get_object_or_404(Post, id=post_id)
29 25
30 return post.get_url(opening_post_id)
26 return post.get_url()
31 27
32 28
33 29 @register.simple_tag(name='post_object_url')
34 30 def post_object_url(*args, **kwargs):
35 31 post = args[0]
36 if len(args) > 1:
37 opening_post_id = args[1]
38 else:
39 opening_post_id = None
40 32
41 return post.get_url(opening_post_id)
33 return post.get_url()
42 34
43 35
44 36 @register.simple_tag(name='image_actions')
@@ -78,10 +70,7 b' def post_view(post, moderator=False, nee'
78 70 else:
79 71 can_bump = thread.can_bump()
80 72
81 if 'opening_post_id' in kwargs:
82 opening_post_id = kwargs['opening_post_id']
83 else:
84 opening_post_id = thread.get_opening_post().id
73 opening_post_id = thread.get_opening_post_id()
85 74
86 75 return {
87 76 'post': post,
General Comments 0
You need to be logged in to leave comments. Login now