##// END OF EJS Templates
Updates to support django 1.7
neko259 -
r872:752c0b44 default
parent child Browse files
Show More
@@ -266,7 +266,10 b' class Post(models.Model, Viewable):'
266 return self.refmap
266 return self.refmap
267
267
268 def is_referenced(self):
268 def is_referenced(self):
269 return len(self.refmap) > 0
269 if not self.refmap:
270 return False
271 else:
272 return len(self.refmap) > 0
270
273
271 def is_opening(self):
274 def is_opening(self):
272 """
275 """
@@ -394,7 +397,9 b' class Post(models.Model, Viewable):'
394 if PARAMETER_TRUNCATED in request.GET:
397 if PARAMETER_TRUNCATED in request.GET:
395 context[PARAMETER_TRUNCATED] = True
398 context[PARAMETER_TRUNCATED] = True
396
399
397 return render_to_string('boards/api_post.html', context)
400 # TODO Use dict here
401 return render_to_string('boards/api_post.html',
402 context_instance=context)
398 elif format_type == DIFF_TYPE_JSON:
403 elif format_type == DIFF_TYPE_JSON:
399 post_json = {
404 post_json = {
400 'id': self.id,
405 'id': self.id,
@@ -1,4 +1,4 b''
1 VERSION = '2.2.1 Miyu'
1 VERSION = '2.2.2 Miyu'
2 SITE_NAME = 'Neboard'
2 SITE_NAME = 'Neboard'
3
3
4 CACHE_TIMEOUT = 600 # Timeout for caching, if cache is used
4 CACHE_TIMEOUT = 600 # Timeout for caching, if cache is used
@@ -15,7 +15,7 b''
15 {% if current_page.has_previous %}
15 {% if current_page.has_previous %}
16 <link rel="prev" href="
16 <link rel="prev" href="
17 {% if tag %}
17 {% if tag %}
18 {% url "tag" tag_name=tag page=current_page.previous_page_number %}
18 {% url "tag" tag_name=tag.name page=current_page.previous_page_number %}
19 {% elif archived %}
19 {% elif archived %}
20 {% url "archive" page=current_page.previous_page_number %}
20 {% url "archive" page=current_page.previous_page_number %}
21 {% else %}
21 {% else %}
@@ -26,7 +26,7 b''
26 {% if current_page.has_next %}
26 {% if current_page.has_next %}
27 <link rel="next" href="
27 <link rel="next" href="
28 {% if tag %}
28 {% if tag %}
29 {% url "tag" tag_name=tag page=current_page.next_page_number %}
29 {% url "tag" tag_name=tag.name page=current_page.next_page_number %}
30 {% elif archived %}
30 {% elif archived %}
31 {% url "archive" page=current_page.next_page_number %}
31 {% url "archive" page=current_page.next_page_number %}
32 {% else %}
32 {% else %}
@@ -70,7 +70,7 b''
70 <div class="page_link">
70 <div class="page_link">
71 <a href="
71 <a href="
72 {% if tag %}
72 {% if tag %}
73 {% url "tag" tag_name=tag page=current_page.previous_page_number %}
73 {% url "tag" tag_name=tag.name page=current_page.previous_page_number %}
74 {% elif archived %}
74 {% elif archived %}
75 {% url "archive" page=current_page.previous_page_number %}
75 {% url "archive" page=current_page.previous_page_number %}
76 {% else %}
76 {% else %}
@@ -112,7 +112,7 b''
112 <div class="page_link">
112 <div class="page_link">
113 <a href="
113 <a href="
114 {% if tag %}
114 {% if tag %}
115 {% url "tag" tag_name=tag page=current_page.next_page_number %}
115 {% url "tag" tag_name=tag.name page=current_page.next_page_number %}
116 {% elif archived %}
116 {% elif archived %}
117 {% url "archive" page=current_page.next_page_number %}
117 {% url "archive" page=current_page.next_page_number %}
118 {% else %}
118 {% else %}
@@ -157,7 +157,7 b''
157 {% trans "Pages:" %}
157 {% trans "Pages:" %}
158 <a href="
158 <a href="
159 {% if tag %}
159 {% if tag %}
160 {% url "tag" tag_name=tag page=paginator.page_range|first %}
160 {% url "tag" tag_name=tag.name page=paginator.page_range|first %}
161 {% elif archived %}
161 {% elif archived %}
162 {% url "archive" page=paginator.page_range|first %}
162 {% url "archive" page=paginator.page_range|first %}
163 {% else %}
163 {% else %}
@@ -172,7 +172,7 b''
172 {% endifequal %}
172 {% endifequal %}
173 href="
173 href="
174 {% if tag %}
174 {% if tag %}
175 {% url "tag" tag_name=tag page=page %}
175 {% url "tag" tag_name=tag.name page=page %}
176 {% elif archived %}
176 {% elif archived %}
177 {% url "archive" page=page %}
177 {% url "archive" page=page %}
178 {% else %}
178 {% else %}
@@ -184,7 +184,7 b''
184 ]
184 ]
185 <a href="
185 <a href="
186 {% if tag %}
186 {% if tag %}
187 {% url "tag" tag_name=tag page=paginator.page_range|last %}
187 {% url "tag" tag_name=tag.name page=paginator.page_range|last %}
188 {% elif archived %}
188 {% elif archived %}
189 {% url "archive" page=paginator.page_range|last %}
189 {% url "archive" page=paginator.page_range|last %}
190 {% else %}
190 {% else %}
@@ -212,8 +212,4 b' class ImageWithThumbsField(ImageField):'
212 thumb_height_ratio = int(original_height * scale_ratio)
212 thumb_height_ratio = int(original_height * scale_ratio)
213
213
214 setattr(instance, thumb_width_field, thumb_width_ratio)
214 setattr(instance, thumb_width_field, thumb_width_ratio)
215 setattr(instance, thumb_height_field, thumb_height_ratio)
215 setattr(instance, thumb_height_field, thumb_height_ratio) No newline at end of file
216
217
218 from south.modelsinspector import add_introspection_rules
219 add_introspection_rules([], ["^boards\.thumbs\.ImageWithThumbsField"])
@@ -10,4 +10,5 b' class AllTagsView(BaseBoardView):'
10 context = self.get_context_data(request=request)
10 context = self.get_context_data(request=request)
11 context['all_tags'] = Tag.objects.get_not_empty_tags()
11 context['all_tags'] = Tag.objects.get_not_empty_tags()
12
12
13 return render(request, 'boards/tags.html', context)
13 # TODO Use dict here
14 return render(request, 'boards/tags.html', context_instance=context)
@@ -51,7 +51,8 b' class AllThreadsView(PostMixin, BaseBoar'
51
51
52 self._get_page_context(paginator, context, page)
52 self._get_page_context(paginator, context, page)
53
53
54 return render(request, TEMPLATE, context)
54 # TODO Use dict here
55 return render(request, TEMPLATE, context_instance=context)
55
56
56 def post(self, request, page=DEFAULT_PAGE):
57 def post(self, request, page=DEFAULT_PAGE):
57 form = ThreadForm(request.POST, request.FILES,
58 form = ThreadForm(request.POST, request.FILES,
@@ -7,7 +7,6 b' from django.shortcuts import get_object_'
7 from django.template import RequestContext
7 from django.template import RequestContext
8 from django.utils import timezone
8 from django.utils import timezone
9 from django.core import serializers
9 from django.core import serializers
10 from django.template.loader import render_to_string
11
10
12 from boards.forms import PostForm, PlainErrorList
11 from boards.forms import PostForm, PlainErrorList
13 from boards.models import Post, Thread, Tag
12 from boards.models import Post, Thread, Tag
@@ -123,7 +122,8 b' def get_post(request, post_id):'
123 if PARAMETER_TRUNCATED in request.GET:
122 if PARAMETER_TRUNCATED in request.GET:
124 context[PARAMETER_TRUNCATED] = True
123 context[PARAMETER_TRUNCATED] = True
125
124
126 return render(request, 'boards/api_post.html', context)
125 # TODO Use dict here
126 return render(request, 'boards/api_post.html', context_instance=context)
127
127
128
128
129 # TODO Test this
129 # TODO Test this
@@ -10,4 +10,5 b' class AuthorsView(BaseBoardView):'
10 context = self.get_context_data(request=request)
10 context = self.get_context_data(request=request)
11 context['authors'] = authors
11 context['authors'] = authors
12
12
13 return render(request, 'boards/authors.html', context)
13 # TODO Use dict here
14 return render(request, 'boards/authors.html', context_instance=context)
@@ -13,4 +13,7 b' class BannedView(BaseBoardView):'
13
13
14 ban = get_object_or_404(Ban, ip=utils.get_client_ip(request))
14 ban = get_object_or_404(Ban, ip=utils.get_client_ip(request))
15 context['ban_reason'] = ban.reason
15 context['ban_reason'] = ban.reason
16 return render(request, 'boards/staticpages/banned.html', context)
16
17 # TODO Use dict here
18 return render(request, 'boards/staticpages/banned.html',
19 context_instance=context)
@@ -10,4 +10,6 b' class NotFoundView(BaseBoardView):'
10
10
11 def get(self, request):
11 def get(self, request):
12 context = self.get_context_data(request=request)
12 context = self.get_context_data(request=request)
13 return render(request, 'boards/404.html', context)
13
14 # TODO Use dict here
15 return render(request, 'boards/404.html', context_instance=context)
@@ -30,7 +30,9 b' class PostAdminView(BaseBoardView, Dispa'
30
30
31 context['tag_form'] = form
31 context['tag_form'] = form
32
32
33 return render(request, 'boards/post_admin.html', context)
33 # TODO Use dict here
34 return render(request, 'boards/post_admin.html',
35 context_instance=context)
34
36
35 def post(self, request, post_id):
37 def post(self, request, post_id):
36 settings_manager = get_settings_manager(request)
38 settings_manager = get_settings_manager(request)
@@ -18,7 +18,8 b' class PostPreviewView(View):'
18 def get(self, request):
18 def get(self, request):
19 context = RequestContext(request)
19 context = RequestContext(request)
20
20
21 return render(request, TEMPLATE, context)
21 # TODO Use dict here
22 return render(request, TEMPLATE, context_instance=context)
22
23
23 def post(self, request):
24 def post(self, request):
24 context = RequestContext(request)
25 context = RequestContext(request)
@@ -32,4 +33,5 b' class PostPreviewView(View):'
32 context[CONTEXT_RESULT] = rendered_text
33 context[CONTEXT_RESULT] = rendered_text
33 context[CONTEXT_QUERY] = raw_text
34 context[CONTEXT_QUERY] = raw_text
34
35
35 return render(request, TEMPLATE, context)
36 # TODO Use dict here
37 return render(request, TEMPLATE, context_instance=context)
@@ -37,4 +37,5 b' class BoardSearchView(View):'
37 context[CONTEXT_PAGE] = paginator.page(page)
37 context[CONTEXT_PAGE] = paginator.page(page)
38 context[CONTEXT_QUERY] = query
38 context[CONTEXT_QUERY] = query
39
39
40 return render(request, TEMPLATE, context)
40 # TODO Use dict here
41 return render(request, TEMPLATE, context_instance=context)
@@ -22,7 +22,8 b' class SettingsView(BaseBoardView):'
22 context[CONTEXT_FORM] = form
22 context[CONTEXT_FORM] = form
23 context[CONTEXT_HIDDEN_TAGS] = settings_manager.get_hidden_tags()
23 context[CONTEXT_HIDDEN_TAGS] = settings_manager.get_hidden_tags()
24
24
25 return render(request, 'boards/settings.html', context)
25 # TODO Use dict here
26 return render(request, 'boards/settings.html', context_instance=context)
26
27
27 def post(self, request):
28 def post(self, request):
28 settings_manager = get_settings_manager(request)
29 settings_manager = get_settings_manager(request)
@@ -11,4 +11,7 b' class StaticPageView(BaseBoardView):'
11 """
11 """
12
12
13 context = self.get_context_data(request=request)
13 context = self.get_context_data(request=request)
14 return render(request, 'boards/staticpages/' + name + '.html', context)
14
15 # TODO Use dict here
16 return render(request, 'boards/staticpages/' + name + '.html',
17 context_instance=context)
@@ -92,7 +92,8 b' class ThreadView(BaseBoardView, PostMixi'
92 else:
92 else:
93 raise Http404
93 raise Http404
94
94
95 return render(request, document, context)
95 # TODO Use dict here
96 return render(request, document, context_instance=context)
96
97
97 def post(self, request, post_id, mode=MODE_NORMAL):
98 def post(self, request, post_id, mode=MODE_NORMAL):
98 opening_post = get_object_or_404(Post, id=post_id)
99 opening_post = get_object_or_404(Post, id=post_id)
@@ -145,8 +145,6 b' INSTALLED_APPS = ('
145 'django.contrib.humanize',
145 'django.contrib.humanize',
146 'django_cleanup',
146 'django_cleanup',
147
147
148 # Migrations
149 'south',
150 'debug_toolbar',
148 'debug_toolbar',
151
149
152 # Search
150 # Search
@@ -1,8 +1,7 b''
1 adjacent
1 adjacent
2 south>=0.8.4
3 haystack
2 haystack
4 pillow
3 pillow
5 django>=1.6
4 django>=1.7
6 django_cleanup
5 django_cleanup
7 django-markupfield
6 django-markupfield
8 bbcode
7 bbcode
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now