예제 #1
0
 class Meta:
     model=News
     # fields='__all__'
     fields = ['title','content','is_published','category']
     widgets={
         'title':forms.TextInput(attrs={'class':'form-control'}),
         'text': forms.TextArea(attrs={'class': 'form-control','rows':5}),
         'category': forms.Select(attrs={'class': 'form-control'}),
예제 #2
0
파일: forms.py 프로젝트: gpathela/CWJ
class JobForm(forms.ModelForm):

	details = forms.CharField(
        label='Details', 
        widget=forms.TextArea(
            attrs={'placeholder': 'Enter all details related to Job'}
        )
    )
예제 #3
0
    class Meta():
        model = Post
        fields = ('author', 'title', 'text')

        widgets = {
            'title': forms.TextInput(attrs={'class':'textinputclass'}),
            'text': forms.TextArea(attrs={'class':'editable medium-editor-textarea postcontent'})
        }
예제 #4
0
    class Meta():
        model = Comment
        fields = ('author', 'text')

        widgets = {
            'author': forms.TextInput(attrs={'class':'textinputclass'}),
            'text': forms.TextArea(attrs={'class':'editable medium-editor-textarea'})
        }
예제 #5
0
    class Meta():
        model = Post
        fields = ('author','title','text')

        widgets = {
        'title':forms.TextInput(attrs={'class':'textinputclass'}) #class here is a css styling class..out class
        'text':forms.TextArea(attrs={'class': 'editable medium-editor-textarea postcontent'})
        #editable-we edit it(comes from medium editor  library)
        # 2nd for styling
        # 3rd is our own class
        }
예제 #6
0
class ContactForm(forms.Form):
    your_name = forms.CharField(
        label='Your name',
        max_length=100,
        widgets=forms.TextInput(attrs={'placeholder': 'Name *'}))
    your_email = forms.EmailField(
        request.post or None,
        widgets=forms.TextInput(attrs={'placeholder': 'Email *'}))
    your_subject = forms.CharField(
        label='Your subject',
        max_length=100,
        widgets=forms.TextInput(attrs={'placeholder': 'Subject '}))
    your_comment = forms.CharField(
        label='Your comment',
        max_lenght=200,
        widgets=forms.TextArea(attrs={'placeholder': 'Comments *'}))


#required=False,
예제 #7
0
class ContactForm(forms.form):
    name = forms.CharField(label='name')
    email = forms.EmailField(label='e-mail')
    subject = forms.CharField(label='subject')
    message = forms.CharField(label='message', widget=forms.TextArea())

    def send_mail(self):
        name = self.cleaned_data['name']
        email = self.cleaned_data['email']
        subject = self.cleaned_data['subject']
        message = self.cleaned_data['message']

        content = f'Name: {name} \n E-mai: {email} \n Subject: {subject} \n Message: {message}'

        mail = EmailMessage(subject='E-mail sent by the System',
                            body=content,
                            from_email='*****@*****.**',
                            to=['*****@*****.**'],
                            headers={'Reply-to:email'})
        mail.send()
예제 #8
0
 class Meta:
     model = Comment
     fields = ['content', 'image', 'comments', 'parent']
     widgets = {'content': forms.TextArea(attrs={'col': 80})}