a work in progress test of custom filters
This commit is contained in:
parent
9d6c4b308c
commit
b53f52cac1
|
@ -9,7 +9,3 @@ class CurrencyForm(forms.Form):
|
||||||
|
|
||||||
CURRENCY_CHOICES = [(t.name, t.name) for t in
|
CURRENCY_CHOICES = [(t.name, t.name) for t in
|
||||||
ExchangeRate_name.objects.all()]
|
ExchangeRate_name.objects.all()]
|
||||||
|
|
||||||
type = forms.ChoiceField(choices=CURRENCY_CHOICES,
|
|
||||||
widget=forms.Select(attrs={
|
|
||||||
'onchange': 'get_vehicle_color();'}))
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
from django import template
|
||||||
|
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter()
|
||||||
|
def boldcoffee(value):
|
||||||
|
return '%s !!gefiltert!!' % value
|
||||||
|
|
||||||
|
# excample filter: {{ article.price_in_chf|boldcoffee }}
|
|
@ -8,7 +8,8 @@
|
||||||
},
|
},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
alert("es pop auf! --dies kommt von: static/js/app.js--.");
|
var foo = jQuery.parseJSON(data);
|
||||||
|
alert("es pop auf! --dies kommt von: static/js/app.js--." + foo.currency_update);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "webshop/base.html" %}
|
{% extends "webshop/base.html" %}
|
||||||
|
{% load customfilters %}
|
||||||
{% block section_title %}Articles{% endblock %}
|
{% block section_title %}Articles{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td scope="col">{{ article.category }}</td>
|
<td scope="col">{{ article.category }}</td>
|
||||||
<td scope="col">{{ article.stock }}</td>
|
<td scope="col">{{ article.stock }}</td>
|
||||||
<td scope="col">{{ article.price_in_chf }}</td>
|
<td scope="col">{{ article.price_in_chf|boldcoffee }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue