Merge pull request #3047 from jpadilla/html-cleanup

Consistent 2 space tabbing and formatting
This commit is contained in:
Xavier Ordoquy 2015-06-18 19:29:38 +02:00
commit 7cb618a09f
36 changed files with 853 additions and 740 deletions

View File

@ -57,12 +57,10 @@
<body onload="prettyPrint()" class="{% if current_page and current_page.is_homepage %}index{% endif %}-page"> <body onload="prettyPrint()" class="{% if current_page and current_page.is_homepage %}index{% endif %}-page">
<div class="wrapper"> <div class="wrapper">
{% include "nav.html" %} {% include "nav.html" %}
<div class="body-content"> <div class="body-content">
<div class="container-fluid"> <div class="container-fluid">
<!-- Search Modal --> <!-- Search Modal -->
<div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div id="mkdocs_search_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header"> <div class="modal-header">
@ -85,25 +83,16 @@
</div> </div>
<div class="row-fluid"> <div class="row-fluid">
<div class="span3"> <div class="span3">
<!-- TODO
<p style="margin-top: -12px">
<a class="btn btn-mini btn-primary" style="width: 60px">&laquo; previous</a>
<a class="btn btn-mini btn-primary" style="float: right; margin-right: 8px; width: 60px;">next &raquo;</a>
</p>
-->
<div id="table-of-contents"> <div id="table-of-contents">
<ul class="nav nav-list side-nav well sidebar-nav-fixed"> <ul class="nav nav-list side-nav well sidebar-nav-fixed">
{% if current_page and current_page.is_homepage %} {% if current_page and current_page.is_homepage %}
<li class="main"> <li class="main">
<a href="#">Django REST framework</a> <a href="#">Django REST framework</a>
</li> </li>
{% endif %} {% endif %}
{% for toc_item in toc %} {% for toc_item in toc %}
<li class="{% if current_page and not current_page.is_homepage %}main{% endif %}"> <li class="{% if current_page and not current_page.is_homepage %}main{% endif %}">
<a href="{{ toc_item.url }}">{{ toc_item.title }}</a> <a href="{{ toc_item.url }}">{{ toc_item.title }}</a>
</li> </li>
@ -113,25 +102,21 @@
<a href="{{ toc_item.url }}">{{ toc_item.title }}</a> <a href="{{ toc_item.url }}">{{ toc_item.title }}</a>
</li> </li>
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
{% if current_page and current_page.is_homepage %} {% if current_page and current_page.is_homepage %}
<div class="promo"> <div class="promo">
<hr/> <hr/>
<script type="text/javascript" src="//cdn.fusionads.net/fusion.js?zoneid=1332&serve=C6SDP2Y&placement=djangorestframework" id="_fusionads_js"></script> <script type="text/javascript" src="//cdn.fusionads.net/fusion.js?zoneid=1332&serve=C6SDP2Y&placement=djangorestframework" id="_fusionads_js"></script>
</div> </div>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
</div> </div>
<div id="main-content" class="span9"> <div id="main-content" class="span9">
{% block content %} {% block content %}
{% if meta.source %} {% if meta.source %}
{% for filename in meta.source %} {% for filename in meta.source %}
<a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/{{ filename }}"> <a class="github" href="https://github.com/tomchristie/django-rest-framework/tree/master/rest_framework/{{ filename }}">
@ -141,20 +126,14 @@
{% endif %} {% endif %}
{{ content }} {{ content }}
{% endblock %} {% endblock %}
</div> </div> <!--/span-->
<!--/span--> </div> <!--/row-->
</div> </div> <!--/.fluid-container-->
<!--/row--> </div> <!--/.body content-->
</div>
<!--/.fluid-container-->
</div>
<!--/.body content-->
<div id="push"></div> <div id="push"></div>
</div> </div> <!--/.wrapper -->
<!--/.wrapper -->
<footer class="span12"> <footer class="span12">
<p>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</a> <p>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</a>

View File

