##// 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 12 class TagAdmin(admin.ModelAdmin):
13 13
14 list_display = ('name', 'linked')
15 list_filter = ('linked',)
16
14 list_display = ('name',)
17 15
18 16 class ThreadAdmin(admin.ModelAdmin):
19 17
@@ -20,8 +20,7 b" ATTRIBUTE_PLACEHOLDER = 'placeholder'"
20 20
21 21 LAST_POST_TIME = 'last_post_time'
22 22 LAST_LOGIN_TIME = 'last_login_time'
23 TEXT_PLACEHOLDER = _('''Type message here. You can reply to message >>123 like
24 this. 2 new lines are required to start new paragraph.''')
23 TEXT_PLACEHOLDER = _('''Type message here. Use formatting panel for more advanced usage.''')
25 24 TAGS_PLACEHOLDER = _('tag1 several_words_tag')
26 25
27 26 ERROR_IMAGE_DUPLICATE = _('Such image was already posted')
1 NO CONTENT: modified file, binary diff hidden
@@ -7,7 +7,7 b' msgid ""'
7 7 msgstr ""
8 8 "Project-Id-Version: PACKAGE VERSION\n"
9 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 11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 13 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -35,91 +35,87 b' msgid "designer"'
35 35 msgstr "дизайнер"
36 36
37 37 #: forms.py:23
38 msgid ""
39 "Type message here. You can reply to message >>123 like\n"
40 " this. 2 new lines are required to start new paragraph."
41 msgstr ""
42 "Введите сообщение здесь. Вы можете ответить на сообщение >>123 вот так. 2 "
43 "переноса строки обязательны для создания нового абзаца."
38 msgid "Type message here. Use formatting panel for more advanced usage."
39 msgstr "Вводите сообщение сюда. Используйте панель для более сложного форматирования."
44 40
45 #: forms.py:25
41 #: forms.py:24
46 42 msgid "tag1 several_words_tag"
47 43 msgstr "тег1 тег_из_нескольких_слов"
48 44
49 #: forms.py:27
45 #: forms.py:26
50 46 msgid "Such image was already posted"
51 47 msgstr "Такое изображение уже было загружено"
52 48
53 #: forms.py:29
49 #: forms.py:28
54 50 msgid "Title"
55 51 msgstr "Заголовок"
56 52
57 #: forms.py:30
53 #: forms.py:29
58 54 msgid "Text"
59 55 msgstr "Текст"
60 56
61 #: forms.py:31
57 #: forms.py:30
62 58 msgid "Tag"
63 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 62 #: templates/search/search.html.py:13
67 63 msgid "Search"
68 64 msgstr "Поиск"
69 65
70 #: forms.py:109
66 #: forms.py:108
71 67 msgid "Image"
72 68 msgstr "Изображение"
73 69
74 #: forms.py:114
70 #: forms.py:113
75 71 msgid "e-mail"
76 72 msgstr ""
77 73
78 #: forms.py:125
74 #: forms.py:124
79 75 #, python-format
80 76 msgid "Title must have less than %s characters"
81 77 msgstr "Заголовок должен иметь меньше %s символов"
82 78
83 #: forms.py:134
79 #: forms.py:133
84 80 #, python-format
85 81 msgid "Text must have less than %s characters"
86 82 msgstr "Текст должен быть короче %s символов"
87 83
88 #: forms.py:145
84 #: forms.py:144
89 85 #, python-format
90 86 msgid "Image must be less than %s bytes"
91 87 msgstr "Изображение должно быть менее %s байт"
92 88
93 #: forms.py:180
89 #: forms.py:179
94 90 msgid "Either text or image must be entered."
95 91 msgstr "Текст или картинка должны быть введены."
96 92
97 #: forms.py:200
93 #: forms.py:199
98 94 #, python-format
99 95 msgid "Wait %s seconds after last posting"
100 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 99 msgid "Tags"
104 100 msgstr "Теги"
105 101
106 #: forms.py:223 forms.py:291
102 #: forms.py:222 forms.py:290
107 103 msgid "Inappropriate characters in tags."
108 104 msgstr "Недопустимые символы в тегах."
109 105
110 #: forms.py:251 forms.py:272
106 #: forms.py:250 forms.py:271
111 107 msgid "Captcha validation failed"
112 108 msgstr "Проверка капчи провалена"
113 109
114 #: forms.py:278
110 #: forms.py:277
115 111 msgid "Theme"
116 112 msgstr "Тема"
117 113
118 #: forms.py:314
114 #: forms.py:313
119 115 msgid "Invalid master password"
120 116 msgstr "Неверный мастер-пароль"
121 117
122 #: forms.py:328
118 #: forms.py:327
123 119 #, python-format
124 120 msgid "Wait %s minutes after last login"
125 121 msgstr "Подождите %s минут после последнего входа"
@@ -186,7 +182,7 b' msgstr "\xd0\x92\xd0\xb2\xd0\xb5\xd1\x80\xd1\x85"'
186 182 msgid "Insert your user id above"
187 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 186 msgid "Quote"
191 187 msgstr "Цитата"
192 188
@@ -340,33 +336,25 b' msgid "Syntax"'
340 336 msgstr "Синтаксис"
341 337
342 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 339 msgid "Italic text"
348 340 msgstr "Курсивный текст"
349 341
350 #: templates/boards/staticpages/help.html:13
342 #: templates/boards/staticpages/help.html:12
351 343 msgid "Bold text"
352 344 msgstr "Полужирный текст"
353 345
354 #: templates/boards/staticpages/help.html:14
346 #: templates/boards/staticpages/help.html:13
355 347 msgid "Spoiler"
356 348 msgstr "Спойлер"
357 349
358 #: templates/boards/staticpages/help.html:15
350 #: templates/boards/staticpages/help.html:14
359 351 msgid "Link to a post"
360 352 msgstr "Ссылка на сообщение"
361 353
362 #: templates/boards/staticpages/help.html:16
354 #: templates/boards/staticpages/help.html:15
363 355 msgid "Strikethrough text"
364 356 msgstr "Зачеркнутый текст"
365 357
366 #: templates/boards/staticpages/help.html:17
367 msgid "You need to new line before:"
368 msgstr "Перед этими тегами нужна новая строка:"
369
370 #: templates/boards/staticpages/help.html:18
358 #: templates/boards/staticpages/help.html:16
371 359 msgid "Comment"
372 360 msgstr "Комментарий"
@@ -38,13 +38,12 b" UNKNOWN_UA = ''"
38 38
39 39 SETTING_MODERATE = "moderate"
40 40
41 REGEX_REPLY = re.compile('>>(\d+)')
41 REGEX_REPLY = re.compile(r'&gt;&gt;(\d+)')
42 42
43 43 logger = logging.getLogger(__name__)
44 44
45 45
46 46 class PostManager(models.Manager):
47
48 47 def create_post(self, title, text, image=None, thread=None, ip=NO_IP,
49 48 tags=None):
50 49 """
@@ -79,13 +78,6 b' class PostManager(models.Manager):'
79 78
80 79 thread.replies.add(post)
81 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 81 map(thread.add_tag, tags)
90 82
91 83 if new_thread:
@@ -128,7 +120,7 b' class PostManager(models.Manager):'
128 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 124 post_id = reply_number.group(1)
133 125 ref_post = self.filter(id=post_id)
134 126 if ref_post.count() > 0:
@@ -218,13 +210,18 b' class Post(models.Model, Viewable):'
218 210 return title
219 211
220 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 217 map_string = ''
222 218
223 219 first = True
224 220 for refpost in self.referenced_posts.all():
225 221 if not first:
226 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 225 first = False
229 226
230 227 self.refmap = map_string
@@ -249,10 +246,10 b' class Post(models.Model, Viewable):'
249 246 thread = self.get_thread()
250 247 thread.add_tag(tag)
251 248 self.last_edit_time = edit_time
252 self.save()
249 self.save(update_fields=['last_edit_time'])
253 250
254 251 thread.last_edit_time = edit_time
255 thread.save()
252 thread.save(update_fields=['last_edit_time'])
256 253
257 254 @transaction.atomic
258 255 def remove_tag(self, tag):
@@ -261,10 +258,10 b' class Post(models.Model, Viewable):'
261 258 thread = self.get_thread()
262 259 thread.remove_tag(tag)
263 260 self.last_edit_time = edit_time
264 self.save()
261 self.save(update_fields=['last_edit_time'])
265 262
266 263 thread.last_edit_time = edit_time
267 thread.save()
264 thread.save(update_fields=['last_edit_time'])
268 265
269 266 def get_url(self, thread=None):
270 267 """
@@ -341,7 +338,7 b' class Post(models.Model, Viewable):'
341 338
342 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 344 self.images.all().delete()
@@ -38,7 +38,6 b' class Tag(models.Model, Viewable):'
38 38 name = models.CharField(max_length=100, db_index=True)
39 39 threads = models.ManyToManyField(Thread, null=True,
40 40 blank=True, related_name='tag+')
41 linked = models.ForeignKey('Tag', null=True, blank=True)
42 41
43 42 def __unicode__(self):
44 43 return self.name
@@ -53,31 +52,6 b' class Tag(models.Model, Viewable):'
53 52 def get_thread_count(self):
54 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 55 def get_post_count(self, archived=False):
82 56 """
83 57 Gets posts count for the tag's threads.
@@ -226,11 +226,13 b' blockquote {'
226 226 }
227 227
228 228 .multiquote {
229 color: #92cf38;
230 font-style: italic;
231 border-left: solid 3px #00aa00;
232 padding-left: 3px;
229 border-left: solid 4px #ccc;
230 padding: 3px;
233 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 238 .spoiler {
@@ -13,6 +13,8 b' from boards import urls'
13 13 from boards import settings
14 14 import neboard
15 15
16 TEST_TAG = 'test_tag'
17
16 18 PAGE_404 = 'boards/404.html'
17 19
18 20 TEST_TEXT = 'test text'
@@ -31,14 +33,18 b' logger = logging.getLogger(__name__)'
31 33 class PostTests(TestCase):
32 34
33 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 40 def test_post_add(self):
37 41 """Test adding post"""
38 42
39 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 49 def test_delete_post(self):
44 50 """Test post deletion"""
@@ -131,17 +137,6 b' class PostTests(TestCase):'
131 137 self.assertEqual(all_threads[settings.THREADS_PER_PAGE].id,
132 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 141 class PagesTest(TestCase):
147 142
@@ -272,4 +267,4 b' class AbstractTest(TestCase):'
272 267
273 268 class MockRequest:
274 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 35 images to a post
36 36 * Added search over posts and tags
37 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