You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
739 B
23 lines
739 B
from django import forms |
|
from django.contrib.auth import models as auth_models |
|
|
|
from .models import Article |
|
|
|
|
|
class ArticleForm(forms.ModelForm): |
|
link_widget = forms.TextInput(attrs={'placeholder': 'Введите ссылку новости'}) |
|
link = forms.CharField(widget=link_widget) |
|
publication_time = forms.DateTimeField(widget=forms.DateTimeInput(attrs={'type': 'datetime-local'}), required=False) |
|
|
|
class Meta: |
|
model = Article |
|
fields = ('body', 'link', 'publication_time') |
|
|
|
|
|
class UserForm(forms.ModelForm): |
|
class Meta: |
|
model = auth_models.User |
|
fields = ('username', 'password',) |
|
widgets = { |
|
'password': forms.PasswordInput(), |
|
}
|
|
|