Django

Code

Ticket #6092: 6092-docs.diff

File 6092-docs.diff, 3.0 kB (added by floguy, 1 year ago)

Adds documentation to my previous patch.

  • docs/newforms.txt

    old new  
    13111311      moderately complex regular expression. 
    13121312    * Error message keys: ``required``, ``invalid`` 
    13131313 
    1314 Has two optional arguments for validation, ``max_length`` and ``min_length``. 
    1315 If provided, these arguments ensure that the string is at most or at least the 
    1316 given length. 
    13171314 
     1315Also takes the following optional arguments: 
     1316    ======================  ===================================================== 
     1317    Argument                Description 
     1318    ======================  ===================================================== 
     1319    ``max_length``          Ensures the string has at most this many characters. 
     1320    ``min_length``          Ensures the string has at least this many characters. 
     1321    ``pattern``             A compiled regex or string which will be used instead 
     1322                            of the default email validation regular expression. 
     1323    ======================  ===================================================== 
     1324 
    13181325``FileField`` 
    13191326~~~~~~~~~~~~~ 
    13201327 
     
    14781485    ``validator_user_agent``  String used as the user-agent used when checking for 
    14791486                              a URL's existence. Defaults to the value of the 
    14801487                              ``URL_VALIDATOR_USER_AGENT`` setting. 
     1488    ``pattern``               A compiled regex or string which will be used instead 
     1489                              of the default url validation regular expression. 
    14811490    ========================  ===================================================== 
    14821491 
    14831492Slightly complex built-in ``Field`` classes 
  • docs/model-api.txt

    old new  
    227227automatically set to 75. In the Django development version, ``max_length`` is 
    228228set to 75 by default, but you can specify it to override default behavior. 
    229229 
     230It also accepts ``pattern``, which is a compiled regex or string which will be  
     231used instead of the default email validation regular expression pattern. 
     232 
    230233``FileField`` 
    231234~~~~~~~~~~~~~ 
    232235 
     
    468471 
    469472The admin represents this as an ``<input type="text">`` (a single-line input). 
    470473 
    471 ``URLField`` takes an optional argument, ``max_length``, the maximum length (in 
    472 characters) of the field. The maximum length is enforced at the database level and 
    473 in Django's validation. If you don't specify ``max_length``, a default of 200 
     474``URLField`` takes two optional arguments.  The first is ``max_length``, the maximum  
     475length (in characters) of the field. The maximum length is enforced at the database  
     476level and in Django's validation. If you don't specify ``max_length``, a default of 200 
    474477is used. 
    475478 
     479The second is ``pattern``, which is a compiled regex or string which will be used instead 
     480of the default url validation regular expression pattern. 
     481 
    476482``USStateField`` 
    477483~~~~~~~~~~~~~~~~ 
    478484