9👍
with django 1.2:
data-id="{{ form.instance.id|stringformat:'d' }}"
or, with django 1.3:
{% load l10n %}
{% localize off %}
data-id="{{ form.instance.id|stringformat:'d' }}"
{% endlocalize %}
or (also with django 1.3):
data-id="{{ form.instance.id|unlocalize }}"
- Display list of all tests in a Django project
- What permissions does django-storages require for an s3 IAM user?
- Uwsgi: unrecognized option '–module=MyProject.wsgi:application'
- Error when creating a custom response message
0👍
This doesn’t really answer your question but check out this section of the docs
. It says to use {{ |unlocalize }}
filter or:
{% localize on %}
{{ value }}
{% endlocalize %}
{% localize off %}
{{ value }}
{% endlocalize %}
There’s probably a better way but I’m thinking that you could write a method that gives you the id as a string in your model for each model you are trying to display the id in a template.
class MyModel(models.Model):
pass
def str_id(self):
return u'%s' % self.id
in your template:
{{ form.instance.str_id }}
Source:stackexchange.com