##// END OF EJS Templates
Allow banner with no text. If so, details post text is used
neko259 -
r1418:9e2c30a1 default
parent child Browse files
Show More
@@ -0,0 +1,19 b''
1 # -*- coding: utf-8 -*-
2 from __future__ import unicode_literals
3
4 from django.db import migrations, models
5
6
7 class Migration(migrations.Migration):
8
9 dependencies = [
10 ('boards', '0037_auto_20151122_2155'),
11 ]
12
13 operations = [
14 migrations.AlterField(
15 model_name='banner',
16 name='text',
17 field=models.TextField(null=True, blank=True),
18 ),
19 ]
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -143,8 +143,8 b' msgid "This page does not exist"'
143 msgstr "Этой страницы не существует"
143 msgstr "Этой страницы не существует"
144
144
145 #: templates/boards/all_threads.html:35
145 #: templates/boards/all_threads.html:35
146 msgid "Related message"
146 msgid "Details"
147 msgstr "Связанное сообщение"
147 msgstr "Подробности"
148
148
149 #: templates/boards/all_threads.html:69
149 #: templates/boards/all_threads.html:69
150 msgid "Edit tag"
150 msgid "Edit tag"
@@ -3,8 +3,11 b' from django.db import models'
3
3
4 class Banner(models.Model):
4 class Banner(models.Model):
5 title = models.TextField()
5 title = models.TextField()
6 text = models.TextField()
6 text = models.TextField(blank=True, null=True)
7 post = models.ForeignKey('Post')
7 post = models.ForeignKey('Post')
8
8
9 def __str__(self):
9 def __str__(self):
10 return self.title
10 return self.title
11
12 def get_text(self) -> str:
13 return self.text or self.post.get_text()
@@ -31,8 +31,8 b''
31 {% for banner in banners %}
31 {% for banner in banners %}
32 <div class="post">
32 <div class="post">
33 <div class="title">{{ banner.title }}</div>
33 <div class="title">{{ banner.title }}</div>
34 <div>{{ banner.text }}</div>
34 <div>{{ banner.get_text }}</div>
35 <div>{% trans 'Related message' %}: <a href="{{ banner.post.get_absolute_url }}">>>{{ banner.post.id }}</a></div>
35 <div>{% trans 'Details' %}: <a href="{{ banner.post.get_absolute_url }}">>>{{ banner.post.id }}</a></div>
36 </div>
36 </div>
37 {% endfor %}
37 {% endfor %}
38
38
General Comments 0
You need to be logged in to leave comments. Login now