Skip to content

Commit

Permalink
Add title for picture
Browse files Browse the repository at this point in the history
  • Loading branch information
gruy committed Dec 4, 2023
1 parent ce677c7 commit 8018aaa
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
11 changes: 9 additions & 2 deletions djangocms_picture/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ class PicturePlugin(CMSPluginBase):
text_enabled = True

fieldsets = [
(None, {
('CMS', {
'fields': (
'auth_only',
'cms_title',
)
}),
(None, {
('Изображение', {
'fields': (
'picture',
'picture_dark',
Expand All @@ -33,6 +33,13 @@ class PicturePlugin(CMSPluginBase):
'is_lightbox',
)
}),
('Подпись', {
'fields': (
'show_title',
'title',
'text',
)
}),
(_('Advanced settings'), {
'classes': ('collapse',),
'fields': (
Expand Down
28 changes: 28 additions & 0 deletions djangocms_picture/migrations/0017_title.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 3.2.23 on 2023-12-04 10:00

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('djangocms_picture', '0016_merge_20231204_0958'),
]

operations = [
migrations.AddField(
model_name='picture',
name='show_title',
field=models.BooleanField(default=False, verbose_name='Показывать подпись'),
),
migrations.AddField(
model_name='picture',
name='text',
field=models.TextField(blank=True, max_length=2048, verbose_name='Тело подписи'),
),
migrations.AddField(
model_name='picture',
name='title',
field=models.CharField(blank=True, max_length=255, verbose_name='Заголовок'),
),
]
4 changes: 4 additions & 0 deletions djangocms_picture/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ class AbstractPicture(CMSPlugin):
)
dark_inverse = models.BooleanField(_('Inverse base image for dark theme'), default=False)

show_title = models.BooleanField('Показывать подпись', default=False)
title = models.CharField('Заголовок', max_length=255, blank=True)
text = models.TextField('Тело подписи', max_length=2048, blank=True)

class Meta:
abstract = True

Expand Down

0 comments on commit 8018aaa

Please sign in to comment.