diff --git a/cms/forms.py b/cms/forms.py index c021d80..8c88139 100644 --- a/cms/forms.py +++ b/cms/forms.py @@ -5,6 +5,9 @@ from .models import Article class ArticleForm(forms.ModelForm): + link_widget = forms.TextInput(attrs={'placeholder': 'Введите ссылку новости'}) + link = forms.CharField(widget=link_widget) + class Meta: model = Article fields = ('body', 'link',) diff --git a/cms/migrations/0004_alter_article_link.py b/cms/migrations/0004_alter_article_link.py new file mode 100644 index 0000000..5f3fe7e --- /dev/null +++ b/cms/migrations/0004_alter_article_link.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.4 on 2022-12-28 06:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms', '0003_alter_article_link'), + ] + + operations = [ + migrations.AlterField( + model_name='article', + name='link', + field=models.CharField(max_length=200), + ), + ] diff --git a/cms/models.py b/cms/models.py index e7f00a5..0f8b76a 100644 --- a/cms/models.py +++ b/cms/models.py @@ -3,4 +3,4 @@ from django.db import models class Article(models.Model): body = models.TextField(null=False) - link = models.CharField(max_length=200, default='https://zakonvremeni.ru/news/') + link = models.CharField(max_length=200, null=False)