PageRenderTime 18ms CodeModel.GetById 12ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/modeltests/model_forms/mforms.py

https://code.google.com/p/mango-py/
Python | 44 lines | 33 code | 11 blank | 0 comment | 0 complexity | 5a963238818e1d474665af1f75943aa9 MD5 | raw file
 1from django import forms
 2from django.forms import ModelForm
 3
 4from models import (Product, Price, Book, DerivedBook, ExplicitPK, Post,
 5        DerivedPost, Writer, FlexibleDatePost)
 6
 7class ProductForm(ModelForm):
 8    class Meta:
 9        model = Product
10
11class PriceForm(ModelForm):
12    class Meta:
13        model = Price
14
15class BookForm(ModelForm):
16    class Meta:
17       model = Book
18
19class DerivedBookForm(ModelForm):
20    class Meta:
21        model = DerivedBook
22
23class ExplicitPKForm(ModelForm):
24    class Meta:
25        model = ExplicitPK
26        fields = ('key', 'desc',)
27
28class PostForm(ModelForm):
29    class Meta:
30        model = Post
31
32class DerivedPostForm(ModelForm):
33    class Meta:
34        model = DerivedPost
35
36class CustomWriterForm(ModelForm):
37   name = forms.CharField(required=False)
38
39   class Meta:
40       model = Writer
41
42class FlexDatePostForm(ModelForm):
43    class Meta:
44        model = FlexibleDatePost