##// END OF EJS Templates
Removed linked tags. Added changelog for 2.0. Fixed reply connection.
neko259 -
r740:7c2d35f4 2.0-dev
parent child Browse files
Show More
@@ -11,9 +11,7 b' class PostAdmin(admin.ModelAdmin):'
11
11
12 class TagAdmin(admin.ModelAdmin):
12 class TagAdmin(admin.ModelAdmin):
13
13
14 list_display = ('name', 'linked')
14 list_display = ('name',)
15 list_filter = ('linked',)
16
17
15
18 class ThreadAdmin(admin.ModelAdmin):
16 class ThreadAdmin(admin.ModelAdmin):
19
17
@@ -20,8 +20,7 b" ATTRIBUTE_PLACEHOLDER = 'placeholder'"
20
20
21 LAST_POST_TIME = 'last_post_time'
21 LAST_POST_TIME = 'last_post_time'
22 LAST_LOGIN_TIME = 'last_login_time'
22 LAST_LOGIN_TIME = 'last_login_time'
23 TEXT_PLACEHOLDER = _('''Type message here. You can reply to message >>123 like
23 TEXT_PLACEHOLDER = _('''Type message here. Use formatting panel for more advanced usage.''')
24 this. 2 new lines are required to start new paragraph.''')
25 TAGS_PLACEHOLDER = _('tag1 several_words_tag')
24 TAGS_PLACEHOLDER = _('tag1 several_words_tag')
26
25
27 ERROR_IMAGE_DUPLICATE = _('Such image was already posted')
26 ERROR_IMAGE_DUPLICATE = _('Such image was already posted')
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -7,7 +7,7 b' msgid ""'
7 msgstr ""
7 msgstr ""
8 "Project-Id-Version: PACKAGE VERSION\n"
8 "Project-Id-Version: PACKAGE VERSION\n"
9 "Report-Msgid-Bugs-To: \n"
9 "Report-Msgid-Bugs-To: \n"
10 "POT-Creation-Date: 2014-07-05 20:42+0300\n"
10 "POT-Creation-Date: 2014-07-08 18:07+0300\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -35,91 +35,87 b' msgid "designer"'
35 msgstr "дизайнер"
35 msgstr "дизайнер"
36
36
37 #: forms.py:23
37 #: forms.py:23
38 msgid ""
38 msgid "Type message here. Use formatting panel for more advanced usage."
39 "Type message here. You can reply to message >>123 like\n"
39 msgstr "Вводите сообщение сюда. Используйте панель для более сложного форматирования."
40 " this. 2 new lines are required to start new paragraph."
41 msgstr ""
42 "Введите сообщение здесь. Вы можете ответить на сообщение >>123 вот так. 2 "
43 "переноса строки обязательны для создания нового абзаца."
44
40
45 #: forms.py:25
41 #: forms.py:24
46 msgid "tag1 several_words_tag"
42 msgid "tag1 several_words_tag"
47 msgstr "тег1 тег_из_нескольких_слов"
43 msgstr "тег1 тег_из_нескольких_слов"
48
44
49 #: forms.py:27
45 #: forms.py:26
50 msgid "Such image was already posted"
46 msgid "Such image was already posted"
51 msgstr "Такое изображение уже было загружено"
47 msgstr "Такое изображение уже было загружено"
52
48
53 #: forms.py:29
49 #: forms.py:28
54 msgid "Title"
50 msgid "Title"
55 msgstr "Заголовок"
51 msgstr "Заголовок"
56
52
57 #: forms.py:30
53 #: forms.py:29
58 msgid "Text"
54 msgid "Text"
59 msgstr "Текст"
55 msgstr "Текст"
60
56
61 #: forms.py:31
57 #: forms.py:30
62 msgid "Tag"
58 msgid "Tag"
63 msgstr "Тег"
59 msgstr "Тег"
64
60
65 #: forms.py:32 templates/boards/base.html:54 templates/search/search.html:9
61 #: forms.py:31 templates/boards/base.html:54 templates/search/search.html:9
66 #: templates/search/search.html.py:13
62 #: templates/search/search.html.py:13
67 msgid "Search"
63 msgid "Search"
68 msgstr "Поиск"
64 msgstr "Поиск"
69
65
70 #: forms.py:109
66 #: forms.py:108
71 msgid "Image"
67 msgid "Image"
72 msgstr "Изображение"
68 msgstr "Изображение"
73
69
74 #: forms.py:114
70 #: forms.py:113
75 msgid "e-mail"
71 msgid "e-mail"
76 msgstr ""
72 msgstr ""
77
73
78 #: forms.py:125
74 #: forms.py:124
79 #, python-format
75 #, python-format
80 msgid "Title must have less than %s characters"
76 msgid "Title must have less than %s characters"
81 msgstr "Заголовок должен иметь меньше %s символов"
77 msgstr "Заголовок должен иметь меньше %s символов"
82
78
83 #: forms.py:134
79 #: forms.py:133
84 #, python-format
80 #, python-format
85 msgid "Text must have less than %s characters"
81 msgid "Text must have less than %s characters"
86 msgstr "Текст должен быть короче %s символов"
82 msgstr "Текст должен быть короче %s символов"
87
83
88 #: forms.py:145
84 #: forms.py:144
89 #, python-format
85 #, python-format
90 msgid "Image must be less than %s bytes"
86 msgid "Image must be less than %s bytes"
91 msgstr "Изображение должно быть менее %s байт"
87 msgstr "Изображение должно быть менее %s байт"
92
88
93 #: forms.py:180
89 #: forms.py:179
94 msgid "Either text or image must be entered."
90 msgid "Either text or image must be entered."
95 msgstr "Текст или картинка должны быть введены."
91 msgstr "Текст или картинка должны быть введены."
96
92
97 #: forms.py:200
93 #: forms.py:199
98 #, python-format
94 #, python-format
99 msgid "Wait %s seconds after last posting"
95 msgid "Wait %s seconds after last posting"
100 msgstr "Подождите %s секунд после последнего постинга"
96 msgstr "Подождите %s секунд после последнего постинга"
101
97
102 #: forms.py:216 templates/boards/tags.html:7 templates/boards/rss/post.html:10
98 #: forms.py:215 templates/boards/tags.html:7 templates/boards/rss/post.html:10
103 msgid "Tags"
99 msgid "Tags"
104 msgstr "Теги"
100 msgstr "Теги"
105
101
106 #: forms.py:223 forms.py:291
102 #: forms.py:222 forms.py:290
107 msgid "Inappropriate characters in tags."
103 msgid "Inappropriate characters in tags."
108 msgstr "Недопустимые символы в тегах."
104 msgstr "Недопустимые символы в тегах."
109
105
110 #: forms.py:251 forms.py:272
106 #: forms.py:250 forms.py:271
111 msgid "Captcha validation failed"
107 msgid "Captcha validation failed"
112 msgstr "Проверка капчи провалена"
108 msgstr "Проверка капчи провалена"
113
109
114 #: forms.py:278
110 #: forms.py:277
115 msgid "Theme"
111 msgid "Theme"
116 msgstr "Тема"
112 msgstr "Тема"
117
113
118 #: forms.py:314
114 #: forms.py:313
119 msgid "Invalid master password"
115 msgid "Invalid master password"
120 msgstr "Неверный мастер-пароль"
116 msgstr "Неверный мастер-пароль"
121
117
122 #: forms.py:328
118 #: forms.py:327
123 #, python-format
119 #, python-format
124 msgid "Wait %s minutes after last login"
120 msgid "Wait %s minutes after last login"
125 msgstr "Подождите %s минут после последнего входа"
121 msgstr "Подождите %s минут после последнего входа"
@@ -186,7 +182,7 b' msgstr "\xd0\x92\xd0\xb2\xd0\xb5\xd1\x80\xd1\x85"'
186 msgid "Insert your user id above"
182 msgid "Insert your user id above"
187 msgstr "Вставьте свой ID пользователя выше"
183 msgstr "Вставьте свой ID пользователя выше"
188
184
189 #: templates/boards/post.html:21 templates/boards/staticpages/help.html:19
185 #: templates/boards/post.html:21 templates/boards/staticpages/help.html:17
190 msgid "Quote"
186 msgid "Quote"
191 msgstr "Цитата"
187 msgstr "Цитата"
192
188
@@ -340,33 +336,25 b' msgid "Syntax"'
340 msgstr "Синтаксис"
336 msgstr "Синтаксис"
341
337
342 #: templates/boards/staticpages/help.html:11
338 #: templates/boards/staticpages/help.html:11
343 msgid "2 line breaks for a new line."
344 msgstr "2 перевода строки создают новый абзац."
345
346 #: templates/boards/staticpages/help.html:12
347 msgid "Italic text"
339 msgid "Italic text"
348 msgstr "Курсивный текст"
340 msgstr "Курсивный текст"
349
341
350 #: templates/boards/staticpages/help.html:13
342 #: templates/boards/staticpages/help.html:12
351 msgid "Bold text"
343 msgid "Bold text"
352 msgstr "Полужирный текст"
344 msgstr "Полужирный текст"
353
345
354 #: templates/boards/staticpages/help.html:14
346 #: templates/boards/staticpages/help.html:13
355 msgid "Spoiler"
347 msgid "Spoiler"
356 msgstr "Спойлер"
348 msgstr "Спойлер"
357
349
358 #: templates/boards/staticpages/help.html:15
350 #: templates/boards/staticpages/help.html:14
359 msgid "Link to a post"
351 msgid "Link to a post"
360 msgstr "Ссылка на сообщение"
352 msgstr "Ссылка на сообщение"
361
353
362 #: templates/boards/staticpages/help.html:16
354 #: templates/boards/staticpages/help.html:15
363 msgid "Strikethrough text"
355 msgid "Strikethrough text"
364 msgstr "Зачеркнутый текст"
356 msgstr "Зачеркнутый текст"
365
357
366 #: templates/boards/staticpages/help.html:17
358 #: templates/boards/staticpages/help.html:16
367 msgid "You need to new line before:"
368 msgstr "Перед этими тегами нужна новая строка:"
369
370 #: templates/boards/staticpages/help.html:18
371 msgid "Comment"
359 msgid "Comment"
372 msgstr "Комментарий"
360 msgstr "Комментарий"
@@ -38,13 +38,12 b" UNKNOWN_UA = ''"
38
38
39 SETTING_MODERATE = "moderate"
39 SETTING_MODERATE = "moderate"
40
40
41 REGEX_REPLY = re.compile('>>(\d+)')
41 REGEX_REPLY = re.compile(r'&gt;&gt;(\d+)')
42
42
43 logger = logging.getLogger(__name__)
43 logger = logging.getLogger(__name__)
44
44
45
45
46 class PostManager(models.Manager):
46 class PostManager(models.Manager):
47
48 def create_post(self, title, text, image=None, thread=None, ip=NO_IP,
47 def create_post(self, title, text, image=None, thread=None, ip=NO_IP,
49 tags=None):
48 tags=None):
50 """
49 """
@@ -79,13 +78,6 b' class PostManager(models.Manager):'
79
78
80 thread.replies.add(post)
79 thread.replies.add(post)
81 if tags:
80 if tags:
82 linked_tags = []
83 for tag in tags:
84 tag_linked_tags = tag.get_linked_tags()
85 if len(tag_linked_tags) > 0:
86 linked_tags.extend(tag_linked_tags)
87
88 tags.extend(linked_tags)
89 map(thread.add_tag, tags)
81 map(thread.add_tag, tags)
90
82
91 if new_thread:
83 if new_thread:
@@ -128,7 +120,7 b' class PostManager(models.Manager):'
128 Connects replies to a post to show them as a reflink map
120 Connects replies to a post to show them as a reflink map
129 """
121 """
130
122
131 for reply_number in re.finditer(REGEX_REPLY, post.text.raw):
123 for reply_number in re.finditer(REGEX_REPLY, post.text.rendered):
132 post_id = reply_number.group(1)
124 post_id = reply_number.group(1)
133 ref_post = self.filter(id=post_id)
125 ref_post = self.filter(id=post_id)
134 if ref_post.count() > 0:
126 if ref_post.count() > 0:
@@ -218,13 +210,18 b' class Post(models.Model, Viewable):'
218 return title
210 return title
219
211
220 def build_refmap(self):
212 def build_refmap(self):
213 """
214 Builds a replies map string from replies list. This is a cache to stop
215 the server from recalculating the map on every post show.
216 """
221 map_string = ''
217 map_string = ''
222
218
223 first = True
219 first = True
224 for refpost in self.referenced_posts.all():
220 for refpost in self.referenced_posts.all():
225 if not first:
221 if not first:
226 map_string += ', '
222 map_string += ', '
227 map_string += '<a href="%s">&gt;&gt;%s</a>' % (refpost.get_url(), refpost.id)
223 map_string += '<a href="%s">&gt;&gt;%s</a>' % (refpost.get_url(),
224 refpost.id)
228 first = False
225 first = False
229
226
230 self.refmap = map_string
227 self.refmap = map_string
@@ -249,10 +246,10 b' class Post(models.Model, Viewable):'
249 thread = self.get_thread()
246 thread = self.get_thread()
250 thread.add_tag(tag)
247 thread.add_tag(tag)
251 self.last_edit_time = edit_time
248 self.last_edit_time = edit_time
252 self.save()
249 self.save(update_fields=['last_edit_time'])
253
250
254 thread.last_edit_time = edit_time
251 thread.last_edit_time = edit_time
255 thread.save()
252 thread.save(update_fields=['last_edit_time'])
256
253
257 @transaction.atomic
254 @transaction.atomic
258 def remove_tag(self, tag):
255 def remove_tag(self, tag):
@@ -261,10 +258,10 b' class Post(models.Model, Viewable):'
261 thread = self.get_thread()
258 thread = self.get_thread()
262 thread.remove_tag(tag)
259 thread.remove_tag(tag)
263 self.last_edit_time = edit_time
260 self.last_edit_time = edit_time
264 self.save()
261 self.save(update_fields=['last_edit_time'])
265
262
266 thread.last_edit_time = edit_time
263 thread.last_edit_time = edit_time
267 thread.save()
264 thread.save(update_fields=['last_edit_time'])
268
265
269 def get_url(self, thread=None):
266 def get_url(self, thread=None):
270 """
267 """
@@ -341,7 +338,7 b' class Post(models.Model, Viewable):'
341
338
342 def delete(self, using=None):
339 def delete(self, using=None):
343 """
340 """
344 Delete all post images and the post itself.
341 Deletes all post images and the post itself.
345 """
342 """
346
343
347 self.images.all().delete()
344 self.images.all().delete()
@@ -38,7 +38,6 b' class Tag(models.Model, Viewable):'
38 name = models.CharField(max_length=100, db_index=True)
38 name = models.CharField(max_length=100, db_index=True)
39 threads = models.ManyToManyField(Thread, null=True,
39 threads = models.ManyToManyField(Thread, null=True,
40 blank=True, related_name='tag+')
40 blank=True, related_name='tag+')
41 linked = models.ForeignKey('Tag', null=True, blank=True)
42
41
43 def __unicode__(self):
42 def __unicode__(self):
44 return self.name
43 return self.name
@@ -53,31 +52,6 b' class Tag(models.Model, Viewable):'
53 def get_thread_count(self):
52 def get_thread_count(self):
54 return self.threads.count()
53 return self.threads.count()
55
54
56 def get_linked_tags(self):
57 """
58 Gets tags linked to the current one.
59 """
60
61 tag_list = []
62 self.get_linked_tags_list(tag_list)
63
64 return tag_list
65
66 def get_linked_tags_list(self, tag_list=None):
67 """
68 Returns the list of tags linked to current. The list can be got
69 through returned value or tag_list parameter
70 """
71 if not tag_list:
72 tag_list = []
73
74 linked_tag = self.linked
75
76 if linked_tag and not (linked_tag in tag_list):
77 tag_list.append(linked_tag)
78
79 linked_tag.get_linked_tags_list(tag_list)
80
81 def get_post_count(self, archived=False):
55 def get_post_count(self, archived=False):
82 """
56 """
83 Gets posts count for the tag's threads.
57 Gets posts count for the tag's threads.
@@ -226,11 +226,13 b' blockquote {'
226 }
226 }
227
227
228 .multiquote {
228 .multiquote {
229 color: #92cf38;
229 border-left: solid 4px #ccc;
230 font-style: italic;
230 padding: 3px;
231 border-left: solid 3px #00aa00;
232 padding-left: 3px;
233 display: inline-block;
231 display: inline-block;
232 background: #222;
233 border-right: solid 1px #ccc;
234 border-top: solid 1px #ccc;
235 border-bottom: solid 1px #ccc;
234 }
236 }
235
237
236 .spoiler {
238 .spoiler {
@@ -13,6 +13,8 b' from boards import urls'
13 from boards import settings
13 from boards import settings
14 import neboard
14 import neboard
15
15
16 TEST_TAG = 'test_tag'
17
16 PAGE_404 = 'boards/404.html'
18 PAGE_404 = 'boards/404.html'
17
19
18 TEST_TEXT = 'test text'
20 TEST_TEXT = 'test text'
@@ -31,14 +33,18 b' logger = logging.getLogger(__name__)'
31 class PostTests(TestCase):
33 class PostTests(TestCase):
32
34
33 def _create_post(self):
35 def _create_post(self):
34 return Post.objects.create_post(title='title', text='text')
36 tag = Tag.objects.create(name=TEST_TAG)
37 return Post.objects.create_post(title='title', text='text',
38 tags=[tag])
35
39
36 def test_post_add(self):
40 def test_post_add(self):
37 """Test adding post"""
41 """Test adding post"""
38
42
39 post = self._create_post()
43 post = self._create_post()
40
44
41 self.assertIsNotNone(post, 'No post was created')
45 self.assertIsNotNone(post, 'No post was created.')
46 self.assertEqual(TEST_TAG, post.get_thread().tags.all()[0].name,
47 'No tags were added to the post.')
42
48
43 def test_delete_post(self):
49 def test_delete_post(self):
44 """Test post deletion"""
50 """Test post deletion"""
@@ -131,17 +137,6 b' class PostTests(TestCase):'
131 self.assertEqual(all_threads[settings.THREADS_PER_PAGE].id,
137 self.assertEqual(all_threads[settings.THREADS_PER_PAGE].id,
132 first_post.id)
138 first_post.id)
133
139
134 def test_linked_tag(self):
135 """Test adding a linked tag"""
136
137 linked_tag = Tag.objects.create(name=u'tag1')
138 tag = Tag.objects.create(name=u'tag2', linked=linked_tag)
139
140 post = Post.objects.create_post("", "", tags=[tag])
141
142 self.assertTrue(linked_tag in post.get_thread().tags.all(),
143 'Linked tag was not added')
144
145
140
146 class PagesTest(TestCase):
141 class PagesTest(TestCase):
147
142
@@ -272,4 +267,4 b' class AbstractTest(TestCase):'
272
267
273 class MockRequest:
268 class MockRequest:
274 def __init__(self):
269 def __init__(self):
275 self.session = dict() No newline at end of file
270 self.session = dict()
@@ -35,3 +35,8 b' elements instead of swapping them'
35 images to a post
35 images to a post
36 * Added search over posts and tags
36 * Added search over posts and tags
37 * [ADMIN] Command to remove empty users
37 * [ADMIN] Command to remove empty users
38
39 # 2.0 D'Anna
40 * Removed users. Now settings are stored in sessions
41 * Changed markdown to bbcode
42 * Removed linked tags
General Comments 0
You need to be logged in to leave comments. Login now