File: forms.py

package info (click to toggle)
python-django-braces 1.17.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 484 kB
  • sloc: python: 2,680; makefile: 138; sh: 6
file content (17 lines) | stat: -rw-r--r-- 416 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from django import forms

from braces.forms import UserKwargModelFormMixin

from .models import Article


class FormWithUserKwarg(UserKwargModelFormMixin, forms.Form):
    """This form will get a `user` kwarg"""
    field1 = forms.CharField()


class ArticleForm(forms.ModelForm):
    """This form represents an Article"""
    class Meta:
        model = Article
        fields = ["author", "title", "body", "slug"]