Django

Code

Changeset 4255

Show
Ignore:
Timestamp:
12/28/06 18:25:26 (2 years ago)
Author:
jkocherhans
Message:

generic-auth: Merged to trunk [4254]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/generic-auth/AUTHORS

    r4149 r4255  
    119119    Petar Marić 
    120120    mark@junklight.com 
     121    Yasushi Masuda <whosaysni@gmail.com> 
    121122    mattycakes@gmail.com 
    122123    Jason McBrayer <http://www.carcosa.net/jason/> 
    123124    mccutchen@gmail.com 
    124125    michael.mcewan@gmail.com 
     126    mitakummaa@gmail.com 
    125127    mmarshall 
    126128    Eric Moritz <http://eric.themoritzfamily.com/> 
     
    161163    Joe Topjian <http://joe.terrarum.net/geek/code/python/django/> 
    162164    Karen Tracey <graybark@bellsouth.net> 
     165    Makoto Tsuyuki <mtsuyuki@gmail.com> 
    163166    Amit Upadhyay 
    164167    Geert Vanderkelen 
  • django/branches/generic-auth/django/conf/global_settings.py

    r4063 r4255  
    2626 
    2727# Local time zone for this installation. All choices can be found here: 
    28 # http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE 
     28# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE 
    2929TIME_ZONE = 'America/Chicago' 
    3030 
  • django/branches/generic-auth/django/conf/project_template/settings.py

    r4026 r4255  
    1818 
    1919# Local time zone for this installation. All choices can be found here: 
    20 # http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE 
     20# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE 
    2121TIME_ZONE = 'America/Chicago' 
    2222 
  • django/branches/generic-auth/django/contrib/admin/templates/admin/base.html

    r4026 r4255  
    3939        {% block pretitle %}{% endblock %} 
    4040        {% block content_title %}{% if title %}<h1>{{ title|escape }}</h1>{% endif %}{% endblock %} 
    41         {% block content %}{{ content }}{% endblock %} 
     41        {% block content %} 
     42        {% block object-tools %}{% endblock %} 
     43        {{ content }} 
     44        {% endblock %} 
    4245        {% block sidebar %}{% endblock %} 
    4346        <br class="clear" /> 
  • django/branches/generic-auth/django/contrib/admin/templates/admin/change_form.html

    r4026 r4255  
    1717{% endif %}{% endblock %} 
    1818{% block content %}<div id="content-main"> 
     19{% block object-tools %} 
    1920{% if change %}{% if not is_popup %} 
    2021  <ul class="object-tools"><li><a href="history/" class="historylink">{% trans "History" %}</a></li> 
     
    2223  </ul> 
    2324{% endif %}{% endif %} 
     25{% endblock %} 
    2426<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.module_name }}_form">{% block form_top %}{% endblock %} 
    2527<div> 
  • django/branches/generic-auth/django/contrib/admin/templates/admin/change_list.html

    r4024 r4255  
    88{% block content %} 
    99<div id="content-main"> 
     10{% block object-tools %} 
    1011{% if has_add_permission %} 
    1112<ul class="object-tools"><li><a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">{% blocktrans with cl.opts.verbose_name|escape as name %}Add {{ name }}{% endblocktrans %}</a></li></ul> 
    1213{% endif %} 
     14{% endblock %} 
    1315<div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist"> 
    1416{% block search %}{% search_form cl %}{% endblock %} 
  • django/branches/generic-auth/django/contrib/admin/views/auth.py

    r4026 r4255  
    33from django.contrib.auth.models import User 
    44from django.core.exceptions import PermissionDenied 
    5 from django import forms, template 
     5from django import oldforms, template 
    66from django.shortcuts import render_to_response 
    77from django.http import HttpResponseRedirect 
     
    2525    else: 
    2626        errors = new_data = {} 
    27     form = forms.FormWrapper(manipulator, new_data, errors) 
     27    form = oldforms.FormWrapper(manipulator, new_data, errors) 
    2828    return render_to_response('admin/auth/user/add_form.html', { 
    2929        'title': _('Add user'), 
  • django/branches/generic-auth/django/contrib/admin/views/main.py

    r4184 r4255  
    1 from django import forms, template 
     1from django import oldforms, template 
    22from django.conf import settings 
    33from django.contrib.auth import has_permission 
     
    289289 
    290290    # Populate the FormWrapper. 
    291     form = forms.FormWrapper(manipulator, new_data, errors) 
     291    form = oldforms.FormWrapper(manipulator, new_data, errors) 
    292292 
    293293    c = template.RequestContext(request, { 
     
    380380 
    381381    # Populate the FormWrapper. 
    382     form = forms.FormWrapper(manipulator, new_data, errors) 
     382    form = oldforms.FormWrapper(manipulator, new_data, errors) 
    383383    form.original = manipulator.original_object 
    384384    form.order_objects = [] 
  • django/branches/generic-auth/django/contrib/admin/views/template.py

    r4026 r4255  
    11from django.contrib.admin.views.decorators import staff_member_required 
    22from django.core import validators 
    3 from django import template, forms 
     3from django import template, oldforms 
    44from django.template import loader 
    55from django.shortcuts import render_to_response 
     
    2626    return render_to_response('admin/template_validator.html', { 
    2727        'title': 'Template validator', 
    28         'form': forms.FormWrapper(manipulator, new_data, errors), 
     28        'form': oldforms.FormWrapper(manipulator, new_data, errors), 
    2929    }, context_instance=template.RequestContext(request)) 
    3030template_validator = staff_member_required(template_validator) 
    3131 
    32 class TemplateValidator(forms.Manipulator): 
     32class TemplateValidator(oldforms.Manipulator): 
    3333    def __init__(self, settings_modules): 
    3434        self.settings_modules = settings_modules 
    3535        site_list = Site.objects.in_bulk(settings_modules.keys()).values() 
    3636        self.fields = ( 
    37             forms.SelectField('site', is_required=True, choices=[(s.id, s.name) for s in site_list]), 
    38             forms.LargeTextField('template', is_required=True, rows=25, validator_list=[self.isValidTemplate]), 
     37            oldforms.SelectField('site', is_required=True, choices=[(s.id, s.name) for s in site_list]), 
     38            oldforms.LargeTextField('template', is_required=True, rows=25, validator_list=[self.isValidTemplate]), 
    3939        ) 
    4040 
  • django/branches/generic-auth/django/contrib/auth/forms.py

    r4026 r4255  
    44from django.template import Context, loader 
    55from django.core import validators 
    6 from django import forms 
     6from django import oldforms 
    77 
    8 class UserCreationForm(forms.Manipulator): 
     8class UserCreationForm(oldforms.Manipulator): 
    99    "A form that creates a user, with no privileges, from the given username and password." 
    1010    def __init__(self): 
    1111        self.fields = ( 
    12             forms.TextField(field_name='username', length=30, maxlength=30, is_required=True, 
     12            oldforms.TextField(field_name='username', length=30, maxlength=30, is_required=True, 
    1313                validator_list=[validators.isAlphaNumeric, self.isValidUsername]), 
    14             forms.PasswordField(field_name='password1', length=30, maxlength=60, is_required=True), 
    15             forms.PasswordField(field_name='password2', length=30, maxlength=60, is_required=True, 
     14            oldforms.PasswordField(field_name='password1', length=30, maxlength=60, is_required=True), 
     15            oldforms.PasswordField(field_name='password2', length=30, maxlength=60, is_required=True, 
    1616                validator_list=[validators.AlwaysMatchesOtherField('password1', _("The two password fields didn't match."))]), 
    1717        ) 
     
    2828        return User.objects.create_user(new_data['username'], '', new_data['password1']) 
    2929 
    30 class AuthenticationForm(forms.Manipulator): 
     30class AuthenticationForm(oldforms.Manipulator): 
    3131    """ 
    3232    Base class for authenticating users. Extend this to get a form that accepts 
     
    4242        self.request = request 
    4343        self.fields = [ 
    44             forms.TextField(field_name="username", length=15, maxlength=30, is_required=True, 
     44            oldforms.TextField(field_name="username", length=15, maxlength=30, is_required=True, 
    4545                validator_list=[self.isValidUser, self.hasCookiesEnabled]), 
    46             forms.PasswordField(field_name="password", length=15, maxlength=30, is_required=True), 
     46            oldforms.PasswordField(field_name="password", length=15, maxlength=30, is_required=True), 
    4747        ] 
    4848        self.user_cache = None 
     
    6969        return self.user_cache 
    7070 
    71 class PasswordResetForm(forms.Manipulator): 
     71class PasswordResetForm(oldforms.Manipulator): 
    7272    "A form that lets a user request a password reset" 
    7373    def __init__(self): 
    7474        self.fields = ( 
    75             forms.EmailField(field_name="email", length=40, is_required=True, 
     75            oldforms.EmailField(field_name="email", length=40, is_required=True, 
    7676                validator_list=[self.isValidUserEmail]), 
    7777        ) 
     
    106106        send_mail('Password reset on %s' % site_name, t.render(Context(c)), None, [self.user_cache.email]) 
    107107 
    108 class PasswordChangeForm(forms.Manipulator): 
     108class PasswordChangeForm(oldforms.Manipulator): 
    109109    "A form that lets a user change his password." 
    110110    def __init__(self, user): 
    111111        self.user = user 
    112112        self.fields = ( 
    113             forms.PasswordField(field_name="old_password", length=30, maxlength=30, is_required=True, 
     113            oldforms.PasswordField(field_name="old_password", length=30, maxlength=30, is_required=True, 
    114114                validator_list=[self.isValidOldPassword]), 
    115             forms.PasswordField(field_name="new_password1", length=30, maxlength=30, is_required=True, 
     115            oldforms.PasswordField(field_name="new_password1", length=30, maxlength=30, is_required=True, 
    116116                validator_list=[validators.AlwaysMatchesOtherField('new_password2', _("The two 'new password' fields didn't match."))]), 
    117             forms.PasswordField(field_name="new_password2", length=30, maxlength=30, is_required=True), 
     117            oldforms.PasswordField(field_name="new_password2", length=30, maxlength=30, is_required=True), 
    118118        ) 
    119119 
  • django/branches/generic-auth/django/contrib/auth/views.py

    r4024 r4255  
    11from django.contrib.auth.forms import AuthenticationForm 
    22from django.contrib.auth.forms import PasswordResetForm, PasswordChangeForm 
    3 from django import forms 
     3from django import oldforms 
    44from django.shortcuts import render_to_response 
    55from django.template import RequestContext 
     
    2727    request.session.set_test_cookie() 
    2828    return render_to_response(template_name, { 
    29         'form': forms.FormWrapper(manipulator, request.POST, errors), 
     29        'form': oldforms.FormWrapper(manipulator, request.POST, errors), 
    3030        REDIRECT_FIELD_NAME: redirect_to, 
    3131        'site_name': Site.objects.get_current().name, 
     
    6363                form.save(email_template_name=email_template_name) 
    6464            return HttpResponseRedirect('%sdone/' % request.path) 
    65     return render_to_response(template_name, {'form': forms.FormWrapper(form, new_data, errors)}, 
     65    return render_to_response(template_name, {'form': oldforms.FormWrapper(form, new_data, errors)}, 
    6666        context_instance=RequestContext(request)) 
    6767 
     
    7878            form.save(new_data) 
    7979            return HttpResponseRedirect('%sdone/' % request.path) 
    80     return render_to_response(template_name, {'form': forms.FormWrapper(form, new_data, errors)}, 
     80    return render_to_response(template_name, {'form': oldforms.FormWrapper(form, new_data, errors)}, 
    8181        context_instance=RequestContext(request)) 
    8282password_change = login_required(password_change) 
  • django/branches/generic-auth/django/contrib/comments/views/comments.py

    r4026 r4255  
    11from django.core import validators 
    2 from django import forms 
     2from django import oldforms 
    33from django.core.mail import mail_admins, mail_managers 
    44from django.http import Http404 
     
    2929                return [] 
    3030        self.fields.extend([ 
    31             forms.LargeTextField(field_name="comment", maxlength=3000, is_required=True, 
     31            oldforms.LargeTextField(field_name="comment", maxlength=3000, is_required=True, 
    3232                validator_list=[self.hasNoProfanities]), 
    33             forms.RadioSelectField(field_name="rating1", choices=choices, 
     33            oldforms.RadioSelectField(field_name="rating1", choices=choices, 
    3434                is_required=ratings_required and num_rating_choices > 0, 
    3535                validator_list=get_validator_list(1), 
    3636            ), 
    37             forms.RadioSelectField(field_name="rating2", choices=choices, 
     37            oldforms.RadioSelectField(field_name="rating2", choices=choices, 
    3838                is_required=ratings_required and num_rating_choices > 1, 
    3939                validator_list=get_validator_list(2), 
    4040            ), 
    41             forms.RadioSelectField(field_name="rating3", choices=choices, 
     41            oldforms.RadioSelectField(field_name="rating3", choices=choices, 
    4242                is_required=ratings_required and num_rating_choices > 2, 
    4343                validator_list=get_validator_list(3), 
    4444            ), 
    45             forms.RadioSelectField(field_name="rating4", choices=choices, 
     45            oldforms.RadioSelectField(field_name="rating4", choices=choices, 
    4646                is_required=ratings_required and num_rating_choices > 3, 
    4747                validator_list=get_validator_list(4), 
    4848            ), 
    49             forms.RadioSelectField(field_name="rating5", choices=choices, 
     49            oldforms.RadioSelectField(field_name="rating5", choices=choices, 
    5050                is_required=ratings_required and num_rating_choices > 4, 
    5151                validator_list=get_validator_list(5), 
    5252            ), 
    53             forms.RadioSelectField(field_name="rating6", choices=choices, 
     53            oldforms.RadioSelectField(field_name="rating6", choices=choices, 
    5454                is_required=ratings_required and num_rating_choices > 5, 
    5555                validator_list=get_validator_list(6), 
    5656            ), 
    57             forms.RadioSelectField(field_name="rating7", choices=choices, 
     57            oldforms.RadioSelectField(field_name="rating7", choices=choices, 
    5858                is_required=ratings_required and num_rating_choices > 6, 
    5959                validator_list=get_validator_list(7), 
    6060            ), 
    61             forms.RadioSelectField(field_name="rating8", choices=choices, 
     61            oldforms.RadioSelectField(field_name="rating8", choices=choices, 
    6262                is_required=ratings_required and num_rating_choices > 7, 
    6363                validator_list=get_validator_list(8), 
     
    118118        return c 
    119119 
    120 class PublicFreeCommentManipulator(forms.Manipulator): 
     120class PublicFreeCommentManipulator(oldforms.Manipulator): 
    121121    "Manipulator that handles public free (unregistered) comments" 
    122122    def __init__(self): 
    123123        self.fields = ( 
    124             forms.TextField(field_name="person_name", maxlength=50, is_required=True, 
     124            oldforms.TextField(field_name="person_name", maxlength=50, is_required=True, 
    125125                validator_list=[self.hasNoProfanities]), 
    126             forms.LargeTextField(field_name="comment", maxlength=3000, is_required=True, 
     126            oldforms.LargeTextField(field_name="comment", maxlength=3000, is_required=True, 
    127127                validator_list=[self.hasNoProfanities]), 
    128128        ) 
     
    222222        login(request, manipulator.get_user()) 
    223223    if errors or request.POST.has_key('preview'): 
    224         class CommentFormWrapper(forms.FormWrapper): 
     224        class CommentFormWrapper(oldforms.FormWrapper): 
    225225            def __init__(self, manipulator, new_data, errors, rating_choices): 
    226                 forms.FormWrapper.__init__(self, manipulator, new_data, errors) 
     226                oldforms.FormWrapper.__init__(self, manipulator, new_data, errors) 
    227227                self.rating_choices = rating_choices 
    228228            def ratings(self): 
     
    303303        return render_to_response('comments/free_preview.html', { 
    304304            'comment': comment, 
    305             'comment_form': forms.FormWrapper(manipulator, new_data, errors), 
     305            'comment_form': oldforms.FormWrapper(manipulator, new_data, errors), 
    306306            'options': options, 
    307307            'target': target, 
  • django/branches/generic-auth/django/contrib/csrf/middleware.py

    r2900 r4255  
    1212import itertools 
    1313 
    14 _ERROR_MSG = "<h1>403 Forbidden</h1><p>Cross Site Request Forgery detected.  Request aborted.</p>" 
     14_ERROR_MSG = '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><body><h1>403 Forbidden</h1><p>Cross Site Request Forgery detected. Request aborted.</p></body></html>' 
    1515 
    1616_POST_FORM_RE = \ 
  • django/branches/generic-auth/django/core/handlers/base.py

    r4149 r4255  
    6161                return response 
    6262 
    63         resolver = urlresolvers.RegexURLResolver(r'^/', settings.ROOT_URLCONF) 
     63        # Get urlconf from request object, if available.  Otherwise use default. 
     64        urlconf = getattr(request, "urlconf", settings.ROOT_URLCONF) 
     65 
     66        resolver = urlresolvers.RegexURLResolver(r'^/', urlconf) 
    6467        try: 
    6568            callback, callback_args, callback_kwargs = resolver.resolve(request.path) 
  • django/branches/generic-auth/django/db/backends/postgresql/base.py

    r4063 r4255  
    2020    # Import copy of _thread_local.py from Python 2.4 
    2121    from django.utils._threading_local import local 
     22 
     23def smart_basestring(s, charset): 
     24    if isinstance(s, unicode): 
     25        return s.encode(charset) 
     26    return s 
     27 
     28class UnicodeCursorWrapper(object): 
     29    """ 
     30    A thin wrapper around psycopg cursors that allows them to accept Unicode 
     31    strings as params. 
     32 
     33    This is necessary because psycopg doesn't apply any DB quoting to 
     34    parameters that are Unicode strings. If a param is Unicode, this will 
     35    convert it to a bytestring using DEFAULT_CHARSET before passing it to 
     36    psycopg. 
     37    """ 
     38    def __init__(self, cursor, charset): 
     39        self.cursor = cursor 
     40        self.charset = charset 
     41 
     42    def execute(self, sql, params=()): 
     43        return self.cursor.execute(sql, [smart_basestring(p, self.charset) for p in params]) 
     44 
     45    def executemany(self, sql, param_list): 
     46        new_param_list = [[smart_basestring(p, self.charset) for p in params] for params in param_list] 
     47        return self.cursor.executemany(sql, new_param_list) 
     48 
     49    def __getattr__(self, attr): 
     50        if self.__dict__.has_key(attr): 
     51            return self.__dict__[attr] 
     52        else: 
     53            return getattr(self.cursor, attr) 
    2254 
    2355class DatabaseWrapper(local): 
     
    4678        cursor = self.connection.cursor() 
    4779        cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) 
     80        cursor = UnicodeCursorWrapper(cursor, settings.DEFAULT_CHARSET) 
    4881        if settings.DEBUG: 
    4982            return util.CursorDebugWrapper(cursor, self) 
     
    119152    Database.register_type(Database.new_type((1082,), "DATE", util.typecast_date)) 
    120153except AttributeError: 
    121     raise Exception, "You appear to be using psycopg version 2, which isn't supported yet, because it's still in beta. Use psycopg version 1 instead: http://initd.org/projects/psycopg1
     154    raise Exception, "You appear to be using psycopg version 2. Set your DATABASE_ENGINE to 'postgresql_psycopg2' instead of 'postgresql'.
    122155Database.register_type(Database.new_type((1083,1266), "TIME", util.typecast_time)) 
    123156Database.register_type(Database.new_type((1114,1184), "TIMESTAMP", util.typecast_timestamp)) 
  • django/branches/generic-auth/django/db/models/fields/generic.py

    r4026 r4255  
    33""" 
    44 
    5 from django import forms 
     5from django import oldforms 
    66from django.core.exceptions import ObjectDoesNotExist 
    77from django.db import backend 
     
    9999    def get_manipulator_field_objs(self): 
    100100        choices = self.get_choices_default() 
    101         return [curry(forms.SelectMultipleField, size=min(max(len(choices), 5), 15), choices=choices)] 
     101        return [curry(oldforms.SelectMultipleField, size=min(max(len(choices), 5), 15), choices=choices)] 
    102102 
    103103    def get_choices_default(self): 
  • django/branches/generic-auth/django/db/models/fields/__init__.py

    r4149 r4255  
    33from django.conf import settings 
    44from django.core import validators 
    5 from django import forms 
     5from django import oldforms 
     6from django import newforms as forms 
    67from django.core.exceptions import ObjectDoesNotExist 
    78from django.utils.functional import curry 
     
    207208        if self.choices: 
    208209            if self.radio_admin: 
    209                 field_objs = [forms.RadioSelectField] 
     210                field_objs = [oldforms.RadioSelectField] 
    210211                params['ul_class'] = get_ul_class(self.radio_admin) 
    211212            else: 
    212                 field_objs = [forms.SelectField] 
     213                field_objs = [oldforms.SelectField] 
    213214 
    214215            params['choices'] = self.get_choices_default() 
     
    219220    def get_manipulator_fields(self, opts, manipulator, change, name_prefix='', rel=False, follow=True): 
    220221        """ 
    221         Returns a list of forms.FormField instances for this field. It 
     222        Returns a list of oldforms.FormField instances for this field. It 
    222223        calculates the choices at runtime, not at compile time. 
    223224 
     
    334335    choices = property(_get_choices) 
    335336 
     337    def formfield(self, initial=None): 
     338        "Returns a django.newforms.Field instance for this database Field." 
     339        # TODO: This is just a temporary default during development. 
     340        return forms.CharField(required=not self.blank, label=capfirst(self.verbose_name), initial=initial) 
     341 
     342    def value_from_object(self, obj): 
     343        "Returns the value of this field in the given model instance." 
     344        return getattr(obj, self.attname) 
     345 
    336346class AutoField(Field): 
    337347    empty_strings_allowed = False 
     
    355365 
    356366    def get_manipulator_field_objs(self): 
    357         return [forms.HiddenField] 
     367        return [oldforms.HiddenField] 
    358368 
    359369    def get_manipulator_new_data(self, new_data, rel=False): 
     
    370380        cls._meta.has_auto_field = True 
    371381 
     382    def formfield(self, initial=None): 
     383        return None 
     384 
    372385class BooleanField(Field): 
    373386    def __init__(self, *args, **kwargs): 
     
    382395 
    383396    def get_manipulator_field_objs(self): 
    384         return [forms.CheckboxField] 
     397        return [oldforms.CheckboxField] 
     398 
     399    def formfield(self, initial=None): 
     400        return forms.BooleanField(required=not self.blank, label=capfirst(self.verbose_name), initial=initial) 
    385401 
    386402class CharField(Field): 
    387403    def get_manipulator_field_objs(self): 
    388         return [forms.TextField] 
     404        return [oldforms.TextField] 
    389405 
    390406    def to_python(self, value): 
     
    398414        return str(value) 
    399415 
     416    def formfield(self, initial=None): 
     417        return forms.CharField(max_length=self.maxlength, required=not self.blank, label=capfirst(self.verbose_name), initial=initial) 
     418 
    400419# TODO: Maybe move this into contrib, because it's specialized. 
    401420class CommaSeparatedIntegerField(CharField): 
    402421    def get_manipulator_field_objs(self): 
    403         return [forms.CommaSeparatedIntegerField] 
     422        return [oldforms.CommaSeparatedIntegerField] 
    404423 
    405424class DateField(Field): 
     
    463482 
    464483    def get_manipulator_field_objs(self): 
    465         return [forms.DateField] 
    466  
    467     def flatten_data(self, follow, obj = None): 
     484        return [oldforms.DateField] 
     485 
     486    def flatten_data(self, follow, obj=None): 
    468487        val = self._get_val_from_obj(obj) 
    469488        return {self.attname: (val is not None and val.strftime("%Y-%m-%d") or '')} 
     489 
     490    def formfield(self, initial=None): 
     491        return forms.DateField(required=not self.blank, label=capfirst(self.verbose_name), initial=initial) 
    470492 
    471493class DateTimeField(DateField): 
     
    504526 
    505527    def get_manipulator_field_objs(self): 
    506         return [forms.DateField, forms.TimeField] 
     528        return [oldforms.DateField, oldforms.TimeField] 
    507529 
    508530    def get_manipulator_field_names(self, name_prefix): 
     
    527549                time_field: (val is not None and val.strftime("%H:%M:%S") or '')} 
    528550 
     551    def formfield(self, initial=None): 
     552        return forms.DateTimeField(required=not self.blank, label=capfirst(self.verbose_name), initial=initial) 
     553 
    529554class EmailField(CharField): 
    530555    def __init__(self, *args, **kwargs): 
     
    536561 
    537562    def get_manipulator_field_objs(self): 
    538         return [forms.EmailField] 
     563        return [oldforms.EmailField] 
    539564 
    540565    def validate(self, field_data, all_data): 
    541566        validators.isValidEmail(field_data, all_data) 
     567 
     568    def formfield(self, initial=None): 
     569        return forms.EmailField(required=not self.blank, label=capfirst(self.verbose_name), initial=initial) 
    542570 
    543571class FileField(Field): 
     
    600628 
    601629    def get_manipulator_field_objs(self): 
    602         return [forms.FileUploadField, forms.HiddenField] 
     630        return [oldforms.FileUploadField, oldforms.HiddenField] 
    603631 
    604632    def get_manipulator_field_names(self, name_prefix): 
     
    628656 
    629657    def get_manipulator_field_objs(self): 
    630         return [curry(forms.FilePathField, path=self.path, match=self.match, recursive=self.recursive)] 
     658        return [curry(oldforms.FilePathField, path=self.path, match=self.match, recursive=self.recursive)] 
    631659 
    632660class FloatField(Field): 
     
    637665 
    638666    def get_manipulator_field_objs(self): 
    639         return [curry(forms.FloatField, max_digits=self.max_digits, decimal_places=self.decimal_places)] 
     667        return [curry(oldforms.FloatField, max_digits=self.max_digits, decimal_places=self.decimal_places)] 
    640668 
    641669class ImageField(FileField): 
     
    645673 
    646674    def get_manipulator_field_objs(self): 
    647         return [forms.ImageUploadField, forms.HiddenField] 
     675        return [oldforms.ImageUploadField, oldforms.HiddenField] 
    648676 
    649677    def contribute_to_class(self, cls, name): 
     
    671699    empty_strings_allowed = False 
    672700    def get_manipulator_field_objs(self): 
    673         return [forms.IntegerField] 
     701        return [oldforms.IntegerField] 
     702 
     703    def formfield(self, initial=None): 
     704        return forms.IntegerField(required=not self.blank, label=capfirst(self.verbose_name), initial=initial) 
    674705 
    675706class IPAddressField(Field): 
     
    679710 
    680711    def get_manipulator_field_objs(self): 
    681         return [forms.IPAddressField] 
     712        return [oldforms.IPAddressField] 
    682713 
    683714    def validate(self, field_data, all_data): 
     
    690721 
    691722    def get_manipulator_field_objs(self): 
    692         return [forms.NullBooleanField] 
     723        return [oldforms.NullBooleanField] 
    693724 
    694725class PhoneNumberField(IntegerField): 
    695726    def get_manipulator_field_objs(self): 
    696         return [forms.PhoneNumberField] 
     727        return [oldforms.PhoneNumberField] 
    697728 
    698729    def validate(self, field_data, all_data): 
     
    701732class PositiveIntegerField(IntegerField): 
    702733    def get_manipulator_field_objs(self): 
    703         return [forms.PositiveIntegerField] 
     734        return [oldforms.PositiveIntegerField] 
    704735 
    705736class PositiveSmallIntegerField(IntegerField): 
    706737    def get_manipulator_field_objs(self): 
    707         return [forms.PositiveSmallIntegerField] 
     738        return [oldforms.PositiveSmallIntegerField] 
    708739 
    709740class SlugField(Field): 
     
    717748 
    718749    def get_manipulator_field_objs(self): 
    719         return [forms.TextField] 
     750        return [oldforms.TextField] 
    720751 
    721752class SmallIntegerField(IntegerField): 
    722753    def get_manipulator_field_objs(self): 
    723         return [forms.SmallIntegerField] 
     754        return [oldforms.SmallIntegerField] 
    724755 
    725756class TextField(Field): 
    726757    def get_manipulator_field_objs(self): 
    727         return [forms.LargeTextField] 
     758        return [oldforms.LargeTextField] 
    728759 
    729760class TimeField(Field): 
     
    761792 
    762793    def get_manipulator_field_objs(self): 
    763         return [forms.TimeField] 
     794        return [oldforms.TimeField] 
    764795 
    765796    def flatten_data(self,follow, obj = None): 
    766797        val = self._get_val_from_obj(obj) 
    767798        return {self.attname: (val is not None and val.strftime("%H:%M:%S") or '')} 
     799 
     800    def formfield(self, initial=None): 
     801        return forms.TimeField(required=not self.blank, label=capfirst(self.verbose_name), initial=initial) 
    768802 
    769803class URLField(Field): 
     
    771805        if verify_exists: 
    772806            kwargs.setdefault('validator_list', []).append(validators.isExistingURL) 
     807        self.verify_exists = verify_exists 
    773808        Field.__init__(self, verbose_name, name, **kwargs) 
    774809 
    775810    def get_manipulator_field_objs(self): 
    776         return [forms.URLField] 
     811        return [oldforms.URLField] 
     812 
     813    def formfield(self, initial=None): 
     814        return forms.URLField(required=not self.blank, verify_exists=self.verify_exists, label=capfirst(self.verbose_name), initial=initial) 
    777815 
    778816class USStateField(Field): 
    779817    def get_manipulator_field_objs(self): 
    780         return [forms.USStateField] 
     818        return [oldforms.USStateField] 
    781819 
    782820class XMLField(TextField): 
     
    789827 
    790828    def get_manipulator_field_objs(self): 
    791         return [curry(forms.XMLLargeTextField, schema_path=self.schema_path)] 
     829        return [curry(oldforms.XMLLargeTextField, schema_path=self.schema_path)] 
    792830 
    793831class OrderingField(IntegerField): 
     
    802840 
    803841    def get_manipulator_fields(self, opts, manipulator, change, name_prefix='', rel=False, follow=True): 
    804         return [forms.HiddenField(name_prefix + self.name)] 
     842        return [oldforms.HiddenField(name_prefix + self.name)]