1
0
mirror of https://github.com/django/django.git synced 2024-12-26 11:06:07 +00:00
django/tests/modeltests/model_forms/mforms.py
Ramiro Morales 730769d1af Fixed #14951 -- Made the unique_for_{date,month,year} model field constraints to not fail when the related DateField is empty.
Existing modelforms tests were extended to cover this case and an equivalent set of tests was added for the model functionality.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15167 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-09 13:26:39 +00:00

45 lines
918 B
Python

from django import forms
from django.forms import ModelForm
from models import (Product, Price, Book, DerivedBook, ExplicitPK, Post,
DerivedPost, Writer, FlexibleDatePost)
class ProductForm(ModelForm):
class Meta:
model = Product
class PriceForm(ModelForm):
class Meta:
model = Price
class BookForm(ModelForm):
class Meta:
model = Book
class DerivedBookForm(ModelForm):
class Meta:
model = DerivedBook
class ExplicitPKForm(ModelForm):
class Meta:
model = ExplicitPK
fields = ('key', 'desc',)
class PostForm(ModelForm):
class Meta:
model = Post
class DerivedPostForm(ModelForm):
class Meta:
model = DerivedPost
class CustomWriterForm(ModelForm):
name = forms.CharField(required=False)
class Meta:
model = Writer
class FlexDatePostForm(ModelForm):
class Meta:
model = FlexibleDatePost