-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #807 from Studio-Yandex-Practicum/develop
Release
- Loading branch information
Showing
12 changed files
with
99 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Generated by Django 3.2.25 on 2024-10-22 20:18 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('contenttypes', '0002_remove_content_type_name'), | ||
('articles', '0014_project_description_caption'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='blogitemcontent', | ||
name='content_type', | ||
field=models.ForeignKey(limit_choices_to={'app_label': 'content_pages', 'model__in': ('contentunitrichtext', 'embedcode', 'eventsblock', 'imagesblock', 'link', 'personsblock', 'playsblock', 'videosblock')}, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype', verbose_name='Тип объекта'), | ||
), | ||
migrations.AlterField( | ||
model_name='newsitemcontent', | ||
name='content_type', | ||
field=models.ForeignKey(limit_choices_to={'app_label': 'content_pages', 'model__in': ('contentunitrichtext', 'embedcode', 'eventsblock', 'imagesblock', 'link', 'personsblock', 'playsblock', 'videosblock')}, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype', verbose_name='Тип объекта'), | ||
), | ||
migrations.AlterField( | ||
model_name='projectcontent', | ||
name='content_type', | ||
field=models.ForeignKey(limit_choices_to={'app_label': 'content_pages', 'model__in': ('contentunitrichtext', 'embedcode', 'eventsblock', 'imagesblock', 'link', 'personsblock', 'playsblock', 'videosblock')}, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype', verbose_name='Тип объекта'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 3.2.25 on 2024-10-22 20:02 | ||
|
||
import apps.content_pages.validators | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('content_pages', '0008_alter_extendedperson_options'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='EmbedCode', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created', models.DateTimeField(auto_now_add=True)), | ||
('modified', models.DateTimeField(auto_now=True)), | ||
('title', models.CharField(max_length=250, verbose_name='Заголовок')), | ||
('code', models.TextField(max_length=500, validators=[apps.content_pages.validators.iframe_validator], verbose_name='Тег iframe для встраиваемого содержимого')), | ||
], | ||
options={ | ||
'verbose_name': 'Встраиваемое содержимое', | ||
'verbose_name_plural': 'Встраиваемое содержимое', | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.core.exceptions import ValidationError | ||
|
||
|
||
def iframe_validator(code: str): | ||
code = code.strip() | ||
if not (code.startswith("<iframe ") and code.endswith("</iframe>")): | ||
raise ValidationError("Встраиваемое содержимое должно быть заключено в теги <iframe></iframe>") |