@ -1,8 +1,8 @@
{% load rest_framework %} {% load rest_framework %}
{% csrf_token %} {% csrf_token %}
{% for field in form %} {% for field in form %}
{% if not field.read_only %} {% if not field.read_only %}
{% render_field field style=style %} {% render_field field style=style %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<!-- form.non_field_errors --> <!-- form.non_field_errors -->

View File

@ -3,257 +3,242 @@
{% load rest_framework %} {% load rest_framework %}
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
{% block head %} {% block head %}
{% block meta %} {% block meta %}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="robots" content="NONE,NOARCHIVE" /> <meta name="robots" content="NONE,NOARCHIVE" />
{% endblock %}
<title>{% block title %}Django REST framework{% endblock %}</title>
{% block style %}
{% block bootstrap_theme %}
<link rel="stylesheet" type="text/css" href="{% static "rest_framework/css/bootstrap.min.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static "rest_framework/css/bootstrap-tweaks.css" %}"/>
{% endblock %}
<link rel="stylesheet" type="text/css" href="{% static "rest_framework/css/prettify.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static "rest_framework/css/default.css" %}"/>
{% endblock %}
{% endblock %}
</head>
{% block body %}
<body class="{% block bodyclass %}{% endblock %}">
<div class="wrapper">
{% block navbar %}
<div class="navbar navbar-static-top {% block bootstrap_navbar_variant %}navbar-inverse{% endblock %}">
<div class="container">
<span>
{% block branding %}
<a class='navbar-brand' rel="nofollow" href='http://www.django-rest-framework.org'>
Django REST framework <span class="version">{{ version }}</span>
</a>
{% endblock %} {% endblock %}
</span>
<title>{% block title %}Django REST framework{% endblock %}</title> <ul class="nav navbar-nav pull-right">
{% block userlinks %}
{% block style %} {% if user.is_authenticated %}
{% block bootstrap_theme %} {% optional_logout request user %}
<link rel="stylesheet" type="text/css" href="{% static "rest_framework/css/bootstrap.min.css" %}"/> {% else %}
<link rel="stylesheet" type="text/css" href="{% static "rest_framework/css/bootstrap-tweaks.css" %}"/> {% optional_login request %}
{% endblock %} {% endif %}
<link rel="stylesheet" type="text/css" href="{% static "rest_framework/css/prettify.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static "rest_framework/css/default.css" %}"/>
{% endblock %} {% endblock %}
</ul>
</div>
</div>
{% endblock %}
{% endblock %} <div class="container">
</head> {% block breadcrumbs %}
<ul class="breadcrumb">
{% for breadcrumb_name, breadcrumb_url in breadcrumblist %}
{% if forloop.last %}
<li class="active"><a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a></li>
{% else %}
<li><a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a></li>
{% endif %}
{% endfor %}
</ul>
{% endblock %}
{% block body %} <!-- Content -->
<body class="{% block bodyclass %}{% endblock %}"> <div id="content">
<div class="wrapper"> {% if 'GET' in allowed_methods %}
<form id="get-form" class="pull-right">
<fieldset>
<div class="btn-group format-selection">
<a class="btn btn-primary js-tooltip" href='{{ request.get_full_path }}' rel="nofollow" title="Make a GET request on the {{ name }} resource">GET</a>
{% block navbar %} <button class="btn btn-primary dropdown-toggle js-tooltip" data-toggle="dropdown" title="Specify a format for the GET request">
<div class="navbar navbar-static-top {% block bootstrap_navbar_variant %}navbar-inverse{% endblock %}"> <span class="caret"></span>
<div class="container"> </button>
<span> <ul class="dropdown-menu">
{% block branding %} {% for format in available_formats %}
<a class='navbar-brand' rel="nofollow" href='http://www.django-rest-framework.org'> <li>
Django REST framework <span class="version">{{ version }}</span> <a class="js-tooltip format-option" href='{% add_query_param request api_settings.URL_FORMAT_OVERRIDE format %}' rel="nofollow" title="Make a GET request on the {{ name }} resource with the format set to `{{ format }}`">{{ format }}</a>
</a> </li>
{% endblock %} {% endfor %}
</span>
<ul class="nav navbar-nav pull-right">
{% block userlinks %}
{% if user.is_authenticated %}
{% optional_logout request user %}
{% else %}
{% optional_login request %}
{% endif %}
{% endblock %}
</ul>
</div>
</div>
{% endblock %}
<div class="container">
{% block breadcrumbs %}
<ul class="breadcrumb">
{% for breadcrumb_name, breadcrumb_url in breadcrumblist %}
{% if forloop.last %}
<li class="active"><a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a></li>
{% else %}
<li><a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a></li>
{% endif %}
{% endfor %}
</ul> </ul>
{% endblock %} </div>
</fieldset>
</form>
{% endif %}
<!-- Content --> {% if options_form %}
<div id="content"> <form class="button-form" action="{{ request.get_full_path }}" method="POST">
{% csrf_token %}
<input type="hidden" name="{{ api_settings.FORM_METHOD_OVERRIDE }}" value="OPTIONS" />
<button class="btn btn-primary js-tooltip" title="Make an OPTIONS request on the {{ name }} resource">OPTIONS</button>
</form>
{% endif %}
{% if 'GET' in allowed_methods %} {% if delete_form %}
<form id="get-form" class="pull-right"> <form class="button-form" action="{{ request.get_full_path }}" method="POST">
<fieldset> {% csrf_token %}
<div class="btn-group format-selection"> <input type="hidden" name="{{ api_settings.FORM_METHOD_OVERRIDE }}" value="DELETE" />
<a class="btn btn-primary js-tooltip" href='{{ request.get_full_path }}' <button class="btn btn-danger js-tooltip" title="Make a DELETE request on the {{ name }} resource">DELETE</button>
rel="nofollow" title="Make a GET request on the {{ name }} resource">GET</a> </form>
{% endif %}
<button class="btn btn-primary dropdown-toggle js-tooltip" data-toggle="dropdown" <div class="content-main">
title="Specify a format for the GET request"> <div class="page-header">
<span class="caret"></span> <h1>{{ name }}</h1>
</button> </div>
<ul class="dropdown-menu"> <div style="float:left">
{% for format in available_formats %} {% block description %}
<li> {{ description }}
<a class="js-tooltip format-option" {% endblock %}
href='{% add_query_param request api_settings.URL_FORMAT_OVERRIDE format %}' </div>
rel="nofollow"
title="Make a GET request on the {{ name }} resource with the format set to `{{ format }}`">
{{ format }}
</a>
</li>
{% endfor %}
</ul>
</div>
</fieldset>
</form>
{% endif %}
{% if options_form %} {% if paginator %}
<form class="button-form" action="{{ request.get_full_path }}" method="POST"> <nav style="float: right">
{% csrf_token %} {% get_pagination_html paginator %}
<input type="hidden" name="{{ api_settings.FORM_METHOD_OVERRIDE }}" value="OPTIONS" /> </nav>
<button class="btn btn-primary js-tooltip" {% endif %}
title="Make an OPTIONS request on the {{ name }} resource">OPTIONS</button>
</form>
{% endif %}
{% if delete_form %} <div class="request-info" style="clear: both" >
<form class="button-form" action="{{ request.get_full_path }}" method="POST"> <pre class="prettyprint"><b>{{ request.method }}</b> {{ request.get_full_path }}</pre>
{% csrf_token %} </div>
<input type="hidden" name="{{ api_settings.FORM_METHOD_OVERRIDE }}" value="DELETE" />
<button class="btn btn-danger js-tooltip"
title="Make a DELETE request on the {{ name }} resource">DELETE</button>
</form>
{% endif %}
<div class="content-main"> <div class="response-info">
<div class="page-header"> <pre class="prettyprint"><span class="meta nocode"><b>HTTP {{ response.status_code }} {{ response.status_text }}</b>{% autoescape off %}
<h1>{{ name }}</h1>
</div>
<div style="float:left">
{% block description %}
{{ description }}
{% endblock %}
</div>
{% if paginator %}
<nav style="float: right">
{% get_pagination_html paginator %}
</nav>
{% endif %}
<div class="request-info" style="clear: both" >
<pre class="prettyprint"><b>{{ request.method }}</b> {{ request.get_full_path }}</pre>
</div>
<div class="response-info">
<pre class="prettyprint"><span class="meta nocode"><b>HTTP {{ response.status_code }} {{ response.status_text }}</b>{% autoescape off %}
{% for key, val in response_headers.items %}<b>{{ key }}:</b> <span class="lit">{{ val|break_long_headers|urlize_quoted_links }}</span> {% for key, val in response_headers.items %}<b>{{ key }}:</b> <span class="lit">{{ val|break_long_headers|urlize_quoted_links }}</span>
{% endfor %} {% endfor %}
</span>{{ content|urlize_quoted_links }}</pre>{% endautoescape %} </span>{{ content|urlize_quoted_links }}</pre>{% endautoescape %}
</div>
</div>
{% if display_edit_forms %}
{% if post_form or raw_data_post_form %}
<div {% if post_form %}class="tabbable"{% endif %}>
{% if post_form %}
<ul class="nav nav-tabs form-switcher">
<li>
<a name='html-tab' href="#post-object-form" data-toggle="tab">HTML form</a>
</li>
<li>
<a name='raw-tab' href="#post-generic-content-form" data-toggle="tab">Raw data</a>
</li>
</ul>
{% endif %}
<div class="well tab-content">
{% if post_form %}
<div class="tab-pane" id="post-object-form">
{% with form=post_form %}
<form action="{{ request.get_full_path }}"
method="POST" enctype="multipart/form-data" class="form-horizontal" novalidate>
<fieldset>
{{ post_form }}
<div class="form-actions">
<button class="btn btn-primary"
title="Make a POST request on the {{ name }} resource">POST</button>
</div>
</fieldset>
</form>
{% endwith %}
</div>
{% endif %}
<div {% if post_form %}class="tab-pane"{% endif %} id="post-generic-content-form">
{% with form=raw_data_post_form %}
<form action="{{ request.get_full_path }}" method="POST" class="form-horizontal">
<fieldset>
{% include "rest_framework/raw_data_form.html" %}
<div class="form-actions">
<button class="btn btn-primary"
title="Make a POST request on the {{ name }} resource">POST</button>
</div>
</fieldset>
</form>
{% endwith %}
</div>
</div>
</div>
{% endif %}
{% if put_form or raw_data_put_form or raw_data_patch_form %}
<div {% if put_form %}class="tabbable"{% endif %}>
{% if put_form %}
<ul class="nav nav-tabs form-switcher">
<li>
<a name='html-tab' href="#put-object-form" data-toggle="tab">HTML form</a>
</li>
<li>
<a name='raw-tab' href="#put-generic-content-form" data-toggle="tab">Raw data</a>
</li>
</ul>
{% endif %}
<div class="well tab-content">
{% if put_form %}
<div class="tab-pane" id="put-object-form">
<form action="{{ request.get_full_path }}"
method="POST" enctype="multipart/form-data" class="form-horizontal" novalidate>
<fieldset>
{{ put_form }}
<div class="form-actions">
<button class="btn btn-primary js-tooltip"
name="{{ api_settings.FORM_METHOD_OVERRIDE }}"
value="PUT" title="Make a PUT request on the {{ name }} resource">PUT</button>
</div>
</fieldset>
</form>
</div>
{% endif %}
<div {% if put_form %}class="tab-pane"{% endif %} id="put-generic-content-form">
{% with form=raw_data_put_or_patch_form %}
<form action="{{ request.get_full_path }}" method="POST" class="form-horizontal">
<fieldset>
{% include "rest_framework/raw_data_form.html" %}
<div class="form-actions">
{% if raw_data_put_form %}
<button class="btn btn-primary js-tooltip"
name="{{ api_settings.FORM_METHOD_OVERRIDE }}"
value="PUT" title="Make a PUT request on the {{ name }} resource">PUT</button>
{% endif %}
{% if raw_data_patch_form %}
<button class="btn btn-primary js-tooltip"
name="{{ api_settings.FORM_METHOD_OVERRIDE }}"
value="PATCH" title="Make a PATCH request on the {{ name }} resource">PATCH</button>
{% endif %}
</div>
</fieldset>
</form>
{% endwith %}
</div>
</div>
</div>
{% endif %}
{% endif %}
</div> </div>
<!-- END Content --> </div>
</div><!-- /.container -->
</div><!-- ./wrapper -->
{% block script %} {% if display_edit_forms %}
<script src="{% static "rest_framework/js/jquery-1.8.1-min.js" %}"></script>
<script src="{% static "rest_framework/js/bootstrap.min.js" %}"></script> {% if post_form or raw_data_post_form %}
<script src="{% static "rest_framework/js/prettify-min.js" %}"></script> <div {% if post_form %}class="tabbable"{% endif %}>
<script src="{% static "rest_framework/js/default.js" %}"></script> {% if post_form %}
{% endblock %} <ul class="nav nav-tabs form-switcher">
</body> <li>
{% endblock %} <a name='html-tab' href="#post-object-form" data-toggle="tab">HTML form</a>
</li>
<li>
<a name='raw-tab' href="#post-generic-content-form" data-toggle="tab">Raw data</a>
</li>
</ul>
{% endif %}
<div class="well tab-content">
{% if post_form %}
<div class="tab-pane" id="post-object-form">
{% with form=post_form %}
<form action="{{ request.get_full_path }}" method="POST" enctype="multipart/form-data" class="form-horizontal" novalidate>
<fieldset>
{{ post_form }}
<div class="form-actions">
<button class="btn btn-primary" title="Make a POST request on the {{ name }} resource">POST</button>
</div>
</fieldset>
</form>
{% endwith %}
</div>
{% endif %}
<div {% if post_form %}class="tab-pane"{% endif %} id="post-generic-content-form">
{% with form=raw_data_post_form %}
<form action="{{ request.get_full_path }}" method="POST" class="form-horizontal">
<fieldset>
{% include "rest_framework/raw_data_form.html" %}
<div class="form-actions">
<button class="btn btn-primary" title="Make a POST request on the {{ name }} resource">POST</button>
</div>
</fieldset>
</form>
{% endwith %}
</div>
</div>
</div>
{% endif %}
{% if put_form or raw_data_put_form or raw_data_patch_form %}
<div {% if put_form %}class="tabbable"{% endif %}>
{% if put_form %}
<ul class="nav nav-tabs form-switcher">
<li>
<a name='html-tab' href="#put-object-form" data-toggle="tab">HTML form</a>
</li>
<li>
<a name='raw-tab' href="#put-generic-content-form" data-toggle="tab">Raw data</a>
</li>
</ul>
{% endif %}
<div class="well tab-content">
{% if put_form %}
<div class="tab-pane" id="put-object-form">
<form action="{{ request.get_full_path }}" method="POST" enctype="multipart/form-data" class="form-horizontal" novalidate>
<fieldset>
{{ put_form }}
<div class="form-actions">
<button class="btn btn-primary js-tooltip" name="{{ api_settings.FORM_METHOD_OVERRIDE }}" value="PUT" title="Make a PUT request on the {{ name }} resource">PUT</button>
</div>
</fieldset>
</form>
</div>
{% endif %}
<div {% if put_form %}class="tab-pane"{% endif %} id="put-generic-content-form">
{% with form=raw_data_put_or_patch_form %}
<form action="{{ request.get_full_path }}" method="POST" class="form-horizontal">
<fieldset>
{% include "rest_framework/raw_data_form.html" %}
<div class="form-actions">
{% if raw_data_put_form %}
<button class="btn btn-primary js-tooltip" name="{{ api_settings.FORM_METHOD_OVERRIDE }}" value="PUT" title="Make a PUT request on the {{ name }} resource">PUT</button>
{% endif %}
{% if raw_data_patch_form %}
<button class="btn btn-primary js-tooltip" name="{{ api_settings.FORM_METHOD_OVERRIDE }}" value="PATCH" title="Make a PATCH request on the {{ name }} resource">PATCH</button>
{% endif %}
</div>
</fieldset>
</form>
{% endwith %}
</div>
</div>
</div>
{% endif %}
{% endif %}
</div><!-- /.content -->
</div><!-- /.container -->
</div><!-- ./wrapper -->
{% block script %}
<script src="{% static "rest_framework/js/jquery-1.8.1-min.js" %}"></script>
<script src="{% static "rest_framework/js/bootstrap.min.js" %}"></script>
<script src="{% static "rest_framework/js/prettify-min.js" %}"></script>
<script src="{% static "rest_framework/js/default.js" %}"></script>
{% endblock %}
</body>
{% endblock %}
</html> </html>

