Merge pull request #215 from esoergel/standardize_html

Standardize html
This commit is contained in:
Daniel Greenfeld 2013-06-24 10:15:28 -07:00
commit ecaa2ebef0
14 changed files with 395 additions and 314 deletions

View file

@ -6,10 +6,19 @@
{% block page_title %}Are you sure?{% endblock page_title %}
{% block breadcrumbs %}
<li><a href="{% url "admin2:dashboard" %}">Home</a> <span class="divider">/</span></li>
<li><a href="{% url "admin2:app_index" app_label=app_label %}">{{ app_label|title }}</a> <span class="divider">/</span></li>
<li><a href="{% url view|admin2_urlname:"index" %}">{{ model_name_pluralized|title }}</a> <span class="divider">/</span></li>
<li class="active">{% trans "Delete" %}</li>
<li>
<a href="{% url "admin2:dashboard" %}">Home</a>
<span class="divider">/</span>
</li>
<li>
<a href="{% url "admin2:app_index" app_label=app_label %}">{{ app_label|title }}</a>
<span class="divider">/</span>
</li>
<li>
<a href="{% url view|admin2_urlname:"index" %}">{{ model_name_pluralized|title }}</a>
<span class="divider">/</span>
</li>
<li class="active">{% trans "Delete" %}</li>
{% endblock breadcrumbs %}
@ -18,17 +27,17 @@
<p>{% blocktrans with objects_name=objects_name %}Are you sure you want to delete the selected {{ objects_name }}? All of the following items will be deleted:{% endblocktrans %}</p>
<ul>
{{ deletable_objects|unordered_list }}
{{ deletable_objects|unordered_list }}
</ul>
<form method="post">
{% csrf_token %}
<input type="hidden" name="confirmed" value="yes" />
<input type="hidden" name="action" value="DeleteSelectedAction" />
{% for item in queryset %}
<input type="hidden" name="selected_model_pk" value="{{ item.pk }}" />
{% endfor %}
<button class="btn btn-small btn-danger" type="submit">{% trans "Yes, I'm sure" %}</button>
{% csrf_token %}
<input type="hidden" name="confirmed" value="yes" />
<input type="hidden" name="action" value="DeleteSelectedAction" />
{% for item in queryset %}
<input type="hidden" name="selected_model_pk" value="{{ item.pk }}" />
{% endfor %}
<button class="btn btn-small btn-danger" type="submit">{% trans "Yes, I'm sure" %}</button>
</form>
{% endblock content %}

View file

@ -2,16 +2,19 @@
{% load admin2_tags i18n %}
{% block breadcrumbs %}
<li><a href="{% url "admin2:dashboard" %}">Home</a> <span class="divider">/</span></li>
<li class="active">{{ app_label|title }}</li>
<li>
<a href="{% url "admin2:dashboard" %}">Home</a>
<span class="divider">/</span>
</li>
<li class="active">{{ app_label|title }}</li>
{% endblock breadcrumbs %}
{% block page_title %}{% blocktrans with app_label=app_label|title %}{{ app_label }} administration{% endblocktrans %}{% endblock page_title %}
{% block content %}
<div class="row">
<div class="span7">
{% include 'admin2/bootstrap/includes/app_model_list.html' %}
</div>
<div class="span7">
{% include 'admin2/bootstrap/includes/app_model_list.html' %}
</div>
</div>
{% endblock content %}

View file

