Re: Variables in TemplateTags

2007-10-03 Thread niklas.voss

On 3 Okt., 13:18, peschler <[EMAIL PROTECTED]> wrote:
> Hi Niklas,
>
> > So in code it should look like this:
> > If user is my argument that was given to render_to_response, i want to
> > give the function the submodel status of user; like this:
> > {{ percentbar user.status }}
>
> Some docs on how to achieve this can be found 
> here:http://www.djangoproject.com/documentation/templates_python/#passing-...
>
> Hope that helps,
> Peter
>
> > Is there a way to give this variable to the percentbar function in the
> > template?
> > Or should I do it through the views.py...
>
> > I hope you understood my problem, because my english is very bad :)
>
> > Niklas Voss

Thank you, i was looking for that :)
You helped me very well, so big thanks!

Niklas Voss


--~--~-~--~~~---~--~~
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: Variables in TemplateTags

2007-10-03 Thread peschler

Hi Niklas,



> So in code it should look like this:
> If user is my argument that was given to render_to_response, i want to
> give the function the submodel status of user; like this:
> {{ percentbar user.status }}
>

Some docs on how to achieve this can be found here:
http://www.djangoproject.com/documentation/templates_python/#passing-template-variables-to-the-tag

Hope that helps,
Peter

> Is there a way to give this variable to the percentbar function in the
> template?
> Or should I do it through the views.py...
>
> I hope you understood my problem, because my english is very bad :)
>
> Niklas Voss


--~--~-~--~~~---~--~~
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: Variables in TemplateTags

2007-10-02 Thread Michael

Hi Niklas,

I'm not certain, but you might find that the default template tag,
widthratio already does what you need:
http://www.djangoproject.com/documentation/templates/#widthratio

The example shows how it can be used to create bar-charts etc. (to
display percentage complete).

Otherwise, yes your custom template can access the variable's value.
You can look at the source of the widthratio tag to see how it's done
there (django_src/django/templates/defaulttags.py).

-Michael

On Oct 3, 4:07 am, "niklas.voss" <[EMAIL PROTECTED]> wrote:
> I have a Problem and can't find anything about it, that helps me...
>
> I integrated a self-made templatetag into django and it works well.
> this tag just generate a percent bar.
> There is only one argument which is given to the function, it is the
> percentage status, but i dont want a static percentage by giving
> everytime the page loads the same argument, instead of this there
> shoud be a variable, which shows the user his status.
>
> So in code it should look like this:
> If user is my argument that was given to render_to_response, i want to
> give the function the submodel status of user; like this:
> {{ percentbar user.status }}
>
> Is there a way to give this variable to the percentbar function in the
> template?
> Or should I do it through the views.py...
>
> I hope you understood my problem, because my english is very bad :)
>
> Niklas Voss


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Variables in TemplateTags

2007-10-02 Thread niklas.voss

I have a Problem and can't find anything about it, that helps me...

I integrated a self-made templatetag into django and it works well.
this tag just generate a percent bar.
There is only one argument which is given to the function, it is the
percentage status, but i dont want a static percentage by giving
everytime the page loads the same argument, instead of this there
shoud be a variable, which shows the user his status.

So in code it should look like this:
If user is my argument that was given to render_to_response, i want to
give the function the submodel status of user; like this:
{{ percentbar user.status }}

Is there a way to give this variable to the percentbar function in the
template?
Or should I do it through the views.py...

I hope you understood my problem, because my english is very bad :)



Niklas Voss


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---