View File

@ -1,16 +1,20 @@
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="{{ field.name }}" value="true" {% if field.value %}checked{% endif %}> <input type="checkbox" name="{{ field.name }}" value="true" {% if field.value %}checked{% endif %}>
{% if field.label %}{{ field.label }}{% endif %} {% if field.label %}{{ field.label }}{% endif %}
</label> </label>
</div>
{% if field.errors %}
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
{% endif %}
{% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span>
{% endif %}
</div> </div>
{% if field.errors %}
{% for error in field.errors %}
<span class="help-block">{{ error }}</span>
{% endfor %}
{% endif %}
{% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span>
{% endif %}
</div>
</div> </div>

View File

@ -1,30 +1,37 @@
<div class="form-group"> <div class="form-group">
{% if field.label %} {% if field.label %}
<label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label> <label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">
{% endif %} {{ field.label }}
<div class="col-sm-10"> </label>
{% endif %}
<div class="col-sm-10">
{% if style.inline %} {% if style.inline %}
{% for key, text in field.choices.items %} {% for key, text in field.choices.items %}
<label class="checkbox-inline"> <label class="checkbox-inline">
<input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key in field.value %}checked{% endif %}> <input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key in field.value %}checked{% endif %}>
{{ text }} {{ text }}
</label> </label>
{% endfor %} {% endfor %}
{% else %} {% else %}
{% for key, text in field.choices.items %} {% for key, text in field.choices.items %}
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key in field.value %}checked{% endif %}> <input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key in field.value %}checked{% endif %}>
{{ text }} {{ text }}
</label> </label>
</div> </div>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if field.errors %}
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %} {% if field.errors %}
{% endif %} {% for error in field.errors %}
{% if field.help_text %} <span class="help-block">{{ error }}</span>
<span class="help-block">{{ field.help_text }}</span> {% endfor %}
{% endif %} {% endif %}
</div>
{% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span>
{% endif %}
</div>
</div> </div>

View File

@ -1,13 +1,16 @@
{% load rest_framework %} {% load rest_framework %}
<fieldset> <fieldset>
{% if field.label %} {% if field.label %}
<div class="form-group" style="border-bottom: 1px solid #e5e5e5"> <div class="form-group" style="border-bottom: 1px solid #e5e5e5">
<legend class="control-label col-sm-2 {% if style.hide_label %}sr-only{% endif %}" style="border-bottom: 0">{{ field.label }}</legend> <legend class="control-label col-sm-2 {% if style.hide_label %}sr-only{% endif %}" style="border-bottom: 0">
</div> {{ field.label }}
</legend>
</div>
{% endif %}
{% for nested_field in field %}
{% if not nested_field.read_only %}
{% render_field nested_field style=style %}
{% endif %} {% endif %}
{% for nested_field in field %} {% endfor %}
{% if not nested_field.read_only %}
{% render_field nested_field style=style %}
{% endif %}
{% endfor %}
</fieldset> </fieldset>

View File

@ -1,15 +1,16 @@
{% load rest_framework %} {% load rest_framework %}
<form class="form-horizontal" role="form" action="." method="POST" novalidate> <form class="form-horizontal" role="form" action="." method="POST" novalidate>
{% csrf_token %} {% csrf_token %}
{% for field in form %} {% for field in form %}
{% if not field.read_only %} {% if not field.read_only %}
{% render_field field style=style %} {% render_field field style=style %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<!-- form.non_field_errors -->
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Submit</button> <button type="submit" class="btn btn-default">Submit</button>
</div>
</div> </div>
</div>
</form> </form>

View File

@ -1,14 +1,21 @@
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %} {% if field.label %}
<label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label> <label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">
{{ field.label }}
</label>
{% endif %}
<div class="col-sm-10">
<input name="{{ field.name }}" {% if style.input_type != "file" %}class="form-control"{% endif %} type="{{ style.input_type }}" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
{% if field.errors %}
{% for error in field.errors %}
<span class="help-block">{{ error }}</span>
{% endfor %}
{% endif %} {% endif %}
<div class="col-sm-10">
<input name="{{ field.name }}" {% if style.input_type != "file" %}class="form-control"{% endif %} type="{{ style.input_type }}" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}> {% if field.help_text %}
{% if field.errors %} <span class="help-block">{{ field.help_text }}</span>
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %} {% endif %}
{% endif %} </div>
{% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span>
{% endif %}
</div>
</div> </div>

View File

@ -1,16 +1,13 @@
{% load rest_framework %} {% load rest_framework %}
<fieldset> <fieldset>
{% if field.label %} {% if field.label %}
<div class="form-group" style="border-bottom: 1px solid #e5e5e5"> <div class="form-group" style="border-bottom: 1px solid #e5e5e5">
<legend class="control-label col-sm-2 {% if style.hide_label %}sr-only{% endif %}" style="border-bottom: 0">{{ field.label }}</legend> <legend class="control-label col-sm-2 {% if style.hide_label %}sr-only{% endif %}" style="border-bottom: 0">
</div> {{ field.label }}
{% endif %} </legend>
<!-- </div>
<ul> {% endif %}
{% for child in field.value %}
<li>TODO</li> <p>Lists are not currently supported in HTML input.</p>
{% endfor %}
</ul>
-->
<p>Lists are not currently supported in HTML input.</p>
</fieldset> </fieldset>

View File

@ -2,46 +2,54 @@
{% trans "None" as none_choice %} {% trans "None" as none_choice %}
<div class="form-group"> <div class="form-group">
{% if field.label %} {% if field.label %}
<label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label> <label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">
{% endif %} {{ field.label }}
<div class="col-sm-10"> </label>
{% endif %}
<div class="col-sm-10">
{% if style.inline %} {% if style.inline %}
{% if field.allow_null or field.allow_blank %} {% if field.allow_null or field.allow_blank %}
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} /> <input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} />
{{ none_choice }} {{ none_choice }}
</label> </label>
{% endif %} {% endif %}
{% for key, text in field.choices.items %}
<label class="radio-inline"> {% for key, text in field.choices.items %}
<input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key == field.value %}checked{% endif %} /> <label class="radio-inline">
{{ text }} <input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key == field.value %}checked{% endif %} />
</label> {{ text }}
{% endfor %} </label>
{% endfor %}
{% else %} {% else %}
{% if field.allow_null or field.allow_blank %} {% if field.allow_null or field.allow_blank %}
<div class="radio"> <div class="radio">
<label> <label>
<input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} /> <input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} />
{{ none_choice }} {{ none_choice }}
</label> </label>
</div> </div>
{% endif %} {% endif %}
{% for key, text in field.choices.items %} {% for key, text in field.choices.items %}
<div class="radio"> <div class="radio">
<label> <label>
<input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key == field.value %}checked{% endif %} /> <input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key == field.value %}checked{% endif %} />
{{ text }} {{ text }}
</label> </label>
</div> </div>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if field.errors %} {% if field.errors %}
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %} {% for error in field.errors %}
<span class="help-block">{{ error }}</span>
{% endfor %}
{% endif %} {% endif %}
{% if field.help_text %} {% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span> <span class="help-block">{{ field.help_text }}</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@ -1,21 +1,28 @@
<div class="form-group"> <div class="form-group">
{% if field.label %} {% if field.label %}
<label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label> <label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">
{{ field.label }}
</label>
{% endif %}
<div class="col-sm-10">
<select class="form-control" name="{{ field.name }}">
{% if field.allow_null or field.allow_blank %}
<option value="" {% if not field.value %}selected{% endif %}>--------</option>
{% endif %}
{% for key, text in field.choices.items %}
<option value="{{ key }}" {% if key == field.value %}selected{% endif %}>{{ text }}</option>
{% endfor %}
</select>
{% if field.errors %}
{% for error in field.errors %}
<span class="help-block">{{ error }}</span>
{% endfor %}
{% endif %} {% endif %}
<div class="col-sm-10">
<select class="form-control" name="{{ field.name }}"> {% if field.help_text %}
{% if field.allow_null or field.allow_blank %} <span class="help-block">{{ field.help_text }}</span>
<option value="" {% if not field.value %}selected{% endif %}>--------</option> {% endif %}
{% endif %} </div>
{% for key, text in field.choices.items %}
<option value="{{ key }}" {% if key == field.value %}selected{% endif %}>{{ text }}</option>
{% endfor %}
</select>
{% if field.errors %}
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
{% endif %}
{% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span>
{% endif %}
</div>
</div> </div>

View File

@ -2,22 +2,29 @@
{% trans "No items to select." as no_items %} {% trans "No items to select." as no_items %}
<div class="form-group"> <div class="form-group">
{% if field.label %} {% if field.label %}
<label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label> <label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">
{{ field.label }}
</label>
{% endif %}
<div class="col-sm-10">
<select multiple {{ field.choices|yesno:",disabled" }} class="form-control" name="{{ field.name }}">
{% for key, text in field.choices.items %}
<option value="{{ key }}" {% if key in field.value %}selected{% endif %}>{{ text }}</option>
{% empty %}
<option>{{ no_items }}</option>
{% endfor %}
</select>
{% if field.errors %}
{% for error in field.errors %}
<span class="help-block">{{ error }}</span>
{% endfor %}
{% endif %} {% endif %}
<div class="col-sm-10">
<select multiple {{ field.choices|yesno:",disabled" }} class="form-control" name="{{ field.name }}"> {% if field.help_text %}
{% for key, text in field.choices.items %} <span class="help-block">{{ field.help_text }}</span>
<option value="{{ key }}" {% if key in field.value %}selected{% endif %}>{{ text }}</option> {% endif %}
{% empty %} </div>
<option>{{ no_items }}</option>
{% endfor %}
</select>
{% if field.errors %}
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
{% endif %}
{% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span>
{% endif %}
</div>
</div> </div>

View File

@ -1,14 +1,21 @@
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %} {% if field.label %}
<label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label> <label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">
{{ field.label }}
</label>
{% endif %}
<div class="col-sm-10">
<textarea name="{{ field.name }}" class="form-control" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if style.rows %}rows="{{ style.rows }}"{% endif %}>{% if field.value %}{{ field.value }}{% endif %}</textarea>
{% if field.errors %}
{% for error in field.errors %}
<span class="help-block">{{ error }}</span>
{% endfor %}
{% endif %} {% endif %}
<div class="col-sm-10">
<textarea name="{{ field.name }}" class="form-control" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if style.rows %}rows="{{ style.rows }}"{% endif %}>{% if field.value %}{{ field.value }}{% endif %}</textarea> {% if field.help_text %}
{% if field.errors %} <span class="help-block">{{ field.help_text }}</span>
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %} {% endif %}
{% endif %} </div>
{% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span>
{% endif %}
</div>
</div> </div>

View File

@ -1,8 +1,8 @@
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="{{ field.name }}" value="true" {% if field.value %}checked{% endif %}> <input type="checkbox" name="{{ field.name }}" value="true" {% if field.value %}checked{% endif %}>
{% if field.label %}{{ field.label }}{% endif %} {% if field.label %}{{ field.label }}{% endif %}
</label> </label>
</div> </div>
</div> </div>

View File

@ -1,13 +1,14 @@
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %} {% if field.label %}
<label class="sr-only">{{ field.label }}</label> <label class="sr-only">{{ field.label }}</label>
{% endif %} {% endif %}
{% for key, text in field.choices.items %}
{% for key, text in field.choices.items %}
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key in field.value %}checked{% endif %}> <input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key in field.value %}checked{% endif %}>
{{ text }} {{ text }}
</label> </label>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -1,6 +1,6 @@
{% load rest_framework %} {% load rest_framework %}
{% for nested_field in field %} {% for nested_field in field %}
{% if not nested_field.read_only %} {% if not nested_field.read_only %}
{% render_field nested_field style=style %} {% render_field nested_field style=style %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@ -1,11 +1,13 @@
{% load rest_framework %} {% load rest_framework %}
<form class="form-inline" role="form" action="." method="POST" novalidate> <form class="form-inline" role="form" action="." method="POST" novalidate>
{% csrf_token %} {% csrf_token %}
{% for field in form %}
{% if not field.read_only %} {% for field in form %}
{% render_field field style=style %} {% if not field.read_only %}
{% endif %} {% render_field field style=style %}
{% endfor %} {% endif %}
<!-- form.non_field_errors --> {% endfor %}
<button type="submit" class="btn btn-default">Submit</button> <button type="submit" class="btn btn-default">Submit</button>
</form> </form>

View File

@ -1,6 +1,9 @@
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %} {% if field.label %}
<label class="sr-only">{{ field.label }}</label> <label class="sr-only">
{% endif %} {{ field.label }}
<input name="{{ field.name }}" {% if style.input_type != "file" %}class="form-control"{% endif %} type="{{ style.input_type }}" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}> </label>
{% endif %}
<input name="{{ field.name }}" {% if style.input_type != "file" %}class="form-control"{% endif %} type="{{ style.input_type }}" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
</div> </div>

