~ubuntu-branches/ubuntu/quantal/python-django/quantal-security

« back to all changes in this revision

Viewing changes to django/forms/forms.py

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2010-10-12 11:34:35 UTC
  • mfrom: (1.2.7 upstream)
  • mto: This revision was merged to the branch mainline in revision 30.
  • Revision ID: james.westby@ubuntu.com-20101012113435-9lnsrh0i3mxozbt0
Tags: upstream-1.2.3
ImportĀ upstreamĀ versionĀ 1.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
NON_FIELD_ERRORS = '__all__'
19
19
 
20
20
def pretty_name(name):
21
 
    """Converts 'first_name' to 'First name'""" 
22
 
    if not name: 
23
 
        return u'' 
24
 
    return name.replace('_', ' ').capitalize() 
 
21
    """Converts 'first_name' to 'First name'"""
 
22
    if not name:
 
23
        return u''
 
24
    return name.replace('_', ' ').capitalize()
25
25
 
26
26
def get_declared_fields(bases, attrs, with_base_fields=True):
27
27
    """
423
423
        """
424
424
        if not widget:
425
425
            widget = self.field.widget
 
426
 
426
427
        attrs = attrs or {}
427
428
        auto_id = self.auto_id
428
429
        if auto_id and 'id' not in attrs and 'id' not in widget.attrs:
430
431
                attrs['id'] = auto_id
431
432
            else:
432
433
                attrs['id'] = self.html_initial_id
 
434
 
433
435
        if not self.form.is_bound:
434
436
            data = self.form.initial.get(self.name, self.field.initial)
435
437
            if callable(data):
439
441
                data = self.form.initial.get(self.name, self.field.initial)
440
442
            else:
441
443
                data = self.data
 
444
        data = self.field.prepare_value(data)
 
445
 
442
446
        if not only_initial:
443
447
            name = self.html_name
444
448
        else: