开发者

What is location of django Built-in tags and filters?

What is location of开发者_运维百科 django Built-in tags and filters? I cant find anywhere... I need it to format datetime so then i can send right formt in JSON by AJAX response.. Or maybe you can suggest me another way to do that...

What i want to do it's import function which determinate filter... and use it to format my datetime in JSON.

Look.. i have...

media_items = Media.objects.filter(blablabla=blablabla)

than i do

data = serializers.serialize('json', media_items, fields=('name','duration','on_air'))

How can I do so in data(what is JSON) i have right date format? What is the simplest way?


What do you mean location? Do you mean where in Django's code does it live? If so, the default filters live in django.template.defaultfilters.

If you're wanting to do date formatting in a view, then use dateformat.

You can see an example of how to use dateformat in the code for the time filter, visible here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