View File

@ -2,23 +2,27 @@
{% trans "None" as none_choice %} {% trans "None" as none_choice %}
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %} {% if field.label %}
<label class="sr-only">{{ field.label }}</label> <label class="sr-only">
{% endif %} {{ field.label }}
{% if field.allow_null or field.allow_blank %} </label>
<div class="radio"> {% endif %}
<label>
<input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %}> {% if field.allow_null or field.allow_blank %}
{{ none_choice }} <div class="radio">
</label> <label>
</div> <input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %}>
{% endif %} {{ none_choice }}
{% for key, text in field.choices.items %} </label>
<div class="radio"> </div>
<label> {% endif %}
<input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key == field.value %}checked{% endif %}>
{{ text }} {% for key, text in field.choices.items %}
</label> <div class="radio">
</div> <label>
{% endfor %} <input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key == field.value %}checked{% endif %}>
{{ text }}
</label>
</div>
{% endfor %}
</div> </div>

View File

@ -1,13 +1,17 @@
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %} {% if field.label %}
<label class="sr-only">{{ field.label }}</label> <label class="sr-only">
{{ field.label }}
</label>
{% endif %}
<select class="form-control" name="{{ field.name }}">
{% if field.allow_null or field.allow_blank %}
<option value="" {% if not field.value %}selected{% endif %}>--------</option>
{% endif %} {% endif %}
<select class="form-control" name="{{ field.name }}">
{% if field.allow_null or field.allow_blank %} {% for key, text in field.choices.items %}
<option value="" {% if not field.value %}selected{% endif %}>--------</option> <option value="{{ key }}" {% if key == field.value %}selected{% endif %}>{{ text }}</option>
{% endif %} {% endfor %}
{% for key, text in field.choices.items %} </select>
<option value="{{ key }}" {% if key == field.value %}selected{% endif %}>{{ text }}</option>
{% endfor %}
</select>
</div> </div>