@ -8,21 +8,23 @@
{% block content %}
<div class="row">
<div class="span12">
{% if form.errors %}
<p class="error-note">
{% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
</p>
{% endif %}
<div class="span12">
{% if form.errors %}
<p class="error-note">
{% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
</p>
{% endif %}
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="hidden" name="this_is_the_login_form" value="1" />
<input type="hidden" name="next" value="{{ next }}" />
<button class="btn btn-small btn-success" type="submit">{% trans "Log in" %}</button>
</form>
</div>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="hidden" name="this_is_the_login_form" value="1" />
<input type="hidden" name="next" value="{{ next }}" />
<button class="btn btn-small btn-success" type="submit">
{% trans "Log in" %}
</button>
</form>
</div>
</div>
{% endblock content %}

View file

@ -4,15 +4,18 @@
{% load admin2_tags %}
{% block breadcrumbs %}
<li><a href="{% url "admin2:dashboard" %}">Home</a> <span class="divider">/</span></li>
<li class="active">{% trans "Logout" %}</li>
<li>
<a href="{% url "admin2:dashboard" %}">Home</a>
<span class="divider">/</span>
</li>
<li class="active">{% trans "Logout" %}</li>
{% endblock breadcrumbs %}
{% block content %}
<div class="row">
<div class="span12">
<p>{% trans "Thanks for spending some quality time with the Web site today." %}</p>
<p><p><a href="{% url 'admin2:dashboard' %}">{% trans 'Log in again' %}</a></p></p>
</div>
<div class="span12">
<p>{% trans "Thanks for spending some quality time with the Web site today." %}</p>
<p><a href="{% url 'admin2:dashboard' %}">{% trans 'Log in again' %}</a></p>
</div>
</div>
{% endblock content %}

View file

@ -7,14 +7,17 @@
{% block page_title %}{% trans 'Password change successful' %}{% endblock page_title %}
{% block breadcrumbs %}
<li><a href="{% url "admin2:dashboard" %}">Home</a> <span class="divider">/</span></li>
<li class="active">{% trans "Password change successful" %}</li>
<li>
<a href="{% url "admin2:dashboard" %}">Home</a>
<span class="divider">/</span>
</li>
<li class="active">{% trans "Password change successful" %}</li>
{% endblock breadcrumbs %}
{% block content %}
<div class="row">
<div class="span12">
<p>{% trans 'Your password was changed.' %}</p>
</div>
<div class="span12">
<p>{% trans 'Your password was changed.' %}</p>
</div>
</div>
{% endblock content %}

View file

@ -6,28 +6,31 @@
{% block page_title %}{% trans "Password change" %}: {{ form.user }}{% endblock page_title %}
{% block breadcrumbs %}
<li><a href="{% url "admin2:dashboard" %}">Home</a> <span class="divider">/</span></li>
<li class="active">{% trans "Password change" %} <span class="divider">/</span></li>
<li class="active">{{ form.user }}</li>
<li>
<a href="{% url "admin2:dashboard" %}">Home</a>
<span class="divider">/</span>
</li>
<li class="active">{% trans "Password change" %} <span class="divider">/</span></li>
<li class="active">{{ form.user }}</li>
{% endblock breadcrumbs %}
{% block content %}
<div class="row">
<div class="span12">
<p>Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly.</p>
<div class="span12">
<p>Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly.</p>
{% if form.errors %}
<p class="error-note">
{% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
</p>
{% endif %}
{% if form.errors %}
<p class="error-note">
{% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
</p>
{% endif %}
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button class="btn btn-small btn-success" type="submit" name="_save">{% trans "Change my password" %}</button>
</form>
</div>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button class="btn btn-small btn-success" type="submit" name="_save">{% trans "Change my password" %}</button>
</form>
</div>
</div>
{% endblock content %}

View file

@ -1,85 +1,85 @@
{% load i18n %}<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{% block title %}Site administration{% endblock title %} | django-admin2</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
{% block css %}
<link href="{{ STATIC_URL }}themes/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="{{ STATIC_URL }}themes/bootstrap/css/bootstrap-custom.css" rel="stylesheet" media="screen">
{% endblock css %}
</head>
<body>
{% block navbar %}
<div class="navbar navbar-inverse navbar-static-top">
<div class="navbar-inner">
<div class="container-fluid">
<a tabindex="1" class="brand" href="{% url 'admin2:dashboard' %}">Django-Admin2</a>
<ul class="nav pull-right">
<li><a tabindex="2" href="{% url 'admin2:api_index' %}">{% trans "API" %}</a></li>
{% if docsroot %}
<li><a tabindex="3" href="{{ docsroot }}">{% trans 'Documentation' %}</a></li>
{% endif %}
{% if user.is_authenticated %}
<li class="dropdown">
<a tabindex="4" href="#" class="dropdown-toggle" data-toggle="dropdown">
{% if user.get_full_name %}
{{ user.get_full_name }}
{% else %}
{% blocktrans with user=user.username %}
Logged in as {{ user }}
{% endblocktrans %}
{% endif %}
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
{% if user.has_usable_password %}
<li><a href="{% url 'admin2:password_change' user.id %}">{% trans "Change password" %}</a></li>
{% endif %}
<li><a href="{% url 'admin2:logout' %}">{% trans "Log out" %}</a></li>
</ul>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endblock navbar %}
{% block breacrumbs %}
<ul class="breadcrumb">
{% block breadcrumbs %}
<li class="active">Home</li>
{% endblock breadcrumbs %}
</ul>
{% endblock breacrumbs %}
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
<head>
<meta charset="utf-8">
<title>{% block title %}Site administration{% endblock title %} | django-admin2</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
{% block css %}
<link href="{{ STATIC_URL }}themes/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="{{ STATIC_URL }}themes/bootstrap/css/bootstrap-custom.css" rel="stylesheet" media="screen">
{% endblock css %}
</head>
<body>
{% block navbar %}
<div class="navbar navbar-inverse navbar-static-top">
<div class="navbar-inner">
<div class="container-fluid">
<div class="row">
<div class="span10">
<h3>{% block page_title %}{% trans "Site administration" %}{% endblock page_title %}</h3>
</div>
</div>
{% block content %}{% endblock content %}
</div>
<a tabindex="1" class="brand" href="{% url 'admin2:dashboard' %}">Django-Admin2</a>
{% block javascript %}
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="{{ STATIC_URL }}themes/bootstrap/js/jquery.min.js">\x3C/script>')</script>
<script src="{{ STATIC_URL }}themes/bootstrap/js/bootstrap.min.js"></script>
{% endblock javascript %}
</body>
<ul class="nav pull-right">
<li><a tabindex="2" href="{% url 'admin2:api_index' %}">{% trans "API" %}</a></li>
{% if docsroot %}
<li><a tabindex="3" href="{{ docsroot }}">{% trans 'Documentation' %}</a></li>
{% endif %}
{% if user.is_authenticated %}
<li class="dropdown">
<a tabindex="4" href="#" class="dropdown-toggle" data-toggle="dropdown">
{% if user.get_full_name %}
{{ user.get_full_name }}
{% else %}
{% blocktrans with user=user.username %}
Logged in as {{ user }}
{% endblocktrans %}
{% endif %}
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
{% if user.has_usable_password %}
<li><a href="{% url 'admin2:password_change' user.id %}">{% trans "Change password" %}</a></li>
{% endif %}
<li><a href="{% url 'admin2:logout' %}">{% trans "Log out" %}</a></li>
</ul>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endblock navbar %}
{% block breacrumbs %}
<ul class="breadcrumb">
{% block breadcrumbs %}
<li class="active">Home</li>
{% endblock breadcrumbs %}
</ul>
{% endblock breacrumbs %}
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
<div class="container-fluid">
<div class="row">
<div class="span10">
<h3>{% block page_title %}{% trans "Site administration" %}{% endblock page_title %}</h3>
</div>
</div>
{% block content %}{% endblock content %}
</div>
{% block javascript %}
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="{{ STATIC_URL }}themes/bootstrap/js/jquery.min.js">\x3C/script>')</script>
<script src="{{ STATIC_URL }}themes/bootstrap/js/bootstrap.min.js"></script>
{% endblock javascript %}
</body>
</html>

View file

@ -1,41 +1,48 @@
{% load i18n admin2_tags %}
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th colspan="3">
<a href="{% url 'admin2:app_index' app_label=app_label %}">{{ app_label|title }}</a>
</th>
</tr>
<tr>
<th colspan="3">
<a href="{% url 'admin2:app_index' app_label=app_label %}">
{{ app_label|title }}
</a>
</th>
</tr>
</thead>
<tbody>
{% for model_class, model_admin in registry.items %}
{% with permissions|for_admin:model_admin as permissions %}
{% if permissions.has_view_permission or permissions.has_add_permission or permissions.has_change_permission %}
{% if permissions.has_view_permission or permissions.has_add_permission or permissions.has_change_permission %}
<tr>
<td width="40%">
{% if permissions.has_view_permission %}<a href="{{ model_admin.get_index_url }}">{% endif %}
{{ model_admin.verbose_name_plural|title }}
{% if permissions.has_view_permission %}</a>{% endif %}
</td>
<td class="text-right">
{% if permissions.has_add_permission %}
<a href="{% url model_admin|admin2_urlname:'create' %}">
<i class="icon-plus"></i>
{% trans "Add" %}
</a>
{% endif %}
</td>
<td class="text-right">
{% if permissions.has_change_permission %}
<a href="{{ model_admin.get_index_url }}">
<i class="icon-pencil"></i>
{% trans "Change" %}
</a>
{% endif %}
</td>
<td width="40%">
{% if permissions.has_view_permission %}
<a href="{{ model_admin.get_index_url }}">
{% endif %}
{{ model_admin.verbose_name_plural|title }}
{% if permissions.has_view_permission %}</a>{% endif %}
</td>
<td class="text-right">
{% if permissions.has_add_permission %}
<a href="{% url model_admin|admin2_urlname:'create' %}">
<i class="icon-plus"></i>
{% trans "Add" %}
</a>
{% endif %}
</td>
<td class="text-right">
{% if permissions.has_change_permission %}
<a href="{{ model_admin.get_index_url }}">
<i class="icon-pencil"></i>
{% trans "Change" %}
</a>
{% endif %}
</td>
</tr>
{% endif %}
{% endif %}
{% endwith %}
{% endfor %}
</tbody>
</table>

View file

@ -4,15 +4,15 @@
{% block content %}
<div class="row">
<div class="span7">
{% for app_label, registry in apps.items %}
{% include 'admin2/bootstrap/includes/app_model_list.html' %}
{% endfor %}
</div>
<div class="span5">
<h4>{% trans "Recent Actions" %}</h4>
<h5>{% trans "My Actions" %}</h5>
TODO
</div>
<div class="span7">
{% for app_label, registry in apps.items %}
{% include 'admin2/bootstrap/includes/app_model_list.html' %}
{% endfor %}
</div>
<div class="span5">
<h4>{% trans "Recent Actions" %}</h4>
<h5>{% trans "My Actions" %}</h5>
TODO
</div>
</div>
{% endblock content %}

View file

@ -6,11 +6,23 @@
{% block page_title %}{% trans "Are you sure?" %}{% endblock page_title %}
{% block breadcrumbs %}
<li><a href="{% url "admin2:dashboard" %}">Home</a> <span class="divider">/</span></li>
<li><a href="{% url "admin2:app_index" app_label=app_label %}">{{ app_label|title }}</a> <span class="divider">/</span></li>
<li><a href="{% url view|admin2_urlname:"index" %}">{{ model_name_pluralized|title }}</a> <span class="divider">/</span></li>
<li><a href="{% url view|admin2_urlname:"detail" pk=object.pk %}">{{ object }}</a> <span class="divider">/</span></li>
<li class="active">{% trans "Delete" %}</li>
<li>
<a href="{% url "admin2:dashboard" %}">Home</a>
<span class="divider">/</span>
</li>
<li>
<a href="{% url "admin2:app_index" app_label=app_label %}">{{ app_label|title }}</a>
<span class="divider">/</span>
</li>
<li>
<a href="{% url view|admin2_urlname:"index" %}">{{ model_name_pluralized|title }}</a>
<span class="divider">/</span>
</li>
<li>
<a href="{% url view|admin2_urlname:"detail" pk=object.pk %}">{{ object }}</a>
<span class="divider">/</span>
</li>
<li class="active">{% trans "Delete" %}</li>
{% endblock breadcrumbs %}
{% block content %}
@ -18,13 +30,15 @@
<p>{% blocktrans with model_name=model_name object=object %}Are you sure you want to delete the {{ model_name }} "{{ object }}"? All of the following items will be deleted:{% endblocktrans %}</p>
<ul>
{{ deletable_objects|unordered_list }}
{{ deletable_objects|unordered_list }}
</ul>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button class="btn btn-small btn-danger" type="submit">{% trans "Yes, I'm sure" %}</button>
{% csrf_token %}
{{ form.as_p }}
<button class="btn btn-small btn-danger" type="submit">
{% trans "Yes, I'm sure" %}
</button>
</form>
{% endblock content %}

View file

@ -7,10 +7,19 @@
{% block page_title %}{{ object }}{% endblock page_title%}
{% block breadcrumbs %}
<li><a href="{% url "admin2:dashboard" %}">Home</a> <span class="divider">/</span></li>
<li><a href="{% url "admin2:app_index" app_label=app_label %}">{{ app_label|title }}</a> <span class="divider">/</span></li>
<li><a href="{% url view|admin2_urlname:"index" %}">{{ model_name_pluralized|title }}</a> <span class="divider">/</span></li>
<li class="active">{{ object }}</li>
<li>
<a href="{% url "admin2:dashboard" %}">Home</a>
<span class="divider">/</span>
</li>
<li>
<a href="{% url "admin2:app_index" app_label=app_label %}">{{ app_label|title }}</a>
<span class="divider">/</span>
</li>
<li>
<a href="{% url view|admin2_urlname:"index" %}">{{ model_name_pluralized|title }}</a>
<span class="divider">/</span>
</li>
<li class="active">{{ object }}</li>
{% endblock breadcrumbs %}
{% block content %}

View file

@ -10,90 +10,96 @@
{% endblock javascript %}
{% block breadcrumbs %}
<li><a href="{% url "admin2:dashboard" %}">Home</a> <span class="divider">/</span></li>
<li><a href="{% url "admin2:app_index" app_label=app_label %}">{{ app_label|title }}</a> <span class="divider">/</span></li>
<li class="active">{{ model_name_pluralized|title }}</li>
<li>
<a href="{% url "admin2:dashboard" %}">Home</a>
<span class="divider">/</span>
</li>
<li>
<a href="{% url "admin2:app_index" app_label=app_label %}">{{ app_label|title }}</a>
<span class="divider">/</span>
</li>
<li class="active">{{ model_name_pluralized|title }}</li>
{% endblock breadcrumbs %}
{% block content %}
{% if search_fields %}
<div class="row">
<div class="span12">
<form method="get" class="form-search">
<div class="input-append">
<input type="text" class="input-medium search-query" placeholder="Search Term" name="q" value="{{search_term}}"/>
<button class="btn" type="button"><i class="icon-search"></i> Search</button>
</div>
</form>
</div>
</div>
<div class="row">
<div class="span12">
<form method="get" class="form-search">
<div class="input-append">
<input type="text" class="input-medium search-query" placeholder="Search Term" name="q" value="{{search_term}}"/>
<button class="btn" type="button"><i class="icon-search"></i> Search</button>
</div>
</form>
</div>
</div>
{% endif %}
<div id="model-list" class="row">
<form id="model-list-form" class="form-inline" method="post">
{% csrf_token %}
<form id="model-list-form" class="form-inline" method="post">
{% csrf_token %}
<div class="span12">
<div class="navbar">
<div class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown">
Actions
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for action in actions %}
<li><a tabindex="-1" href="#" data-name="action" data-value="{{ action.name }}">{{ action.description }}</a></li>
{% endfor %}
</ul>
</div>
<input type="hidden" name="action" value="" />
<small class="muted"><span id="selected-count">0</span> of {{ object_list|length }} selected</small>
<div class="pull-right">
{% if permissions.has_add_permission %}
<a href="{% url view|admin2_urlname:'create' %}" class="btn"><i class="icon-plus"></i> {% blocktrans with model_verbose_name=model|model_verbose_name %}Add {{ model_verbose_name }}{% endblocktrans %}</a>
{% endif %}
</div>
</div>
<table class="table table-bordered table-striped">
<thead>
<th class="checkbox-column"><input type="checkbox" class="model-select-all"></th>
{% for attr in view.model_admin.list_display %}
{% if forloop.first and attr == "__str__" %}
<th>{{ model_name|capfirst }}</th>
{% else %}
<th>{{ attr }}</th>
{% endif%}
{% endfor %}
</thead>
<tbody>
{% for obj in object_list %}
<tr>
<td><input type="checkbox" class="model-select" name="selected_model_pk" value="{{ obj.pk }}"></td>
{% for attr in view.model_admin.list_display %}
<td>
{% if permissions.has_change_permission %}
<a href="{% url view|admin2_urlname:'update' pk=obj.pk %}">{% get_attr obj attr %}</a>
{% else %}
{% if permissions.has_view_permission %}
<a href="{% url view|admin2_urlname:'detail' pk=obj.pk %}">{% get_attr obj attr %}</a>
{% else %}
{% get_attr obj attr %}
{% endif %}
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{{ object_list|length }} {{ model_name_pluralized }}
<div class="span12">
<div class="navbar">
<div class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown">
Actions
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for action in actions %}
<li><a tabindex="-1" href="#" data-name="action" data-value="{{ action.name }}">{{ action.description }}</a></li>
{% endfor %}
</ul>
</div>
</form>
<input type="hidden" name="action" value="" />
<small class="muted"><span id="selected-count">0</span> of {{ object_list|length }} selected</small>
<div class="pull-right">
{% if permissions.has_add_permission %}
<a href="{% url view|admin2_urlname:'create' %}" class="btn"><i class="icon-plus"></i> {% blocktrans with model_verbose_name=model|model_verbose_name %}Add {{ model_verbose_name }}{% endblocktrans %}</a>
{% endif %}
</div>
</div>
<table class="table table-bordered table-striped">
<thead>
<th class="checkbox-column"><input type="checkbox" class="model-select-all"></th>
{% for attr in view.model_admin.list_display %}
{% if forloop.first and attr == "__str__" %}
<th>{{ model_name|capfirst }}</th>
{% else %}
<th>{{ attr }}</th>
{% endif%}
{% endfor %}
</thead>
<tbody>
{% for obj in object_list %}
<tr>
<td><input type="checkbox" class="model-select" name="selected_model_pk" value="{{ obj.pk }}"></td>
{% for attr in view.model_admin.list_display %}
<td>
{% if permissions.has_change_permission %}
<a href="{% url view|admin2_urlname:'update' pk=obj.pk %}">{% get_attr obj attr %}</a>
{% else %}
{% if permissions.has_view_permission %}
<a href="{% url view|admin2_urlname:'detail' pk=obj.pk %}">{% get_attr obj attr %}</a>
{% else %}
{% get_attr obj attr %}
{% endif %}
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{{ object_list|length }} {{ model_name_pluralized }}
</div>
</form>
</div>
{% endblock content %}

