Translations for HTML filters

This commit is contained in:
Tom Christie 2015-08-28 14:55:22 +01:00
parent 0b77e733a8
commit f34777a2e9
7 changed files with 14 additions and 8 deletions

View File

@ -12,6 +12,7 @@ from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.template import Context, loader
from django.utils import six
from django.utils.translation import ugettext_lazy as _
from rest_framework.compat import (
crispy_forms, distinct, django_filters, get_model_name, guardian
@ -31,7 +32,7 @@ if 'crispy_forms' in settings.INSTALLED_APPS and crispy_forms and django_filters
field.help_text = None
layout_components = list(self.form.fields.keys()) + [
Submit('', 'Submit', css_class='btn-default'),
Submit('', _('Submit'), css_class='btn-default'),
]
helper = FormHelper()

View File

@ -116,7 +116,7 @@
{% if filter_form %}
<button style="float: right; margin-right: 10px" data-toggle="modal" data-target="#filtersModal" class="btn btn-default">
<span class="glyphicon glyphicon-wrench" aria-hidden="true"></span>
Filters
{% trans "Filters" %}
</button>
{% endif %}

View File

@ -1,5 +1,6 @@
{% load staticfiles %}
{% load rest_framework %}
{% load i18n %}
<!DOCTYPE html>
<html>
<head>
@ -112,7 +113,7 @@
{% if filter_form %}
<button style="float: right; margin-right: 10px" data-toggle="modal" data-target="#filtersModal" class="btn btn-default">
<span class="glyphicon glyphicon-wrench" aria-hidden="true"></span>
Filters
{% trans "Filters" %}
</button>
{% endif %}

View File

@ -1,5 +1,6 @@
<h2>Field filters</h2>
{% load i18n %}
<h2>{% trans "Field filters" %}</h2>
<form class="form" action="" method="get">
{{ filter.form.as_p }}
<button type="submit" class="btn btn-primary">Submit</button>
<button type="submit" class="btn btn-primary">{% trans "Submit" %}</button>
</form>

View File

@ -1,4 +1,5 @@
{% load crispy_forms_tags %}
{% load i18n %}
<h2>Field filters</h2>
<h2>{% trans "Field filters" %}</h2>
{% crispy filter.form %}

View File

@ -1,5 +1,6 @@
{% load rest_framework %}
<h2>Ordering</h2>
{% load i18n %}
<h2>{% trans "Ordering" %}</h2>
<div class="list-group">
{% for key, label in options %}
{% if key == current %}

View File

@ -1,4 +1,5 @@
<h2>Search</h2>
{% load i18n %}
<h2>{% trans "Search" %}</h2>
<form class="form-inline">
<div class="form-group">
<div class="input-group">