View File

@ -2,14 +2,17 @@
{% trans "No items to select." as no_items %} {% trans "No items to select." as no_items %}
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %} {% if field.label %}
<label class="sr-only">{{ field.label }}</label> <label class="sr-only">
{% endif %} {{ field.label }}
<select multiple {{ field.choices|yesno:",disabled" }} class="form-control" name="{{ field.name }}"> </label>
{% for key, text in field.choices.items %} {% endif %}
<option value="{{ key }}" {% if key in field.value %}selected{% endif %}>{{ text }}</option>
{% empty %} <select multiple {{ field.choices|yesno:",disabled" }} class="form-control" name="{{ field.name }}">
<option>{{ no_items }}</option> {% for key, text in field.choices.items %}
{% endfor %} <option value="{{ key }}" {% if key in field.value %}selected{% endif %}>{{ text }}</option>
</select> {% empty %}
<option>{{ no_items }}</option>
{% endfor %}
</select>
</div> </div>

View File

@ -1,6 +1,9 @@
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %} {% if field.label %}
<label class="sr-only">{{ field.label }}</label> <label class="sr-only">
{% endif %} {{ field.label }}
<input name="{{ field.name }}" type="text" class="form-control" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}> </label>
{% endif %}
<input name="{{ field.name }}" type="text" class="form-control" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
</div> </div>

View File

@ -3,66 +3,65 @@
{% load staticfiles %} {% load staticfiles %}
{% load rest_framework %} {% load rest_framework %}
{% block body %} {% block body %}
<body class="container"> <body class="container">
<div class="container-fluid" style="margin-top: 30px">
<div class="row-fluid">
<div class="well" style="width: 320px; margin-left: auto; margin-right: auto">
<div class="row-fluid">
<div>
{% block branding %}<h3 style="margin: 0 0 20px;">Django REST framework</h3>{% endblock %}
</div>
</div><!-- /row fluid -->
<div class="container-fluid" style="margin-top: 30px"> <div class="row-fluid">
<div class="row-fluid"> <div>
<div class="well" style="width: 320px; margin-left: auto; margin-right: auto"> <form action="{% url 'rest_framework:login' %}" role="form" method="post">
<div class="row-fluid"> {% csrf_token %}
<div> <input type="hidden" name="next" value="{{ next }}" />
{% block branding %}<h3 style="margin: 0 0 20px;">Django REST framework</h3>{% endblock %}
</div> <div id="div_id_username" class="clearfix control-group {% if form.username.errors %}error{% endif %}">
</div><!-- /row fluid --> <div class="form-group">
<label for="id_username">Username:</label>
<div class="row-fluid"> <input type="text" name="username" maxlength="100"
<div> autocapitalize="off"
<form action="{% url 'rest_framework:login' %}" role="form" method="post"> autocorrect="off" class="form-control textinput textInput"
{% csrf_token %} id="id_username" required
<div id="div_id_username" {% if form.username.value %}value="{{ form.username.value }}"{% endif %}>
class="clearfix control-group {% if form.username.errors %}error{% endif %}"> {% if form.username.errors %}
<div class="form-group"> <p class="text-error">
<label for="id_username">Username:</label> {{ form.username.errors|striptags }}
<input type="text" name="username" maxlength="100" </p>
autocapitalize="off" {% endif %}
autocorrect="off" class="form-control textinput textInput" </div>
id="id_username" required </div>
{% if form.username.value %}value="{{ form.username.value }}"{% endif %}>
{% if form.username.errors %} <div id="div_id_password" class="clearfix control-group {% if form.password.errors %}error{% endif %}">
<p class="text-error"> <div class="form-group">
{{ form.username.errors|striptags }} <label for="id_password">Password:</label>
</p> <input type="password" name="password" maxlength="100" autocapitalize="off" autocorrect="off" class="form-control textinput textInput" id="id_password" required>
{% endif %} {% if form.password.errors %}
</div> <p class="text-error">
</div> {{ form.password.errors|striptags }}
<div id="div_id_password" </p>
class="clearfix control-group {% if form.password.errors %}error{% endif %}"> {% endif %}
<div class="form-group"> </div>
<label for="id_password">Password:</label> </div>
<input type="password" name="password" maxlength="100"
autocapitalize="off" autocorrect="off" class="form-control textinput textInput" {% if form.non_field_errors %}
id="id_password" required> {% for error in form.non_field_errors %}
{% if form.password.errors %} <div class="well well-small text-error" style="border: none">{{ error }}</div>
<p class="text-error"> {% endfor %}
{{ form.password.errors|striptags }} {% endif %}
</p>
{% endif %} <div class="form-actions-no-box">
</div> <input type="submit" name="submit" value="Log in" class="btn btn-primary form-control" id="submit-id-submit">
</div> </div>
<input type="hidden" name="next" value="{{ next }}" /> </form>
{% if form.non_field_errors %} </div>
{% for error in form.non_field_errors %} </div><!-- /.row-fluid -->
<div class="well well-small text-error" style="border: none">{{ error }}</div> </div><!--/.well-->
{% endfor %} </div><!-- /.row-fluid -->
{% endif %} </div><!-- /.container-fluid -->
<div class="form-actions-no-box"> </body>
<input type="submit" name="submit" value="Log in" class="btn btn-primary form-control" id="submit-id-submit"> {% endblock %}
</div>
</form>
</div>
</div><!-- /.row-fluid -->
</div><!--/.well-->
</div><!-- /.row-fluid -->
</div><!-- /.container-fluid -->
</body>
{% endblock %}

View File

@ -1,27 +1,47 @@
<ul class="pagination" style="margin: 5px 0 10px 0"> <ul class="pagination" style="margin: 5px 0 10px 0">
{% if previous_url %} {% if previous_url %}
<li><a href="{{ previous_url }}" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li> <li>
{% else %} <a href="{{ previous_url }}" aria-label="Previous">
<li class="disabled"><a href="#" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li> <span aria-hidden="true">&laquo;</span>
{% endif %} </a>
</li>
{% else %}
<li class="disabled">
<a href="#" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
{% endif %}
{% for page_link in page_links %} {% for page_link in page_links %}
{% if page_link.is_break %} {% if page_link.is_break %}
<li class="disabled"> <li class="disabled">
<a href="#"><span aria-hidden="true">&hellip;</span></a> <a href="#"><span aria-hidden="true">&hellip;</span></a>
</li> </li>
{% else %}
{% if page_link.is_active %}
<li class="active"><a href="{{ page_link.url }}">{{ page_link.number }}</a></li>
{% else %}
<li><a href="{{ page_link.url }}">{{ page_link.number }}</a></li>
{% endif %}
{% endif %}
{% endfor %}
{% if next_url %}
<li><a href="{{ next_url }}" aria-label="Next"><span aria-hidden="true">&raquo;</span></a></li>
{% else %} {% else %}
<li class="disabled"><a href="#" aria-label="Next"><span aria-hidden="true">&raquo;</span></a></li> {% if page_link.is_active %}
<li class="active">
<a href="{{ page_link.url }}">{{ page_link.number }}</a>
</li>
{% else %}
<li>
<a href="{{ page_link.url }}">{{ page_link.number }}</a>
</li>
{% endif %}
{% endif %} {% endif %}
{% endfor %}
{% if next_url %}
<li>
<a href="{{ next_url }}" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
{% else %}
<li class="disabled">
<a href="#" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
{% endif %}
</ul> </ul>

View File

@ -1,12 +1,21 @@
<ul class="pager"> <ul class="pager">
{% if previous_url %} {% if previous_url %}
<li class="previous"><a href="{{ previous_url }}">&laquo; Previous</a></li> <li class="previous">
{% else %} <a href="{{ previous_url }}">&laquo; Previous</a>
<li class="previous disabled"><a href="#">&laquo; Previous</a></li> </li>
{% endif %} {% else %}
{% if next_url %} <li class="previous disabled">
<li class="next"><a href="{{ next_url }}">Next &raquo;</a></li> <a href="#">&laquo; Previous</a>
{% else %} </li>
<li class="next disabled"><a href="#">Next &raquo;</a></li> {% endif %}
{% endif %}
{% if next_url %}
<li class="next">
<a href="{{ next_url }}">Next &raquo;</a>
</li>
{% else %}
<li class="next disabled">
<a href="#">Next &raquo;</a>
</li>
{% endif %}
</ul> </ul>

View File

@ -2,11 +2,11 @@
{% csrf_token %} {% csrf_token %}
{{ form.non_field_errors }} {{ form.non_field_errors }}
{% for field in form %} {% for field in form %}
<div class="form-group"> <div class="form-group">
{{ field.label_tag|add_class:"col-sm-2 control-label" }} {{ field.label_tag|add_class:"col-sm-2 control-label" }}
<div class="col-sm-10"> <div class="col-sm-10">
{{ field|add_class:"form-control" }} {{ field|add_class:"form-control" }}
<span class="help-block">{{ field.help_text }}</span> <span class="help-block">{{ field.help_text }}</span>
</div>
</div> </div>
</div>
{% endfor %} {% endfor %}

View File

