From 8c0bd39f126ddd82136b708aa0ba6339bfeedcd4 Mon Sep 17 00:00:00 2001 From: Alec Perkins Date: Sun, 9 Sep 2012 15:17:44 -0400 Subject: Styling of POST, PUT forms. Add add_class filter. --- .../djangorestframework/css/bootstrap-tweaks.css | 13 ++++ .../static/djangorestframework/css/style.css | 6 +- .../templates/djangorestframework/base.html | 70 ++++++++++++---------- djangorestframework/templatetags/add_class.py | 40 +++++++++++++ 4 files changed, 95 insertions(+), 34 deletions(-) create mode 100644 djangorestframework/static/djangorestframework/css/bootstrap-tweaks.css create mode 100644 djangorestframework/templatetags/add_class.py diff --git a/djangorestframework/static/djangorestframework/css/bootstrap-tweaks.css b/djangorestframework/static/djangorestframework/css/bootstrap-tweaks.css new file mode 100644 index 00000000..f80b312a --- /dev/null +++ b/djangorestframework/static/djangorestframework/css/bootstrap-tweaks.css @@ -0,0 +1,13 @@ +/* + +This CSS file contains some tweaks specific to the included Bootstrap theme. +It's separate from `style.css` so that it can be easily overridden by replacing +a single block in the template. + +*/ + + +.form-actions { + background: transparent; + border-top-color: transparent; +} \ No newline at end of file diff --git a/djangorestframework/static/djangorestframework/css/style.css b/djangorestframework/static/djangorestframework/css/style.css index fbc4a008..5c44e93f 100644 --- a/djangorestframework/static/djangorestframework/css/style.css +++ b/djangorestframework/static/djangorestframework/css/style.css @@ -51,4 +51,8 @@ h2, h3 { #options-form { margin-right: 1em; -} \ No newline at end of file +} + +.errorlist { + margin-top: 0.5em; +} diff --git a/djangorestframework/templates/djangorestframework/base.html b/djangorestframework/templates/djangorestframework/base.html index a8ac83a8..ddf96adc 100644 --- a/djangorestframework/templates/djangorestframework/base.html +++ b/djangorestframework/templates/djangorestframework/base.html @@ -1,6 +1,7 @@ {% load url from future %} {% load urlize_quoted_links %} {% load add_query_param %} +{% load add_class %} {% load optional_login %} {% load static %} @@ -9,7 +10,8 @@ {% block bootstrap_theme %} - + + {% endblock %} {% block extrastyle %}{% endblock %} @@ -116,69 +118,71 @@ {{ content|urlize_quoted_links }}{% endautoescape %} - - {% comment %} - {# These are disabled since the forms don't work with 2.0.0 yet #} - {% if response.status_code != 403 %} {% if 'POST' in allowed_methods %} -
{% endif %} {% if 'PUT' in allowed_methods and api_settings.FORM_METHOD_OVERRIDE %} -