Django

Code

Changeset 4962

Show
Ignore:
Timestamp:
04/08/07 20:33:23 (2 years ago)
Author:
adrian
Message:

newforms-admin: Merged to [4961]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/newforms-admin

    • Property svnmerge-integrated changed from /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-4945 to /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-4961
  • django/branches/newforms-admin/AUTHORS

    r4940 r4962  
    8989    Marc Fargas <telenieko@telenieko.com> 
    9090    favo@exoweb.net 
     91    Matthew Flanagan <http://wadofstuff.blogspot.com> 
    9192    Eric Floehr <eric@intellovations.com> 
    9293    Jorge Gajon <gajon@gajon.org> 
  • django/branches/newforms-admin/django/db/models/fields/__init__.py

    r4824 r4962  
    764764 
    765765    def formfield(self, **kwargs): 
    766         from django.contrib.localflavor.usa.forms import USPhoneNumberField 
     766        from django.contrib.localflavor.us.forms import USPhoneNumberField 
    767767        defaults = {'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text} 
    768768        defaults.update(kwargs) 
  • django/branches/newforms-admin/django/newforms/widgets.py

    r4940 r4962  
    122122 
    123123class Textarea(Widget): 
     124    def __init__(self, attrs=None): 
     125        # The 'rows' and 'cols' attributes are required for HTML correctness. 
     126        self.attrs = {'cols': '40', 'rows': '10'} 
     127        if attrs: 
     128            self.attrs.update(attrs) 
     129 
    124130    def render(self, name, value, attrs=None): 
    125131        if value is None: value = '' 
  • django/branches/newforms-admin/django/views/debug.py

    r4265 r4962  
    145145    c = Context({ 
    146146        'root_urlconf': settings.ROOT_URLCONF, 
     147        'request_path': request.path[1:], # Trim leading slash 
    147148        'urlpatterns': tried, 
    148149        'reason': str(exception), 
     
    592593        {% endfor %} 
    593594      </ol> 
    594       <p>The current URL, <code>{{ request.path|escape }}</code>, didn't match any of these.</p> 
     595      <p>The current URL, <code>{{ request_path|escape }}</code>, didn't match any of these.</p> 
    595596    {% else %} 
    596597      <p>{{ reason|escape }}</p> 
  • django/branches/newforms-admin/docs/documentation.txt

    r3561 r4962  
    4343The most recent version of the Django documentation lives at 
    4444http://www.djangoproject.com/documentation/ . These HTML pages are generated 
    45 automatically from the text files in source control every 15 minutes. Tha
    46 means they reflect the "latest and greatest" in Django -- they include the very 
    47 latest corrections and additions, and they discuss the latest Django features, 
     45automatically from the text files in source control. That means they reflec
     46the "latest and greatest" in Django -- they include the very latest 
     47corrections and additions, and they discuss the latest Django features, 
    4848which may only be available to users of the Django development version. (See 
    4949"Differences between versions" below.) 
    5050 
    51 A key advantage of the Web-based documentation is the comment section at the 
    52 bottom of each document. This is an area for anybody to submit changes, 
    53 corrections and suggestions about the given document. The Django developers 
    54 frequently monitor the comments there and use them to improve the documentation 
    55 for everybody. 
     51We encourage you to help improve the docs by submitting changes, corrections 
     52and suggestions in the `ticket system`_. The Django developers actively monitor 
     53the ticket system and use your feedback to improve the documentation for 
     54everybody. 
    5655 
    57 We encourage you to help improve the docs: it's easy! Note, however, that 
    58 comments should explicitly relate to the documentation, rather than asking 
    59 broad tech-support questions. If you need help with your particular Django 
    60 setup, try the `django-users mailing list`_ instead of posting a comment to the 
    61 documentation. 
     56Note, however, that tickets should explicitly relate to the documentation, 
     57rather than asking broad tech-support questions. If you need help with your 
     58particular Django setup, try the `django-users mailing list`_ or the 
     59`#django IRC channel`_ instead. 
    6260 
     61.. _ticket system: http://code.djangoproject.com/simpleticket?component=Documentation 
    6362.. _django-users mailing list: http://groups.google.com/group/django-users 
     63.. _#django IRC channel: irc://irc.freenode.net/django 
    6464 
    6565In plain text 
     
    135135      and links to the current version of that document. 
    136136 
    137     * Once a document is frozen for a Django release, we remove comments from 
    138       that page, in favor of having comments on the latest version of that 
    139       document. This is for the sake of maintainability and usability, so that 
    140       users have one, and only one, place to leave comments on a particular 
    141       document. We realize that some people may be stuck on a previous version 
    142       of Django, but we believe the usability problems with multiple versions 
    143       of a document the outweigh the benefits. 
    144  
    145137    * The `main documentation Web page`_ includes links to documentation for 
    146138      all previous versions. 
  • django/branches/newforms-admin/docs/modpython.txt

    r4940 r4962  
    5858.. caution:: 
    5959 
    60     Is you are using Windows, remember that the path will contain backslashes. 
     60    If you're using Windows, remember that the path will contain backslashes. 
    6161    This string is passed through Python's string parser twice, so you need to 
    6262    escape each backslash **twice**:: 
     
    6464        PythonPath "['c:\\\\path\\\\to\\\\project'] + sys.path" 
    6565 
    66     or use raw strings:: 
     66    Or, use raw strings:: 
    6767 
    6868        PythonPath "[r'c:\\path\\to\\project'] + sys.path" 
    69  
    7069 
    7170You can also add directives such as ``PythonAutoReload Off`` for performance. 
     
    162161particular part of the site:: 
    163162 
    164     <Location "/media/"> 
     163    <Location "/media"> 
    165164        SetHandler None 
    166165    </Location> 
     
    179178    </Location> 
    180179 
    181     <Location "media"> 
     180    <Location "/media"> 
    182181        SetHandler None 
    183182    </Location> 
  • django/branches/newforms-admin/docs/request_response.txt

    r4940 r4962  
    484484called ``404.html`` and located in the top level of your template tree. 
    485485 
    486 Customing error views 
    487 --------------------- 
     486Customizing error views 
     487----------------------- 
    488488 
    489489The 404 (page not found) view 
  • django/branches/newforms-admin/tests/modeltests/model_forms/models.py

    r4824 r4962  
    160160<option value="2">Bob Woodward</option> 
    161161</select></td></tr> 
    162 <tr><th>Article:</th><td><textarea name="article"></textarea></td></tr> 
     162<tr><th>Article:</th><td><textarea rows="10" cols="40" name="article"></textarea></td></tr> 
    163163<tr><th>Categories:</th><td><select multiple="multiple" name="categories"> 
    164164<option value="1">Entertainment</option> 
     
    200200<option value="2">Bob Woodward</option> 
    201201</select></li> 
    202 <li>Article: <textarea name="article">Hello.</textarea></li> 
     202<li>Article: <textarea rows="10" cols="40" name="article">Hello.</textarea></li> 
    203203<li>Categories: <select multiple="multiple" name="categories"> 
    204204<option value="1">Entertainment</option> 
     
    232232<option value="2">Bob Woodward</option> 
    233233</select></li> 
    234 <li>Article: <textarea name="article">Hello.</textarea></li> 
     234<li>Article: <textarea rows="10" cols="40" name="article">Hello.</textarea></li> 
    235235<li>Categories: <select multiple="multiple" name="categories"> 
    236236<option value="1" selected="selected">Entertainment</option> 
     
    310310<option value="2">Bob Woodward</option> 
    311311</select></li> 
    312 <li>Article: <textarea name="article"></textarea></li> 
     312<li>Article: <textarea rows="10" cols="40" name="article"></textarea></li> 
    313313<li>Categories: <select multiple="multiple" name="categories"> 
    314314<option value="1">Entertainment</option> 
     
    329329<option value="3">Carl Bernstein</option> 
    330330</select></li> 
    331 <li>Article: <textarea name="article"></textarea></li> 
     331<li>Article: <textarea rows="10" cols="40" name="article"></textarea></li> 
    332332<li>Categories: <select multiple="multiple" name="categories"> 
    333333<option value="1">Entertainment</option> 
  • django/branches/newforms-admin/tests/regressiontests/forms/localflavor.py

    r4940 r4962  
    77USZipCodeField validates that the data is either a five-digit U.S. zip code or 
    88a zip+4. 
    9 >>> from django.contrib.localflavor.usa.forms import USZipCodeField 
     9>>> from django.contrib.localflavor.us.forms import USZipCodeField 
    1010>>> f = USZipCodeField() 
    1111>>> f.clean('60606') 
     
    6868USPhoneNumberField validates that the data is a valid U.S. phone number, 
    6969including the area code. It's normalized to XXX-XXX-XXXX format. 
    70 >>> from django.contrib.localflavor.usa.forms import USPhoneNumberField 
     70>>> from django.contrib.localflavor.us.forms import USPhoneNumberField 
    7171>>> f = USPhoneNumberField() 
    7272>>> f.clean('312-555-1212') 
     
    137137USStateField validates that the data is either an abbreviation or name of a 
    138138U.S. state. 
    139 >>> from django.contrib.localflavor.usa.forms import USStateField 
     139>>> from django.contrib.localflavor.us.forms import USStateField 
    140140>>> f = USStateField() 
    141141>>> f.clean('il') 
     
    182182USStateSelect is a Select widget that uses a list of U.S. states/territories 
    183183as its choices. 
    184 >>> from django.contrib.localflavor.usa.forms import USStateSelect 
     184>>> from django.contrib.localflavor.us.forms import USStateSelect 
    185185>>> w = USStateSelect() 
    186186>>> print w.render('state', 'IL') 
     
    248248 
    249249# USSocialSecurityNumberField ################################################# 
    250 >>> from django.contrib.localflavor.usa.forms import USSocialSecurityNumberField 
     250>>> from django.contrib.localflavor.us.forms import USSocialSecurityNumberField 
    251251>>> f = USSocialSecurityNumberField() 
    252252>>> f.clean('987-65-4330') 
     
    883883... 
    884884ValidationError: [u'Enter a valid German identity card number in XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.'] 
     885 
     886## AUPostCodeField ########################################################## 
     887 
     888A field that accepts a four digit Australian post code. 
     889 
     890>>> from django.contrib.localflavor.au.forms import AUPostCodeField 
     891>>> f = AUPostCodeField() 
     892>>> f.clean('1234') 
     893u'1234' 
     894>>> f.clean('2000') 
     895u'2000' 
     896>>> f.clean('abcd') 
     897Traceback (most recent call last): 
     898... 
     899ValidationError: [u'Enter a 4 digit post code.'] 
     900>>> f.clean('20001') 
     901Traceback (most recent call last): 
     902... 
     903ValidationError: [u'Enter a 4 digit post code.'] 
     904>>> f.clean(None) 
     905Traceback (most recent call last): 
     906... 
     907ValidationError: [u'This field is required.'] 
     908>>> f.clean('') 
     909Traceback (most recent call last): 
     910... 
     911ValidationError: [u'This field is required.'] 
     912 
     913>>> f = AUPostCodeField(required=False) 
     914>>> f.clean('1234') 
     915u'1234' 
     916>>> f.clean('2000') 
     917u'2000' 
     918>>> f.clean('abcd') 
     919Traceback (most recent call last): 
     920... 
     921ValidationError: [u'Enter a 4 digit post code.'] 
     922>>> f.clean('20001') 
     923Traceback (most recent call last): 
     924... 
     925ValidationError: [u'Enter a 4 digit post code.'] 
     926>>> f.clean(None) 
     927u'' 
     928>>> f.clean('') 
     929u'' 
     930 
     931## AUPhoneNumberField ######################################################## 
     932 
     933A field that accepts a 10 digit Australian phone number. 
     934llows spaces and parentheses around area code. 
     935 
     936>>> from django.contrib.localflavor.au.forms import AUPhoneNumberField 
     937>>> f = AUPhoneNumberField() 
     938>>> f.clean('1234567890') 
     939u'1234567890' 
     940>>> f.clean('0213456789') 
     941u'0213456789' 
     942>>> f.clean('02 13 45 67 89') 
     943u'0213456789' 
     944>>> f.clean('(02) 1345 6789') 
     945u'0213456789' 
     946>>> f.clean('(02) 1345-6789') 
     947u'0213456789' 
     948>>> f.clean('(02)1345-6789') 
     949u'0213456789' 
     950>>> f.clean('0408 123 456') 
     951u'0408123456' 
     952>>> f.clean('123') 
     953Traceback (most recent call last): 
     954... 
     955ValidationError: [u'Phone numbers must contain 10 digits.'] 
     956>>> f.clean('1800DJANGO') 
     957Traceback (most recent call last): 
     958... 
     959ValidationError: [u'Phone numbers must contain 10 digits.'] 
     960>>> f.clean(None) 
     961Traceback (most recent call last): 
     962... 
     963ValidationError: [u'This field is required.'] 
     964>>> f.clean('') 
     965Traceback (most recent call last): 
     966... 
     967ValidationError: [u'This field is required.'] 
     968 
     969>>> f = AUPhoneNumberField(required=False) 
     970>>> f.clean('1234567890') 
     971u'1234567890' 
     972>>> f.clean('0213456789') 
     973u'0213456789' 
     974>>> f.clean('02 13 45 67 89') 
     975u'0213456789' 
     976>>> f.clean('(02) 1345 6789') 
     977u'0213456789' 
     978>>> f.clean('(02) 1345-6789') 
     979u'0213456789' 
     980>>> f.clean('(02)1345-6789') 
     981u'0213456789' 
     982>>> f.clean('0408 123 456') 
     983u'0408123456' 
     984>>> f.clean('123') 
     985Traceback (most recent call last): 
     986... 
     987ValidationError: [u'Phone numbers must contain 10 digits.'] 
     988>>> f.clean('1800DJANGO') 
     989Traceback (most recent call last): 
     990... 
     991ValidationError: [u'Phone numbers must contain 10 digits.'] 
     992>>> f.clean(None) 
     993u'' 
     994>>> f.clean('') 
     995u'' 
     996 
     997## AUStateSelect ############################################################# 
     998 
     999AUStateSelect is a Select widget that uses a list of Australian 
     1000states/territories as its choices. 
     1001 
     1002>>> from django.contrib.localflavor.au.forms import AUStateSelect 
     1003>>> f = AUStateSelect() 
     1004>>> print f.render('state', 'NSW') 
     1005<select name="state"> 
     1006<option value="ACT">Australian Capital Territory</option> 
     1007<option value="NSW" selected="selected">New South Wales</option> 
     1008<option value="NT">Northern Territory</option> 
     1009<option value="QLD">Queensland</option> 
     1010<option value="SA">South Australia</option> 
     1011<option value="TAS">Tasmania</option> 
     1012<option value="VIC">Victoria</option> 
     1013<option value="WA">Western Australia</option> 
     1014</select> 
    8851015""" 
  • django/branches/newforms-admin/tests/regressiontests/forms/tests.py

    r4953 r4962  
    195195>>> w = Textarea() 
    196196>>> w.render('msg', '') 
    197 u'<textarea name="msg"></textarea>' 
     197u'<textarea rows="10" cols="40" name="msg"></textarea>' 
    198198>>> w.render('msg', None) 
    199 u'<textarea name="msg"></textarea>' 
     199u'<textarea rows="10" cols="40" name="msg"></textarea>' 
    200200>>> w.render('msg', 'value') 
    201 u'<textarea name="msg">value</textarea>' 
     201u'<textarea rows="10" cols="40" name="msg">value</textarea>' 
    202202>>> w.render('msg', 'some "quoted" & ampersanded value') 
    203 u'<textarea name="msg">some &quot;quoted&quot; &amp; ampersanded value</textarea>' 
    204 >>> w.render('msg', 'value', attrs={'class': 'pretty'}) 
    205 u'<textarea name="msg" class="pretty">value</textarea>' 
     203u'<textarea rows="10" cols="40" name="msg">some &quot;quoted&quot; &amp; ampersanded value</textarea>' 
     204>>> w.render('msg', 'value', attrs={'class': 'pretty', 'rows': 20}) 
     205u'<textarea class="pretty" rows="20" cols="40" name="msg">value</textarea>' 
    206206 
    207207You can also pass 'attrs' to the constructor: 
    208208>>> w = Textarea(attrs={'class': 'pretty'}) 
    209209>>> w.render('msg', '') 
    210 u'<textarea class="pretty" name="msg"></textarea>' 
     210u'<textarea rows="10" cols="40" name="msg" class="pretty"></textarea>' 
    211211>>> w.render('msg', 'example') 
    212 u'<textarea class="pretty" name="msg">example</textarea>' 
     212u'<textarea rows="10" cols="40" name="msg" class="pretty">example</textarea>' 
    213213 
    214214'attrs' passed to render() get precedence over those passed to the constructor: 
    215215>>> w = Textarea(attrs={'class': 'pretty'}) 
    216216>>> w.render('msg', '', attrs={'class': 'special'}) 
    217 u'<textarea class="special" name="msg"></textarea>' 
     217u'<textarea rows="10" cols="40" name="msg" class="special"></textarea>' 
    218218 
    219219>>> w.render('msg', 'ŠĐĆŽćžšđ', attrs={'class': 'fun'}) 
    220 u'<textarea class="fun" name="msg">\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111</textarea>' 
     220u'<textarea rows="10" cols="40" name="msg" class="fun">\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111</textarea>' 
    221221 
    222222# CheckboxInput Widget ######################################################## 
     
    19681968<input type="text" name="subject" /> 
    19691969>>> print f['message'] 
    1970 <textarea name="message"></textarea> 
     1970<textarea rows="10" cols="40" name="message"></textarea> 
    19711971 
    19721972as_textarea(), as_text() and as_hidden() are shortcuts for changing the output 
    19731973widget type: 
    19741974>>> f['subject'].as_textarea() 
    1975 u'<textarea name="subject"></textarea>' 
     1975u'<textarea rows="10" cols="40" name="subject"></textarea>' 
    19761976>>> f['message'].as_text() 
    19771977u'<input type="text" name="message" />' 
     
    19931993>>> f = ContactForm({'subject': 'Hello', 'message': 'I love you.'}, auto_id=False) 
    19941994>>> f['subject'].as_textarea() 
    1995 u'<textarea name="subject">Hello</textarea>' 
     1995u'<textarea rows="10" cols="40" name="subject">Hello</textarea>' 
    19961996>>> f['message'].as_text() 
    19971997u'<input type="text" name="message" value="I love you." />'