diff --git a/djadmin2/templates/admin2/bootstrap/actions/delete_selected_confirmation.html b/djadmin2/templates/admin2/bootstrap/actions/delete_selected_confirmation.html index 53fdd5a..e4d0911 100644 --- a/djadmin2/templates/admin2/bootstrap/actions/delete_selected_confirmation.html +++ b/djadmin2/templates/admin2/bootstrap/actions/delete_selected_confirmation.html @@ -6,10 +6,19 @@ {% block page_title %}Are you sure?{% endblock page_title %} {% block breadcrumbs %} -
  • Home /
  • -
  • {{ app_label|title }} /
  • -
  • {{ model_name_pluralized|title }} /
  • -
  • {% trans "Delete" %}
  • +
  • + Home + / +
  • +
  • + {{ app_label|title }} + / +
  • +
  • + {{ model_name_pluralized|title }} + / +
  • +
  • {% trans "Delete" %}
  • {% endblock breadcrumbs %} @@ -18,17 +27,17 @@

    {% 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 %}

    - {% csrf_token %} - - - {% for item in queryset %} - - {% endfor %} - + {% csrf_token %} + + + {% for item in queryset %} + + {% endfor %} +
    {% endblock content %} diff --git a/djadmin2/templates/admin2/bootstrap/app_index.html b/djadmin2/templates/admin2/bootstrap/app_index.html index bf1c0ec..fc2be4d 100644 --- a/djadmin2/templates/admin2/bootstrap/app_index.html +++ b/djadmin2/templates/admin2/bootstrap/app_index.html @@ -2,16 +2,19 @@ {% load admin2_tags i18n %} {% block breadcrumbs %} -
  • Home /
  • -
  • {{ app_label|title }}
  • +
  • + Home + / +
  • +
  • {{ app_label|title }}
  • {% endblock breadcrumbs %} {% block page_title %}{% blocktrans with app_label=app_label|title %}{{ app_label }} administration{% endblocktrans %}{% endblock page_title %} {% block content %}
    -
    - {% include 'admin2/bootstrap/includes/app_model_list.html' %} -
    +
    + {% include 'admin2/bootstrap/includes/app_model_list.html' %} +
    {% endblock content %} diff --git a/djadmin2/templates/admin2/bootstrap/auth/login.html b/djadmin2/templates/admin2/bootstrap/auth/login.html index d5e376e..a5d78ed 100644 --- a/djadmin2/templates/admin2/bootstrap/auth/login.html +++ b/djadmin2/templates/admin2/bootstrap/auth/login.html @@ -8,21 +8,23 @@ {% block content %}
    -
    - {% if form.errors %} -

    - {% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} -

    - {% endif %} +
    + {% if form.errors %} +

    + {% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} +

    + {% endif %} -
    - {% csrf_token %} - {{ form.as_p }} - - - -
    -
    +
    + {% csrf_token %} + {{ form.as_p }} + + + +
    +
    {% endblock content %} diff --git a/djadmin2/templates/admin2/bootstrap/auth/logout.html b/djadmin2/templates/admin2/bootstrap/auth/logout.html index 7882926..25f383f 100644 --- a/djadmin2/templates/admin2/bootstrap/auth/logout.html +++ b/djadmin2/templates/admin2/bootstrap/auth/logout.html @@ -4,15 +4,18 @@ {% load admin2_tags %} {% block breadcrumbs %} -
  • Home /
  • -
  • {% trans "Logout" %}
  • +
  • + Home + / +
  • +
  • {% trans "Logout" %}
  • {% endblock breadcrumbs %} {% block content %}
    -
    -

    {% trans "Thanks for spending some quality time with the Web site today." %}

    -

    {% trans 'Log in again' %}

    -
    +
    +

    {% trans "Thanks for spending some quality time with the Web site today." %}

    +

    {% trans 'Log in again' %}

    +
    {% endblock content %} diff --git a/djadmin2/templates/admin2/bootstrap/auth/password_change_done.html b/djadmin2/templates/admin2/bootstrap/auth/password_change_done.html index a075f8e..66a45ee 100644 --- a/djadmin2/templates/admin2/bootstrap/auth/password_change_done.html +++ b/djadmin2/templates/admin2/bootstrap/auth/password_change_done.html @@ -7,14 +7,17 @@ {% block page_title %}{% trans 'Password change successful' %}{% endblock page_title %} {% block breadcrumbs %} -
  • Home /
  • -
  • {% trans "Password change successful" %}
  • +
  • + Home + / +
  • +
  • {% trans "Password change successful" %}
  • {% endblock breadcrumbs %} {% block content %}
    -
    -

    {% trans 'Your password was changed.' %}

    -
    +
    +

    {% trans 'Your password was changed.' %}

    +
    {% endblock content %} diff --git a/djadmin2/templates/admin2/bootstrap/auth/password_change_form.html b/djadmin2/templates/admin2/bootstrap/auth/password_change_form.html index 958a56c..f49abe7 100644 --- a/djadmin2/templates/admin2/bootstrap/auth/password_change_form.html +++ b/djadmin2/templates/admin2/bootstrap/auth/password_change_form.html @@ -6,28 +6,31 @@ {% block page_title %}{% trans "Password change" %}: {{ form.user }}{% endblock page_title %} {% block breadcrumbs %} -
  • Home /
  • -
  • {% trans "Password change" %} /
  • -
  • {{ form.user }}
  • +
  • + Home + / +
  • +
  • {% trans "Password change" %} /
  • +
  • {{ form.user }}
  • {% endblock breadcrumbs %} {% block content %}
    -
    -

    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.

    +
    +

    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.

    - {% if form.errors %} -

    - {% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} -

    - {% endif %} + {% if form.errors %} +

    + {% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} +

    + {% endif %} -
    - {% csrf_token %} - {{ form.as_p }} - -
    -
    +
    + {% csrf_token %} + {{ form.as_p }} + +
    +
    {% endblock content %} diff --git a/djadmin2/templates/admin2/bootstrap/base.html b/djadmin2/templates/admin2/bootstrap/base.html index c6668a3..8d50cb7 100644 --- a/djadmin2/templates/admin2/bootstrap/base.html +++ b/djadmin2/templates/admin2/bootstrap/base.html @@ -1,85 +1,85 @@ {% load i18n %} - - - - {% block title %}Site administration{% endblock title %} | django-admin2 - - - {% block css %} - - - {% endblock css %} - - - {% block navbar %} - - {% endblock navbar %} - - {% block breacrumbs %} - - {% endblock breacrumbs %} - - {% if messages %} - - {% endif %} + + + {% block title %}Site administration{% endblock title %} | django-admin2 + + + {% block css %} + + + {% endblock css %} + + + {% block navbar %} + + + {% endblock navbar %} + + {% block breacrumbs %} + + {% endblock breacrumbs %} + + {% if messages %} + + {% endif %} + +
    +
    +
    +

    {% block page_title %}{% trans "Site administration" %}{% endblock page_title %}

    +
    +
    + {% block content %}{% endblock content %} +
    + + {% block javascript %} + + + + {% endblock javascript %} + diff --git a/djadmin2/templates/admin2/bootstrap/includes/app_model_list.html b/djadmin2/templates/admin2/bootstrap/includes/app_model_list.html index 9474181..cb864d4 100644 --- a/djadmin2/templates/admin2/bootstrap/includes/app_model_list.html +++ b/djadmin2/templates/admin2/bootstrap/includes/app_model_list.html @@ -1,41 +1,48 @@ {% load i18n admin2_tags %} + - - - + + + + {% 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 %} - - - + + + -{% endif %} + {% endif %} {% endwith %} {% endfor %} +
    - {{ app_label|title }} -
    + + {{ app_label|title }} + +
    - {% if permissions.has_view_permission %}{% endif %} - {{ model_admin.verbose_name_plural|title }} - {% if permissions.has_view_permission %}{% endif %} - - {% if permissions.has_add_permission %} - - - {% trans "Add" %} - - {% endif %} - - {% if permissions.has_change_permission %} - - - {% trans "Change" %} - - {% endif %} - + {% if permissions.has_view_permission %} + + {% endif %} + {{ model_admin.verbose_name_plural|title }} + {% if permissions.has_view_permission %}{% endif %} + + {% if permissions.has_add_permission %} + + + {% trans "Add" %} + + {% endif %} + + {% if permissions.has_change_permission %} + + + {% trans "Change" %} + + {% endif %} +
    diff --git a/djadmin2/templates/admin2/bootstrap/index.html b/djadmin2/templates/admin2/bootstrap/index.html index 1314c15..11eb551 100644 --- a/djadmin2/templates/admin2/bootstrap/index.html +++ b/djadmin2/templates/admin2/bootstrap/index.html @@ -4,15 +4,15 @@ {% block content %}
    -
    - {% for app_label, registry in apps.items %} - {% include 'admin2/bootstrap/includes/app_model_list.html' %} - {% endfor %} -
    -
    -

    {% trans "Recent Actions" %}

    -
    {% trans "My Actions" %}
    - TODO -
    +
    + {% for app_label, registry in apps.items %} + {% include 'admin2/bootstrap/includes/app_model_list.html' %} + {% endfor %} +
    +
    +

    {% trans "Recent Actions" %}

    +
    {% trans "My Actions" %}
    + TODO +
    {% endblock content %} diff --git a/djadmin2/templates/admin2/bootstrap/model_confirm_delete.html b/djadmin2/templates/admin2/bootstrap/model_confirm_delete.html index f653d97..819fd76 100644 --- a/djadmin2/templates/admin2/bootstrap/model_confirm_delete.html +++ b/djadmin2/templates/admin2/bootstrap/model_confirm_delete.html @@ -6,11 +6,23 @@ {% block page_title %}{% trans "Are you sure?" %}{% endblock page_title %} {% block breadcrumbs %} -
  • Home /
  • -
  • {{ app_label|title }} /
  • -
  • {{ model_name_pluralized|title }} /
  • -
  • {{ object }} /
  • -
  • {% trans "Delete" %}
  • +
  • + Home + / +
  • +
  • + {{ app_label|title }} + / +
  • +
  • + {{ model_name_pluralized|title }} + / +
  • +
  • + {{ object }} + / +
  • +
  • {% trans "Delete" %}
  • {% endblock breadcrumbs %} {% block content %} @@ -18,13 +30,15 @@

    {% 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 %}

    - {% csrf_token %} - {{ form.as_p }} - + {% csrf_token %} + {{ form.as_p }} +
    {% endblock content %} diff --git a/djadmin2/templates/admin2/bootstrap/model_detail.html b/djadmin2/templates/admin2/bootstrap/model_detail.html index 6b6ea43..b115fcf 100644 --- a/djadmin2/templates/admin2/bootstrap/model_detail.html +++ b/djadmin2/templates/admin2/bootstrap/model_detail.html @@ -7,10 +7,19 @@ {% block page_title %}{{ object }}{% endblock page_title%} {% block breadcrumbs %} -
  • Home /
  • -
  • {{ app_label|title }} /
  • -
  • {{ model_name_pluralized|title }} /
  • -
  • {{ object }}
  • +
  • + Home + / +
  • +
  • + {{ app_label|title }} + / +
  • +
  • + {{ model_name_pluralized|title }} + / +
  • +
  • {{ object }}
  • {% endblock breadcrumbs %} {% block content %} diff --git a/djadmin2/templates/admin2/bootstrap/model_list.html b/djadmin2/templates/admin2/bootstrap/model_list.html index 9f42bd3..9da5db2 100644 --- a/djadmin2/templates/admin2/bootstrap/model_list.html +++ b/djadmin2/templates/admin2/bootstrap/model_list.html @@ -10,90 +10,96 @@ {% endblock javascript %} {% block breadcrumbs %} -
  • Home /
  • -
  • {{ app_label|title }} /
  • -
  • {{ model_name_pluralized|title }}
  • +
  • + Home + / +
  • +
  • + {{ app_label|title }} + / +
  • +
  • {{ model_name_pluralized|title }}
  • {% endblock breadcrumbs %} {% block content %} {% if search_fields %} -
    -
    - -
    -
    +
    +
    + +
    +
    {% endif %}
    -
    - {% csrf_token %} + + {% csrf_token %} -
    - - - - - - - {% for attr in view.model_admin.list_display %} - {% if forloop.first and attr == "__str__" %} - - {% else %} - - {% endif%} - {% endfor %} - - - {% for obj in object_list %} - - - {% for attr in view.model_admin.list_display %} - - {% endfor %} - - {% endfor %} - -
    {{ model_name|capfirst }}{{ attr }}
    - {% if permissions.has_change_permission %} - {% get_attr obj attr %} - {% else %} - {% if permissions.has_view_permission %} - {% get_attr obj attr %} - {% else %} - {% get_attr obj attr %} - {% endif %} - {% endif %} -
    - - {{ object_list|length }} {{ model_name_pluralized }} +
    + + + + + + + {% for attr in view.model_admin.list_display %} + {% if forloop.first and attr == "__str__" %} + + {% else %} + + {% endif%} + {% endfor %} + + + {% for obj in object_list %} + + + {% for attr in view.model_admin.list_display %} + + {% endfor %} + + {% endfor %} + +
    {{ model_name|capfirst }}{{ attr }}
    + {% if permissions.has_change_permission %} + {% get_attr obj attr %} + {% else %} + {% if permissions.has_view_permission %} + {% get_attr obj attr %} + {% else %} + {% get_attr obj attr %} + {% endif %} + {% endif %} +
    + + {{ object_list|length }} {{ model_name_pluralized }} +
    +
    {% endblock content %} diff --git a/djadmin2/templates/admin2/bootstrap/model_update_form.html b/djadmin2/templates/admin2/bootstrap/model_update_form.html index f8ef478..f9cd750 100644 --- a/djadmin2/templates/admin2/bootstrap/model_update_form.html +++ b/djadmin2/templates/admin2/bootstrap/model_update_form.html @@ -7,69 +7,80 @@ {% block page_title %}{% blocktrans with action=action model_name=model_name %}{{ action }} {{ model_name }}{% endblocktrans %}{% endblock page_title %} {% block breadcrumbs %} -
  • Home /
  • -
  • {{ app_label|title }} /
  • -
  • {{ model_name_pluralized|title }} /
  • - {% if action == 'Add' %} -
  • {{ action }}
  • - {% else %} -
  • {{ object }} /
  • +
  • + Home + / +
  • +
  • + {{ app_label|title }} + / +
  • +
  • + {{ model_name_pluralized|title }} + / +
  • + {% if action == 'Add' %} +
  • {{ action }}
  • + {% else %} +
  • + {{ object }} + / +
  • {% trans 'Change' %}
  • - {% endif %} - + {% endif %} {% endblock breadcrumbs %} {% block content %}
    -
    -
    - {% csrf_token %} - {{ form.as_p }} +
    + + {% csrf_token %} + {{ form.as_p }} - {% for formset in inlines %} -

    {{ formset.model|model_verbose_name_plural|capfirst }}

    - {{ formset.management_form }} - - - - {% for field in formset|formset_visible_fieldlist %} - - {% endfor %} - - - - {% for inline_form in formset %} - - {% for field in inline_form.visible_fields %} - - {% endfor %} - - {% endfor %} - -
    {{ field }}
    - {% if forloop.first %} - {% for hidden_field in inline_form.hidden_fields %} - {{ hidden_field }} - {% endfor %} - {% endif %} - {{ field }} -
    - {% endfor %} + {% for formset in inlines %} +

    {{ formset.model|model_verbose_name_plural|capfirst }}

    + {{ formset.management_form }} + + + + {% for field in formset|formset_visible_fieldlist %} + + {% endfor %} + + + + {% for inline_form in formset %} + + {% for field in inline_form.visible_fields %} + + {% endfor %} + + {% endfor %} + +
    {{ field }}
    + {% if forloop.first %} + {% for hidden_field in inline_form.hidden_fields %} + {{ hidden_field }} + {% endfor %} + {% endif %} + {{ field }} +
    + {% endfor %} -
    - {% if object %} - {% trans "Delete" %} - {% endif %} +
    + {% if object %} + {% trans "Delete" %} + {% endif %} -
    - - - -
    - -
    +
    + + + +
    + +
    {% endblock content %} diff --git a/docs/contributing.rst b/docs/contributing.rst index 0881355..1e8df25 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -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 ===============================================