View file

@ -7,69 +7,80 @@
{% block page_title %}{% blocktrans with action=action model_name=model_name %}{{ action }} {{ model_name }}{% endblocktrans %}{% endblock page_title %}
{% block breadcrumbs %}
<li><a href="{% url "admin2:dashboard" %}">Home</a> <span class="divider">/</span></li>
<li><a href="{% url "admin2:app_index" app_label=app_label %}">{{ app_label|title }}</a> <span class="divider">/</span></li>
<li><a href="{% url view|admin2_urlname:"index" %}">{{ model_name_pluralized|title }}</a> <span class="divider">/</span></li>
{% if action == 'Add' %}
<li class="active">{{ action }}</li>
{% else %}
<li><a href="{% url view|admin2_urlname:"detail" pk=object.pk %}">{{ object }}</a> <span class="divider">/</span></li>
<li>
<a href="{% url "admin2:dashboard" %}">Home</a>
<span class="divider">/</span>
</li>
<li>
<a href="{% url "admin2:app_index" app_label=app_label %}">{{ app_label|title }}</a>
<span class="divider">/</span>
</li>
<li>
<a href="{% url view|admin2_urlname:"index" %}">{{ model_name_pluralized|title }}</a>
<span class="divider">/</span>
</li>
{% if action == 'Add' %}
<li class="active">{{ action }}</li>
{% else %}
<li>
<a href="{% url view|admin2_urlname:"detail" pk=object.pk %}">{{ object }}</a>
<span class="divider">/</span>
</li>
<li class="active">{% trans 'Change' %}</li>
{% endif %}
{% endif %}
{% endblock breadcrumbs %}
{% block content %}
<div class="row-fluid">
<div class="span12">
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<div class="span12">
<form method="post">
{% csrf_token %}
{{ form.as_p }}
{% for formset in inlines %}
<h4>{{ formset.model|model_verbose_name_plural|capfirst }}</h4>
{{ formset.management_form }}
<table class="table table-striped table-bordered">
<thead>
<tr>
{% for field in formset|formset_visible_fieldlist %}
<th>{{ field }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for inline_form in formset %}
<tr>
{% for field in inline_form.visible_fields %}
<td>
{% if forloop.first %}
{% for hidden_field in inline_form.hidden_fields %}
{{ hidden_field }}
{% endfor %}
{% endif %}
{{ field }}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
{% for formset in inlines %}
<h4>{{ formset.model|model_verbose_name_plural|capfirst }}</h4>
{{ formset.management_form }}
<table class="table table-striped table-bordered">
<thead>
<tr>
{% for field in formset|formset_visible_fieldlist %}
<th>{{ field }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for inline_form in formset %}
<tr>
{% for field in inline_form.visible_fields %}
<td>
{% if forloop.first %}
{% for hidden_field in inline_form.hidden_fields %}
{{ hidden_field }}
{% endfor %}
{% endif %}
{{ field }}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
<hr/>
{% if object %}
<a class="btn btn-small btn-danger" href="{% url view|admin2_urlname:'delete' pk=object.pk %}">{% trans "Delete" %}</a>
{% endif %}
<hr/>
{% if object %}
<a class="btn btn-small btn-danger" href="{% url view|admin2_urlname:'delete' pk=object.pk %}">{% trans "Delete" %}</a>
{% endif %}
<div class="pull-right">
<button class="btn btn-small" type="submit" name="_addanother">{% trans "Save and add another" %}</button>
<button class="btn btn-small" type="submit" name="_continue">{% trans "Save and continue editing" %}</button>
<button class="btn btn-small btn-success" type="submit" name="_save">{% trans "Save" %}</button>
</div>
</form>
</div>
<div class="pull-right">
<button class="btn btn-small" type="submit" name="_addanother">{% trans "Save and add another" %}</button>
<button class="btn btn-small" type="submit" name="_continue">{% trans "Save and continue editing" %}</button>
<button class="btn btn-small btn-success" type="submit" name="_save">{% trans "Save" %}</button>
</div>
</form>
</div>
</div>
{% endblock content %}

View file

@ -185,6 +185,9 @@ django-admin2 pull requests should be as small/atomic as possible. Large, wide-s
Best Practices
--------------
Python
~~~~~~
Follow PEP-0008 and memorize the Zen of Python::
>>> import this
@ -201,6 +204,14 @@ As much as possible, we follow the advice of the `Two Scoops of Django`_ book. P
.. _`Two Scoops of Django`: https://2scoops.org
Templates
~~~~~~~~~
Follow bootstrap's coding standards for HTML_ and CSS_. Use two spaces for indentation, and write so the templates are readable (not for the generated html).
.. _HTML: https://github.com/twitter/bootstrap/blob/master/CONTRIBUTING.md#coding-standards-html
.. _CSS: https://github.com/twitter/bootstrap/blob/master/CONTRIBUTING.md#coding-standards-css
How pull requests are checked, tested, and done
===============================================