##// END OF EJS Templates
Use get_absolute_url instead of get_url for post, tag and thread
neko259 -
r1160:e92b66f8 default
parent child Browse files
Show More
@@ -130,7 +130,7 b' def render_reflink(tag_name, value, opti'
130 130 try:
131 131 post = boards.models.Post.objects.get(id=post_id)
132 132
133 result = '<a href="%s">&gt;&gt;%s</a>' % (post.get_url(), post_id)
133 result = '<a href="%s">&gt;&gt;%s</a>' % (post.get_absolute_url(), post_id)
134 134 except ObjectDoesNotExist:
135 135 pass
136 136
@@ -199,7 +199,7 b' class Post(models.Model, Viewable):'
199 199 the server from recalculating the map on every post show.
200 200 """
201 201
202 post_urls = [REFMAP_STR.format(refpost.get_url(), refpost.id)
202 post_urls = [REFMAP_STR.format(refpost.get_absolute_url(), refpost.id)
203 203 for refpost in self.referenced_posts.all()]
204 204
205 205 self.refmap = ', '.join(post_urls)
@@ -214,10 +214,6 b' class Post(models.Model, Viewable):'
214 214
215 215 return self.get_thread().get_opening_post_id() == self.id
216 216
217 # TODO Remove this and use get_absolute_url method
218 def get_url(self):
219 return self.url
220
221 217 def get_absolute_url(self):
222 218 return self.url
223 219
@@ -56,13 +56,9 b' class Tag(models.Model, Viewable):'
56 56 def get_thread_count(self) -> int:
57 57 return self.get_threads().count()
58 58
59 # TODO Remove this and use get_absolute_url
60 def get_url(self):
59 def get_absolute_url(self):
61 60 return reverse('tag', kwargs={'tag_name': self.name})
62 61
63 def get_absolute_url(self):
64 return self.get_url()
65
66 62 def get_threads(self):
67 63 return self.thread_set.order_by('-bump_time')
68 64
@@ -5,7 +5,7 b''
5 5
6 6 <div class="{{ css_class }}" id="{{ post.id }}" data-uid="{{ post.uid }}">
7 7 <div class="post-info">
8 <a class="post_id" href="{{ post.get_url }}">({{ post.get_absolute_id }})</a>
8 <a class="post_id" href="{{ post.get_absolute_url }}">({{ post.get_absolute_id }})</a>
9 9 <span class="title">{{ post.title }}</span>
10 10 <span class="pub_time"><time datetime="{{ post.pub_time|date:'c' }}">{{ post.pub_time }}</time></span>
11 11 {% comment %}
@@ -32,7 +32,7 b''
32 32 <div class="post">
33 33 <div class="title">{{ banner.title }}</div>
34 34 <div>{{ banner.text }}</div>
35 <div>{% trans 'Related message' %}: <a href="{{ banner.post.get_url }}">>>{{ banner.post.id }}</a></div>
35 <div>{% trans 'Related message' %}: <a href="{{ banner.post.get_absolute_url }}">>>{{ banner.post.id }}</a></div>
36 36 </div>
37 37 {% endfor %}
38 38
@@ -32,7 +32,7 b''
32 32 {{ image.width }}x{{ image.height }}
33 33 {% image_actions image.image.url request.get_host %}
34 34 <br />
35 <a href="{{ post.get_url }}">>>{{ post.id }}</a>
35 <a href="{{ post.get_absolute_url }}">>>{{ post.id }}</a>
36 36 </div>
37 37 {% endwith %}
38 38 </div>
@@ -26,7 +26,7 b' def post_url(*args, **kwargs):'
26 26
27 27 post = get_object_or_404('Post', id=post_id)
28 28
29 return post.get_url()
29 return post.get_absolute_url()
30 30
31 31
32 32 @register.simple_tag(name='image_actions')
@@ -158,7 +158,7 b' class AllThreadsView(PostMixin, BaseBoar'
158 158 post.notify_clients()
159 159
160 160 if html_response:
161 return redirect(post.get_url())
161 return redirect(post.get_absolute_url())
162 162
163 163 def get_threads(self):
164 164 """
@@ -38,7 +38,8 b' class ThreadView(BaseBoardView, PostMixi'
38 38
39 39 # If this is not OP, don't show it as it is
40 40 if not opening_post.is_opening():
41 return redirect(opening_post.get_thread().get_opening_post().get_url())
41 return redirect(opening_post.get_thread().get_opening_post()
42 .get_absolute_url())
42 43
43 44 if not form:
44 45 form = PostForm(error_class=PlainErrorList)
@@ -111,7 +112,7 b' class ThreadView(BaseBoardView, PostMixi'
111 112
112 113 if html_response:
113 114 if opening_post:
114 return redirect(post.get_url())
115 return redirect(post.get_absolute_url())
115 116 else:
116 117 return post
117 118
General Comments 0
You need to be logged in to leave comments. Login now