Re: Tag arguments rendering
On Tue, 2008-07-01 at 23:01 -0700, Yosifov Pavel wrote: > > > On 2 июл, 10:54, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Tue, 2008-07-01 at 20:44 -0700, Yosifov Pavel wrote: > > > I made own tags. Sometimes I want to "rendering" arguments (when > > > arguments of the tag are Django-template-expressions). So, I use > > > template.render() method. All is OK but it's look like this: > > > > > {% some_tag {{var}} %} > > > > You can put whatever you want into your own custom tags, but this won't > > work for normal Django tags. > > So, I can not use common syntax for arguments of built-in tags? > Something like {{var|default:..}} ? That's not a tag. "{% ... %}" is a tag. "{{...}}" displays a variable (possibly after passing it through some filters. I'm not sure if that's the source of your confusion here. I don't really understand the rest of your questions. The Django documentation (particularly templates.txt) give quite a lot of examples of using both template tags and filters that show how it's done. > Django's templates doesnt support this? Yes? > But I can do it in own tags because of using rendering of {{var| > default:} as mini template. Right? > So, resume: tag arguments in built-in tags and own tags are not > symmetric: in own tags they are more flexible... In your own tags, you can parse the contents however you like, was all I meant (have a look at any tag code and you'll see that it parses the contents initially -- you can insert whatever code you like there). I certainly wouldn't recommend it, however. It's not required for functionality purposes. Regards, Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Tag arguments rendering
On 2 июл, 10:54, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2008-07-01 at 20:44 -0700, Yosifov Pavel wrote: > > I made own tags. Sometimes I want to "rendering" arguments (when > > arguments of the tag are Django-template-expressions). So, I use > > template.render() method. All is OK but it's look like this: > > > {% some_tag {{var}} %} > > You can put whatever you want into your own custom tags, but this won't > work for normal Django tags. So, I can not use common syntax for arguments of built-in tags? Something like {{var|default:..}} ? Django's templates doesnt support this? Yes? But I can do it in own tags because of using rendering of {{var| default:} as mini template. Right? So, resume: tag arguments in built-in tags and own tags are not symmetric: in own tags they are more flexible... Or I must refuse of this method of argument's rendering... > The {{...}} is only used to display the > contents of a variable in a template. > > > but in built-in tags this is usually without {{..}}: > > {% builtin_tag var %} > > This is the way variables are passed to tags. > > Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Tag arguments rendering
On Tue, 2008-07-01 at 20:44 -0700, Yosifov Pavel wrote: > I made own tags. Sometimes I want to "rendering" arguments (when > arguments of the tag are Django-template-expressions). So, I use > template.render() method. All is OK but it's look like this: > > {% some_tag {{var}} %} You can put whatever you want into your own custom tags, but this won't work for normal Django tags. The {{...}} is only used to display the contents of a variable in a template. > but in built-in tags this is usually without {{..}}: > {% builtin_tag var %} This is the way variables are passed to tags. Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Tag arguments rendering
I made own tags. Sometimes I want to "rendering" arguments (when arguments of the tag are Django-template-expressions). So, I use template.render() method. All is OK but it's look like this: {% some_tag {{var}} %} but in built-in tags this is usually without {{..}}: {% builtin_tag var %} What is right style? If I render arguments in another way, I thing it will be less flexible: it will be impossible to create complex django- template-expressions... What is the best practice? -- /aquagnu --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---