@ -1,14 +1,18 @@
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="{{ field.name }}" value="true" {% if value %}checked{% endif %}> <input type="checkbox" name="{{ field.name }}" value="true" {% if value %}checked{% endif %}>
{% if field.label %}{{ field.label }}{% endif %} {% if field.label %}{{ field.label }}{% endif %}
</label> </label>
</div> </div>
{% if field.errors %}
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %} {% if field.errors %}
{% endif %} {% for error in field.errors %}
{% if field.help_text %} <span class="help-block">{{ error }}</span>
<span class="help-block">{{ field.help_text }}</span> {% endfor %}
{% endif %} {% endif %}
</div>
{% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span>
{% endif %}
</div>

View File

@ -1,30 +1,35 @@
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %} {% if field.label %}
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label> <label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
{% endif %} {% endif %}
{% if style.inline %}
<div> {% if style.inline %}
{% for key, text in field.choices.items %} <div>
<label class="checkbox-inline"> {% for key, text in field.choices.items %}
<input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key in field.value %}checked{% endif %}> <label class="checkbox-inline">
{{ text }} <input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key in field.value %}checked{% endif %}>
</label> {{ text }}
{% endfor %} </label>
</div> {% endfor %}
{% else %} </div>
{% for key, text in field.choices.items %} {% else %}
<div class="checkbox"> {% for key, text in field.choices.items %}
<label> <div class="checkbox">
<input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key in field.value %}checked{% endif %}> <label>
{{ text }} <input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key in field.value %}checked{% endif %}>
</label> {{ text }}
</div> </label>
{% endfor %} </div>
{% endif %} {% endfor %}
{% if field.errors %} {% endif %}
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
{% endif %} {% if field.errors %}
{% if field.help_text %} {% for error in field.errors %}
<span class="help-block">{{ field.help_text }}</span> <span class="help-block">{{ error }}</span>
{% endif %} {% endfor %}
{% endif %}
{% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span>
{% endif %}
</div> </div>

View File

@ -1,9 +1,15 @@
{% load rest_framework %} {% load rest_framework %}
<fieldset> <fieldset>
{% if field.label %}<legend {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</legend>{% endif %} {% if field.label %}
{% for nested_field in field %} <legend {% if style.hide_label %}class="sr-only"{% endif %}>
{% if not nested_field.read_only %} {{ field.label }}
{% render_field nested_field style=style %} </legend>
{% endif %} {% endif %}
{% endfor %}
{% for nested_field in field %}
{% if not nested_field.read_only %}
{% render_field nested_field style=style %}
{% endif %}
{% endfor %}
</fieldset> </fieldset>

View File

@ -1,11 +1,12 @@
{% load rest_framework %} {% load rest_framework %}
<form role="form" action="." method="POST" novalidate> <form role="form" action="." method="POST" novalidate>
{% csrf_token %} {% csrf_token %}
{% for field in form %} {% for field in form %}
{% if not field.read_only %} {% if not field.read_only %}
{% render_field field style=style %} {% render_field field style=style %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<!-- form.non_field_errors -->
<button type="submit" class="btn btn-default">Submit</button> <button type="submit" class="btn btn-default">Submit</button>
</form> </form>

View File

@ -1,12 +1,17 @@
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %} {% if field.label %}
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label> <label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
{% endif %} {% endif %}
<input name="{{ field.name }}" {% if style.input_type != "file" %}class="form-control"{% endif %} type="{{ style.input_type }}" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
{% if field.errors %} <input name="{{ field.name }}" {% if style.input_type != "file" %}class="form-control"{% endif %} type="{{ style.input_type }}" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
{% endif %} {% if field.errors %}
{% if field.help_text %} {% for error in field.errors %}
<span class="help-block">{{ field.help_text }}</span> <span class="help-block">{{ error }}</span>
{% endif %} {% endfor %}
{% endif %}
{% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span>
{% endif %}
</div> </div>

View File

@ -1,4 +1,9 @@
<fieldset> <fieldset>
{% if field.label %}<legend {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</legend>{% endif %} {% if field.label %}
<p>Lists are not currently supported in HTML input.</p> <legend {% if style.hide_label %}class="sr-only"{% endif %}>
{{ field.label }}
</legend>
{% endif %}
<p>Lists are not currently supported in HTML input.</p>
</fieldset> </fieldset>

View File

@ -2,46 +2,55 @@
{% trans "None" as none_choice %} {% trans "None" as none_choice %}
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %} {% if field.label %}
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label> <label {% if style.hide_label %}class="sr-only"{% endif %}>
{% endif %} {{ field.label }}
</label>
{% endif %}
{% if style.inline %} {% if style.inline %}
<div> <div>
{% if field.allow_null or field.allow_blank %} {% if field.allow_null or field.allow_blank %}
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} /> <input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} />
{{ none_choice }} {{ none_choice }}
</label> </label>
{% endif %} {% endif %}
{% for key, text in field.choices.items %} {% for key, text in field.choices.items %}
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key == field.value %}checked{% endif %}> <input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key == field.value %}checked{% endif %}>
{{ text }} {{ text }}
</label> </label>
{% endfor %} {% endfor %}
</div> </div>
{% else %} {% else %}
{% if field.allow_null or field.allow_blank %} {% if field.allow_null or field.allow_blank %}
<div class="radio"> <div class="radio">
<label> <label>
<input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} /> <input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} />
{{ none_choice }} {{ none_choice }}
</label> </label>
</div> </div>
{% endif %} {% endif %}
{% for key, text in field.choices.items %}
<div class="radio"> {% for key, text in field.choices.items %}
<label> <div class="radio">
<input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key == field.value %}checked{% endif %}> <label>
{{ text }} <input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key == field.value %}checked{% endif %}>
</label> {{ text }}
</div> </label>
{% endfor %} </div>
{% endfor %}
{% endif %} {% endif %}
{% if field.errors %} {% if field.errors %}
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %} {% for error in field.errors %}
<span class="help-block">{{ error }}</span>
{% endfor %}
{% endif %} {% endif %}
{% if field.help_text %} {% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span> <span class="help-block">{{ field.help_text }}</span>
{% endif %} {% endif %}
</div> </div>

View File

@ -1,19 +1,27 @@
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %} {% if field.label %}
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label> <label {% if style.hide_label %}class="sr-only"{% endif %}>
{% endif %} {{ field.label }}
<select class="form-control" name="{{ field.name }}"> </label>
{% if field.allow_null or field.allow_blank %} {% endif %}
<option value="" {% if not field.value %}selected{% endif %}>--------</option>
{% endif %} <select class="form-control" name="{{ field.name }}">
{% for key, text in field.choices.items %} {% if field.allow_null or field.allow_blank %}
<option value="{{ key }}" {% if key == field.value %}selected{% endif %}>{{ text }}</option> <option value="" {% if not field.value %}selected{% endif %}>--------</option>
{% endfor %}
</select>
{% if field.errors %}
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
{% endif %}
{% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span>
{% endif %} {% endif %}
{% for key, text in field.choices.items %}
<option value="{{ key }}" {% if key == field.value %}selected{% endif %}>{{ text }}</option>
{% endfor %}
</select>
{% if field.errors %}
{% for error in field.errors %}
<span class="help-block">{{ error }}</span>
{% endfor %}
{% endif %}
{% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span>
{% endif %}
</div> </div>

View File

@ -2,20 +2,25 @@
{% trans "No items to select." as no_items %} {% trans "No items to select." as no_items %}
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %} {% if field.label %}
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label> <label {% if style.hide_label %}class="sr-only"{% endif %}>
{% endif %} {{ field.label }}
<select multiple {{ field.choices|yesno:",disabled" }} class="form-control" name="{{ field.name }}"> </label>
{% for key, text in field.choices.items %} {% endif %}
<option value="{{ key }}" {% if key in field.value %}selected{% endif %}>{{ text }}</option>
{% empty %} <select multiple {{ field.choices|yesno:",disabled" }} class="form-control" name="{{ field.name }}">
<option>{{ no_items }}</option> {% for key, text in field.choices.items %}
{% endfor %} <option value="{{ key }}" {% if key in field.value %}selected{% endif %}>{{ text }}</option>
</select> {% empty %}
<option>{{ no_items }}</option>
{% endfor %}
</select>
{% if field.errors %} {% if field.errors %}
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %} {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
{% endif %} {% endif %}
{% if field.help_text %} {% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span> <span class="help-block">{{ field.help_text }}</span>
{% endif %} {% endif %}
</div> </div>

View File

@ -1,12 +1,17 @@
<div class="form-group {% if field.errors %}has-error{% endif %}"> <div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %} {% if field.label %}
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label> <label {% if style.hide_label %}class="sr-only"{% endif %}>
{% endif %} {{ field.label }}
<textarea name="{{ field.name }}" class="form-control" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if style.rows %}rows="{{ style.rows }}"{% endif %}>{% if field.value %}{{ field.value }}{% endif %}</textarea> </label>
{% if field.errors %} {% endif %}
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
{% endif %} <textarea name="{{ field.name }}" class="form-control" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if style.rows %}rows="{{ style.rows }}"{% endif %}>{% if field.value %}{{ field.value }}{% endif %}</textarea>
{% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span> {% if field.errors %}
{% endif %} {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
{% endif %}
{% if field.help_text %}
<span class="help-block">{{ field.help_text }}</span>
{% endif %}
</div> </div>