Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Translations for HTML filters
  • Loading branch information
lovelydinosaur committed Aug 28, 2015
commit f34777a2e9241e4995bd558eede616f872e65b57
3 changes: 2 additions & 1 deletion rest_framework/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
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
Expand All @@ -31,7 +32,7 @@ def __init__(self, *args, **kwargs):
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()
Expand Down
2 changes: 1 addition & 1 deletion rest_framework/templates/rest_framework/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Expand Down
3 changes: 2 additions & 1 deletion rest_framework/templates/rest_framework/base.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load staticfiles %}
{% load rest_framework %}
{% load i18n %}
<!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -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 %}

Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% load crispy_forms_tags %}
{% load i18n %}

<h2>Field filters</h2>
<h2>{% trans "Field filters" %}</h2>
{% crispy filter.form %}
Original file line number Diff line number Diff line change
@@ -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 %}
Expand Down
3 changes: 2 additions & 1 deletion rest_framework/templates/rest_framework/filters/search.html
Original file line number Diff line number Diff line change
@@ -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">
Expand Down