Fixed imports to adhere to PEP 8 and stripped trailing whitespace.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6066 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
41b3a45fc5
commit
ef088d5f36
|
@ -1,3 +1,11 @@
|
||||||
|
import datetime
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
try:
|
||||||
|
import decimal
|
||||||
|
except ImportError:
|
||||||
|
from django.utils import _decimal as decimal # for Python 2.3
|
||||||
|
|
||||||
from django.db import get_creation_module
|
from django.db import get_creation_module
|
||||||
from django.db.models import signals
|
from django.db.models import signals
|
||||||
from django.dispatch import dispatcher
|
from django.dispatch import dispatcher
|
||||||
|
@ -12,11 +20,6 @@ from django.utils.text import capfirst
|
||||||
from django.utils.translation import ugettext_lazy, ugettext as _
|
from django.utils.translation import ugettext_lazy, ugettext as _
|
||||||
from django.utils.encoding import smart_unicode, force_unicode, smart_str
|
from django.utils.encoding import smart_unicode, force_unicode, smart_str
|
||||||
from django.utils.maxlength import LegacyMaxlength
|
from django.utils.maxlength import LegacyMaxlength
|
||||||
import datetime, os, time
|
|
||||||
try:
|
|
||||||
import decimal
|
|
||||||
except ImportError:
|
|
||||||
from django.utils import _decimal as decimal # for Python 2.3
|
|
||||||
|
|
||||||
class NOT_PROVIDED:
|
class NOT_PROVIDED:
|
||||||
pass
|
pass
|
||||||
|
@ -382,7 +385,7 @@ class Field(object):
|
||||||
|
|
||||||
def save_form_data(self, instance, data):
|
def save_form_data(self, instance, data):
|
||||||
setattr(instance, self.name, data)
|
setattr(instance, self.name, data)
|
||||||
|
|
||||||
def formfield(self, form_class=forms.CharField, **kwargs):
|
def formfield(self, form_class=forms.CharField, **kwargs):
|
||||||
"Returns a django.newforms.Field instance for this database Field."
|
"Returns a django.newforms.Field instance for this database Field."
|
||||||
defaults = {'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text}
|
defaults = {'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text}
|
||||||
|
@ -785,10 +788,10 @@ class FileField(Field):
|
||||||
def save_form_data(self, instance, data):
|
def save_form_data(self, instance, data):
|
||||||
if data:
|
if data:
|
||||||
getattr(instance, "save_%s_file" % self.name)(data.filename, data.content, save=False)
|
getattr(instance, "save_%s_file" % self.name)(data.filename, data.content, save=False)
|
||||||
|
|
||||||
def formfield(self, **kwargs):
|
def formfield(self, **kwargs):
|
||||||
defaults = {'form_class': forms.FileField}
|
defaults = {'form_class': forms.FileField}
|
||||||
# If a file has been provided previously, then the form doesn't require
|
# If a file has been provided previously, then the form doesn't require
|
||||||
# that a new file is provided this time.
|
# that a new file is provided this time.
|
||||||
if 'initial' in kwargs:
|
if 'initial' in kwargs:
|
||||||
defaults['required'] = False
|
defaults['required'] = False
|
||||||
|
|
Loading…
Reference in New Issue