mirror of
https://github.com/django/django.git
synced 2024-12-23 17:46:27 +00:00
f026a519ae
This also updates all dependent functionality, including modelform_factory and modelformset_factory, and the generic views `ModelFormMixin`, `CreateView` and `UpdateView` which gain a new `fields` attribute.
28 lines
875 B
Python
28 lines
875 B
Python
from __future__ import absolute_import
|
|
|
|
from django import forms
|
|
from django.forms.extras import SelectDateWidget
|
|
|
|
from .models import Company
|
|
|
|
|
|
class I18nForm(forms.Form):
|
|
decimal_field = forms.DecimalField(localize=True)
|
|
float_field = forms.FloatField(localize=True)
|
|
date_field = forms.DateField(localize=True)
|
|
datetime_field = forms.DateTimeField(localize=True)
|
|
time_field = forms.TimeField(localize=True)
|
|
integer_field = forms.IntegerField(localize=True)
|
|
|
|
class SelectDateForm(forms.Form):
|
|
date_field = forms.DateField(widget=SelectDateWidget)
|
|
|
|
class CompanyForm(forms.ModelForm):
|
|
cents_paid = forms.DecimalField(max_digits=4, decimal_places=2, localize=True)
|
|
products_delivered = forms.IntegerField(localize=True)
|
|
date_added = forms.DateTimeField(localize=True)
|
|
|
|
class Meta:
|
|
model = Company
|
|
fields = '__all__'
|