Tim Savage avatar Tim Savage committed 9fbbd5f Draft

Updated documentation, cleanup for PEP8

Updated documentation to include most of the new editions to the library. Changes based on proof read of documentation. Corrected test case, there appears to be differences in date/time formatting between different versions of python. May need to add in checks.

Comments (0)

Files changed (8)

django_extras/db/models/fields/__init__.py

 class LatitudeField(models.FloatField):
     """Latitude field
 
-    Ensures value is in hte range (-90)-90.
+    Ensures value is in the range (-90)-90.
     """
     def __init__(self, *args, **kwargs):
         kwargs.setdefault('validators', [
 class LongitudeField(models.FloatField):
     """Longitude field
 
-    Ensures value is in hte range (-180)-180.
+    Ensures value is in the range (-180)-180.
     """
     def __init__(self, *args, **kwargs):
         kwargs.setdefault('validators', [

django_extras/tests/http/responses.py

         })
 
         actual = ''.join(target)
-        self.assertEqual('{"foo": "bar", "eek": "2012-06-25 11:09:48"}', actual)
+        self.assertEqual('{"foo": "bar", "eek": "2012-06-25T11:09:48"}', actual)
         self.assertEqual('application/json', target['Content-Type'])

django_extras/utils/cache.py

         key += ':' + postfix
     return key
 
+
 def generate_key(instance_or_type, *args, **kwargs):
     """
     Generate a cache/no-sql key based from a model instance or type.
     field_names.append('pk')
     for field in kwargs.iterkeys():
         if field not in field_names:
-            raise AttributeError('Model "%s" has no field "%s".' % (instance_or_type._meta.module_name, field))
+            raise AttributeError('Model "%s" has no field "%s".' % (
+                instance_or_type._meta.module_name, field))
     return _generate_key(instance_or_type, kwargs.items(), '-'.join(args))
 
+
 def instance_key(instance, fields=None, postfix=None):
     """
     Generate a cache/no-sql key based from a model instance.

docs/ref/forms/fields.txt

+====================
+Form field reference
+====================
+
+.. module:: django_extras.forms.fields
+   :synopsis: Additional field types.
+
+
+Field types
+===========
+
+.. currentmodule:: django_extras.forms.fields
+
+
+``ColorField``
+--------------
+
+.. class:: ColorField([allow_alpha=False, max_length=40, **options])
+
+A :class:`CharField` that checks that the value is a valid CSS color value.
+``allow_alpha`` controls if colors can support alpha values.
+
+Specifies that the default widget is the :class:`JQueryColorPicker`.
+
+
+``JsonField``
+--------------
+
+.. class:: JsonField([dump_options={'cls': DjangoJSONEncoder}, load_options={}, **options])
+
+A :class:`TextField` that handles serialisation/deserialization of JSON
+structures for display in a Text input.

docs/ref/forms/index.txt

 Forms
 =====
 
-**TODO** Complete this section
+Form API reference.
+
+.. toctree::
+   :maxdepth: 1
+
+   fields
+   widgets

docs/ref/forms/widgets.txt

+=====================
+Form widget reference
+=====================
+
+.. module:: django_extras.forms.widgets
+   :synopsis: Additional form widgets.
+
+
+Widget types
+============
+
+.. currentmodule:: django_extras.forms.widgets
+
+
+HTML5 Input types
+-----------------
+
+``Html5EmailInput``
+~~~~~~~~~~~~~~~~~~~
+
+.. class:: Html5EmailInput
+
+    HTML 5 email input.
+
+
+``Html5NumberInput``
+~~~~~~~~~~~~~~~~~~~~
+
+.. class:: Html5NumberInput
+
+    HTML 5 number input.
+
+
+``Html5DateInput``
+~~~~~~~~~~~~~~~~~~
+
+.. class:: Html5DateInput
+
+    HTML 5 date input.
+
+
+``Html5DateTimeInput``
+~~~~~~~~~~~~~~~~~~~~~~
+
+.. class:: Html5DateTimeInput
+
+    HTML 5 datetime input.
+
+
+``Html5TimeInput``
+~~~~~~~~~~~~~~~~~~
+
+.. class:: Html5TimeInput
+
+    HTML 5 time input.
+
+
+
+JQuery enhanced widgets
+-----------------------
+
+``JQueryColorPicker``
+~~~~~~~~~~~~~~~~~~~~~
+
+.. class:: JQueryColorPicker
+
+    Widget that displays a color picker. This widget assumes jQuery has been
+    included on the page. JavaScript and CSS is included and is defined using
+    Django media definitions.

docs/ref/http-response.txt

 -----------------------
 
 Django extras includes a number of additional ``HttpResponse`` subclasses
-that handle different types of HTTP responses. These subclasses live in
+that handle different types of HTTP responses. These subclasses are defined in
 :mod:`django_extras.http`.
 
+
+Common HTTP response types
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Common response codes, most of these codes are defined in the
+`W3C Protocol specification`_. This collection also includes status codes that
+are defined for Web DAV. This list does not include response types that are
+already defined in Django.
+
+.. _W3C Protocol specification: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
+
+
+*Successful 2xx responses*
+
+.. class:: HttpResponseCreated
+
+    Status code 201
+
+.. class:: HttpResponseAccepted
+
+    Status code 202
+
+.. class:: HttpResponseNonAuthoritative
+
+    Status code 203
+
+.. class:: HttpResponseNoContent
+
+    Status code 204
+
+.. class:: HttpResponseResetContent
+
+    Status code 205
+
+.. class:: HttpResponsePartialContent
+
+    Status code 206
+
+
+*Redirection 3xx responses*
+
+All responses within the 3xx class inherit from :class:`HttpResponseRedirect`.
+
+.. class:: HttpResponseSeeOther
+
+    Status code 303
+
+
+*Client Error 4xx responses*
+
 .. class:: HttpResponseUnAuthorised
 
-    The constructor doesn't take any arguments. Use this to designate that a
-    logged in user does not have authorisation to access this URL (status code
-    401).
+    Status code 401
+
+.. class:: HttpResponsePaymentRequired
+
+    Status code 402
+
+.. class:: HttpResponseNotAcceptable
+
+    Status code 406
+
+.. class:: HttpResponseRequestTimeout
+
+    Status code 408
 
 .. class:: HttpResponseConflict
 
-    The constructor doesn't take any arguments. Use this to designate that a
-    request could not be completed due to a conflict with the current resource
-    state (status code 409).
+    Status code 409
+
+.. class:: HttpResponseLengthRequired
+
+    Status code 411
+
+.. class:: HttpResponsePreconditionFailed
+
+    Status code 412
+
+.. class:: HttpResponseRequestEntityTooLarge
+
+    Status code 413
+
+.. class:: HttpResponseUnsupportedMediaType
+
+    Status code 415
+
+.. class:: HttpResponseExpectationFailed
+
+    Status code 417
+
+.. class:: HttpResponseUnprocessableEntity
+
+    Status code 422
+
+.. class:: HttpResponseLocked
+
+    Status code 423
+
+.. class:: HttpResponseFailedDependency
+
+    Status code 424
+
+.. class:: HttpResponseUpgradeRequired
+
+    Status code 426
+
+
+*Server Error 5xx responses*
 
 .. class:: HttpResponseNotImplemented
 
-    The constructor doesn't take any arguments. Use this to indicate that the
-    application does not support the functionality required to fulfill the
-    request (status code 501).
+    Status code 501
+
+.. class:: HttpResponseBadGateway
+
+    Status code 502
+
+.. class:: HttpResponseServiceUnavailable
+
+    Status code 503
 
 .. class:: HttpResponseGatewayTimeout
 
-    The constructor doesn't take any arguments. Use this to indicate that the
-    request could not be completed due to a timeout connecting to an auxiliary
-    service (status code 504). This could be a request to a web service.
+    Status code 504
+
+.. class:: HttpResponseInsufficientStorage
+
+    status_code = 507
+
+
+Enhanced response types
+~~~~~~~~~~~~~~~~~~~~~~~
 
 .. class:: FileResponse
 
     The constructor accepts the same ``content`` property as the default
     :class:``HttpResponse`` class except it is interpreted as a file name or
-    file handle and a ``content_type`` and facilitates streaming the content
-    to the client. There is also an optional parameter
-    ``include_last_modified`` that defaults to *True* that will pass through
-    a last modified date of the specified file.
+    file handle and ``content_type``. The response object facilitates streaming
+    the content of the file to the client. There is an optional parameter
+    ``include_last_modified`` which defaults to *True* that supplies the
+    last modified date of the specified file as an HTTP header.
 
 .. class:: JsonResponse
 

docs/ref/models/fields.txt

 
 .. currentmodule:: django_extras.db.models
 
+
 ``ColorField``
 --------------
 
 A :class:`CharField` that checks that the value is a valid CSS color value.
 ``allow_alpha`` controls if colors can support alpha values.
 
+
 ``MoneyField``
 --------------
 
 
 A :class:`DecimalField` that sets up sensible defaults for monetary values, in
 addition the :class:`MoneyField` will return values as instances of the
-:class:`Money` type. The :class:`Money` type is based on the Pythons decimal
+:class:`Money` type. The :class:`Money` type is based on Pythons decimal
 object.
 
 .. note::
-    The current implementation does not store the currency value along with the
-    value of the money field.
+    The current implementation does not store the currency code with the money
+    value.
+
 
 ``PercentField``
---------------
+----------------
 
 .. class:: PercentField(**options)
 
-A :class:`FloatField` that represents a percentage value that limits the range
-of values to between 0 and 100.
+A :class:`FloatField` that represents a percentage value. Validates provided value to
+ensure it is within the range 0 to 100.
+
+
+``LatitudeField``
+-----------------
+
+.. class:: LatitudeField(**options)
+
+A :class:`FloatField` that represents a latitude. Validates provided value to
+ensure it is within the range -90.0 to 90.0
+
+
+
+``LongitudeField``
+------------------
+
+.. class:: LongitudeField(**options)
+
+A :class:`FloatField` that represents a longitude. Values are validated
+to be within the range -180.0 to 180.0.
+
 
 ``JsonField``
 --------------
 
 .. class:: JsonField([dump_options={'cls': DjangoJSONEncoder}, load_options={}, **options])
 
-A :class:`TextField` handles serialisation/deserialization of JSON into the
-database.
+A :class:`TextField` that handles serialisation/deserialization of JSON
+structures into a database field.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.