Commits

Steve Losh  committed 6f1c21d

Add much more documentation and a bit more functionality.

  • Participants
  • Parent commits 69bb301

Comments (0)

Files changed (9)

File LICENSE

-Copyright (c) 2010 Steve Losh, Dumbwaiter Design and other contributors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.

File LICENSE.markdown

+Copyright (c) 2010 Steve Losh, Dumbwaiter Design and other contributors.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

File README

Empty file removed.

File README.markdown

+django-goodfields
+=================
+
+Customizing the markup of Django forms is a pain. django-goodfields tries to
+make it hurt less by making it easy to render form fields and add inline
+validation.
+
+Requirements
+------------
+
+Field rendering only:
+
+* Django 1.1+
+
+Inline validation:
+
+* jQuery
+* LiveValidation
+
+Installation
+------------
+
+### With Pip
+
+    pip install -e hg+http://bitbucket.org/dwaiter/django-goodfields@stable#egg=django-goodfields
+    
+    # or...
+    
+    pip install -e git://github.com/dwaiter/django-goodfields@stable#egg=django-goodfields
+
+### From Source
+
+Get the code:
+
+    hg clone http://bitbucket.org/dwaiter/django-goodfields/
+    hg update stable
+    
+    # or...
+    
+    git clone git://github.com/dwaiter/django-goodfields/
+    git checkout stable
+
+Install:
+
+    cd django-goodfields
+    python setup.py install
+
+Usage
+-----
+
+django-goodfields can help you render nice form fields, and optionally add
+inline validation with Javascript.
+
+### Field Rendering
+
+Use the `{% goodfield [form.field] [field type] %}` template tag to render
+fields in your form:
+
+    <h1>Sign up for free!</h1>
+    
+    <form action="" method="post">
+        
+        {% load goodfields %}
+        {% goodfield form.username text %}
+        {% goodfield form.first_name text %}
+        {% goodfield form.last_name text %}
+        {% goodfield form.password password %}
+        
+        {{ form.non_field_errors }}
+        <input type="submit" value="Sign Up" />
+    </form>
+
+The default field templates included with django-goodfields produce HTML that
+looks similar to this:
+
+    <div class="field" id="id_username-container">
+        <label for="id_username">Username</label>
+        <input type="text" class="text" id="id_username" 
+               name="username"
+               value="" />
+    </div>
+
+Feel free to customize the templates to look however you prefer. Each field
+type (`text`, `password`, `radio`, etc) has its own template. You can add new
+field types by adding new templates.
+
+Usage (Inline Validation)
+-------------------------
+

File goodfields/templates/goodfields/fields/password.html

-{% include "goodfields/fields/validation.html" %}
+{% if validate %}
+{% include "goodfields/fields/validation.html" %}   
+{% endif %}
+
 
 <div class="field">
     <label for="{{ field.auto_id }}">{% firstof label field.label %} {{ field.errors }}</label>

File goodfields/templates/goodfields/fields/text-date.html

-{% include "goodfields/fields/validation.html" %}
+{% if validate %}
+{% include "goodfields/fields/validation.html" %}   
+{% endif %}
+
 
 <div class="field">
     <label for="{{ field.auto_id }}">{% firstof label field.label %} {{ field.errors }}</label>

File goodfields/templates/goodfields/fields/text.html

-{% include "goodfields/fields/validation.html" %}
+{% if validate %}
+{% include "goodfields/fields/validation.html" %}   
+{% endif %}
+
 
 <div class="field" id="{{ field.auto_id }}-container">
     <label for="{{ field.auto_id }}">{% firstof label field.label %}</label>

File goodfields/templates/goodfields/fields/textarea.html

-{% include "goodfields/fields/validation.html" %}
+{% if validate %}
+{% include "goodfields/fields/validation.html" %}   
+{% endif %}
+
 
 <div class="field" id="{{ field.auto_id }}-container">
     <label for="{{ field.auto_id }}">{% firstof label field.label %} {{ field.errors }}</label>

File goodfields/templatetags/goodfields.py

 from django.conf import settings
 from django.template.loader import render_to_string
 
-validate = (hasattr(settings, 'GOODFIELD_VALIDATION') and not settings.GOODFIELD_VALIDATION)
+validate = (hasattr(settings, 'GOODFIELD_VALIDATION') and settings.GOODFIELD_VALIDATION)
 register = template.Library()
 
 class GoodfieldNode(template.Node):