Re: variable inside a template

2022-06-16 Thread Antonis Christofides
What you are trying to do is very unusual, and any solution to exactly what you are asking is going to be an ugly hack. So, why do you want to do this? What are these static files that you have in mylist? On 16/06/2022 14.09, luca72.b...@gmail.com wrote: Hello i have a list like: mylist = 

Re: variable inside a template

2022-06-16 Thread Larry Martell
On Thu, Jun 16, 2022 at 4:09 AM luca72.b...@gmail.com wrote: > > Hello i have a list like: > mylist = ['1,png','2.png',3.jpj'] > in the template i do as follow: > {% for o in mylist %} > > {% if "png" in o %} > {{ o }} > > {% else %} > {{o}}

Re: variable inside a template

2022-06-16 Thread Sencer Hamarat
Don use 'o' as a template variable in the template function Use {% static 'poll/'|add:o %} instead. 16 Haz 2022 Per 14:09 tarihinde luca72.b...@gmail.com < luca72.bertolo...@gmail.com> şunu yazdı: > Hello i have a list like: > mylist = ['1,png','2.png',3.jpj'] > in the template

variable inside a template

2022-06-16 Thread luca72.b...@gmail.com
Hello i have a list like: mylist = ['1,png','2.png',3.jpj'] in the template i do as follow: {% for o in mylist %} {% if "png" in o %} {{ o }} {% else %} {{o}} {% endif %} {% endfor %} in the template i see the file

Re: using variable in django template

2021-02-16 Thread Kasper Laudrup
On 16/02/2021 13.18, Jiffin George Kokkat wrote: Hi guys, i want to declare a variable in django template and update value of variable inside a loop https://pythoncircle.com/post/701/how-to-set-a-variable-in-django-template/ https://pythoncircle.com/post/685/for-loop-in-django-template

using variable in django template

2021-02-16 Thread Jiffin George Kokkat
Hi guys, i want to declare a variable in django template and update value of variable inside a loop how to do Thanks, Jiffin George Kokkat -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiv

Re: Setting variable in custom template

2017-04-04 Thread Mahendra Gaur
gt; wrote: > Hi there > > is there any chance to set the value of variable in django custom template? > > I am looking for something like {set variable = "test"} > > But i Cannot make it to work! > > Any clue? > > rgds valerio > > -- > You r

RE: Setting variable in custom template

2017-04-04 Thread Matthew Pava
template Hi there is there any chance to set the value of variable in django custom template? I am looking for something like {set variable = "test"} But i Cannot make it to work! Any clue? rgds valerio -- You received this message because you are subscribed to the Google Groups &qu

Setting variable in custom template

2017-04-04 Thread valerio orfano
Hi there is there any chance to set the value of variable in django custom template? I am looking for something like {set variable = "test"} But i Cannot make it to work! Any clue? rgds valerio -- You received this message because you are subscribed to the Google Groups &qu

Re: javascript variable to django template

2016-11-15 Thread GMail
Hi, As any other variable: var myAwesomeVar = {{ my_awesome_var }}; alert(myAwesomeVar); > On 15 Nov 2016, at 18:46, kml Awad <ka.ao...@gmail.com> wrote: > > Hi, > > How can I inject javacript object (variable ) in django template (html) ? > > Thank you

javascript variable to django template

2016-11-15 Thread kml Awad
Hi, How can I inject javacript object (variable ) in django template (html) ? Thank you for your help. regards. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, sen

Re: Show the output of python variable in django template

2016-11-11 Thread Marlysson Silva
How are your code, view..? Em sexta-feira, 11 de novembro de 2016 09:07:26 UTC-3, Dattatreya Sadhu escreveu: > > I am building a chat bot application. > i have created a form in my html view and send a post request and in > python i am able to capture it > > but i am not able to send my result

Show the output of python variable in django template

2016-11-11 Thread Dattatreya Sadhu
I am building a chat bot application. i have created a form in my html view and send a post request and in python i am able to capture it but i am not able to send my result in python in django template -- You received this message because you are subscribed to the Google Groups "Django

Re: variable to a template

2016-04-09 Thread Chris Bartos
There are probably 3 ways you can do this: 1) Use a Filter You should be able to use the "add" filter to concatenate two strings. 2) Map the elements of your array in your

Re: variable to a template

2016-03-02 Thread Fred Stluka
Luca, You can't nest a variable evaluation (via {{}}) inside a tag execution {%%}. But you can put them side by side to achieve the effect you want: '{% static "mysite/scorr" %}'/{{a}}' --Fred Fred Stluka --

Re: variable to a template

2016-03-02 Thread raoul
Hi Luca, Did {{ a }} solve the problem? Cheers, Raoul On Wednesday, March 2, 2016 at 2:12:46 PM UTC+1, luca72 wrote: > > Thanks now it works > > Luca > > Il giorno mercoledì 2 marzo 2016 14:05:24 UTC+1, Andreas Schosser ha > scritto: >> >> Hi Luca, >> >> > > > height="100" >> >>

Re: variable to a template

2016-03-02 Thread 'luca72' via Django users
Thanks now it works Luca Il giorno mercoledì 2 marzo 2016 14:05:24 UTC+1, Andreas Schosser ha scritto: > > Hi Luca, > > > > height="100" > > Try {% static "mysite/scorr/"|add:a %} > > Andreas > > -- > Kurs 10 IT-Consulting www.kurs-10.de > Andreas

Re: variable to a template

2016-03-02 Thread Andreas Schosser
Hi Luca, > height="100" Try {% static "mysite/scorr/"|add:a %} Andreas -- Kurs 10 IT-Consulting www.kurs-10.de Andreas Schosser a...@kurs-10.de Baldestraße. 14 Telefon +49 89 41615842-0 80469

Re: variable to a template

2016-03-02 Thread Sergiy Khohlov
try to use : "{% static "mysite/scorr{{a}}" %}" Many thanks, Serge +380 636150445 skype: skhohlov On Wed, Mar 2, 2016 at 1:00 PM, 'luca72' via Django users < django-users@googlegroups.com> wrote: > Hello Thanks for your reply > > STATIC_URL = '/static/' > > I have no static root

Re: variable to a template

2016-03-02 Thread 'luca72' via Django users
Hello Thanks for your reply STATIC_URL = '/static/' I have no static root configured But why if i write i get the image and if i write where a is the file name i can't get? The path is F:\Sito_01_03_16\test\nuovo\myproject\mysite\static\mysite\scorr Thanks for your help Il giorno

Re: variable to a template

2016-03-02 Thread Sergiy Khohlov
original path og your image please. Also setting for STATIC_ROOT from setting.py send please Many thanks, Serge +380 636150445 skype: skhohlov On Wed, Mar 2, 2016 at 12:41 PM, 'luca72' via Django users < django-users@googlegroups.com> wrote: > Hello i have write this in a template: > {%

variable to a template

2016-03-02 Thread 'luca72' via Django users
Hello i have write this in a template: {% for a in lista %} {% endfor %} But i get no image if i add just a {{a}} i see that the file name is righ, also if i direct write the file i get it {% for a in lista %} {% endfor %} can you tell me what is wrong Thanks

Re: Access dynamic session variable name in template

2015-07-02 Thread jorrit787
This doesn't seem to work :( def comment_upvote(request, comment_id): comment = get_object_or_404(Comment.objects.filter(id__exact=comment_id, approved=True)) votes = request.session.setdefault('commentvotes', {}) if comment.id not in votes: comment.upvotes =

Re: Access dynamic session variable name in template

2015-07-02 Thread Daniel Roseman
On Thursday, 2 July 2015 19:09:59 UTC+1, jorr...@gmail.com wrote: > > Hi everyone, > > I am trying to keep track of who has voted on a comment by setting session > variables like 'commentvote1', 'commentvote2', etc to True. These variable > names are dynamically generated based on the id of the

Access dynamic session variable name in template

2015-07-02 Thread jorrit787
Hi everyone, I am trying to keep track of who has voted on a comment by setting session variables like 'commentvote1', 'commentvote2', etc to True. These variable names are dynamically generated based on the id of the comment. How can I access these dynamic variables in my template? I've tried

Re: variable in django template

2013-10-23 Thread Leonardo Giordani
Indeed this is a good solution. Just a typo correction, use "%" instead of "@". Leo Leonardo Giordani Author of The Digital Cat My profile on About.me - My GitHub page- My Coderwall profile

Re: variable in django template

2013-10-23 Thread Nicolas Pantel
Take a look at the "{@ with @}" template tag in the documentation. Use {@ with myVariable=someValue @} ... {@ endwith @}. NicoP Le 23 oct. 2013 07:01, "Harjot Mann" a écrit : > > I want to initialize a varibale in django template from zero, which I > want to comapre

Re: variable in django template

2013-10-23 Thread Leonardo Giordani
Hi, everything you need in a template can be prepared in a view, so if you need a specific value just pass a context key with that very value. Otherwise, if you need a list of integers, just pass a range(N) list. There is a plenty of builtin filters and tags you can then use to manage it. If you

variable in django template

2013-10-22 Thread Harjot Mann
I want to initialize a varibale in django template from zero, which I want to comapre with the some job_no whihc is coming from database. I am not getting hoe to decalre a variable. Please help me . -- Harjot Kaur Mann Blog: http://harjotmann.wordpress.com/ Daily Dairy:

Re: Use variable in my template?

2013-03-05 Thread Amyth Arora
how are you passing the variable to the template ? show us the view method that renders the template On Feb 28, 2013 4:36 PM, "Maria" <mariahen...@gmx.de> wrote: > Hello everyone, > > I have a variable I want to have access to in my Django template. But > somehow I ca

Re: Use variable in my template?

2013-02-28 Thread Bill Freeman
By the way, in your marke.py, the "global" declaration doesn't do what you seem to think, and may be a syntax error. I know that in some other languages, "global" is used to make a variable available to all code. This is not the case in python. Without the "global" declaration, any piece of

Re: Use variable in my template?

2013-02-28 Thread Bill Freeman
In the lines: return render_to_response('polls/detail.html', {'poll': p}, context_instance=RequestContext(request)) you have two choices. Both: return render_to_response('polls/detail.html', {'poll': p, 'marke': marke},

Re: Use variable in my template?

2013-02-28 Thread Shawn Milochik
On Thu, Feb 28, 2013 at 11:30 AM, Maria wrote: > Can you tell me where exactly to insert that Variable? Have a look at this page in the tutorial: https://docs.djangoproject.com/en/1.5/intro/tutorial03/ See how a variable in the view is added to the context? Exactly like

Re: Use variable in my template?

2013-02-28 Thread Maria
Can you tell me where exactly to insert that Variable? def detail(request, poll_id): > p = get_object_or_404(Poll, pk=poll_id) > return render_to_response('polls/detail.html', {'poll': p}, > context_instance=RequestContext(request)) > Also, do I have to

Re: Use variable in my template?

2013-02-28 Thread Bill Freeman
To make a variable visible in a template you must explicitly add it to the template context. In the traditional function based view you pass a Context or RequestContext instance to the template renderer or shortcut. The constructor for the context accepts a mapping (e.g.: a dict) whose keys

Re: Use variable in my template?

2013-02-28 Thread Tom Evans
I would like to learn how > to use that external variable in my template. > Put the variable in the context that you use to render the template. The variables available in your template are the variables in the context you supply when rendering your template. All the template rendering funct

Re: Use variable in my template?

2013-02-28 Thread Maria
No I dont have a problem to find the images, i already used a variable to insert images from the static folder. Its just that I cant use my "marke" variable because it is in an external .py file and I would like to learn how to use that external variable in my template. On Thursday

Re: Use variable in my template?

2013-02-28 Thread Roberto López López
of course, your model should be something like this: class Marke(models.Model): marke = models.ImageField(upload_to="images/") or wherever you prefer to put your images into the media folder On 02/28/2013 12:06 PM, Maria wrote: > Hello everyone, > > I have a variable I want to

Re: Use variable in my template?

2013-02-28 Thread Roberto López López
I don't understand exactly what do you mean, but if those images are uploaded by the user (for example, using the admin app), they should be "{{ MEDIA_URL }}{{ marke.marke }}" instead of "{{ STATIC_URL }}images/{{ marke.marke }}.jpg" On 02/28/2013 12:06 PM, Maria wrote: > Hello everyone, > >

Use variable in my template?

2013-02-28 Thread Maria
Hello everyone, I have a variable I want to have access to in my Django template. But somehow I can't manage to do that. I got *Django/mytemplates/polls/detail.html (template) *where I want to insert an image: > {% load staticfiles %} > > > > media="screen" /> > > > > > and

Assign a variable from a template in a "global" way?

2011-08-19 Thread Forbairt
Hi All, I'm using the code from http://www.soyoucode.com/2011/set-variable-django-template from django import template register = template.Library() class SetVarNode(template.Node): def __init__(self, var_name, var_value): self.var_name = var_name self.var_value

Re: Another question: how to apply custom variable into django template automatically?

2010-08-17 Thread Steve Holden
s > very boring... > > So is there some method to implement applying custom variable into > django template automatically? I find some materials, may be > RequestContext can handle it, but I don't know how to insert my custom > variable into it? > > Anyone can help? > > Th

Re: Another question: how to apply custom variable into django template automatically?

2010-08-17 Thread Daniel Roseman
t every page template, this is > very boring... > > So is there some method to implement applying custom variable into > django template automatically? I find some materials, may be > RequestContext can handle it, but I don't know how to insert my custom > variable into it? > > Anyone

Another question: how to apply custom variable into django template automatically?

2010-08-17 Thread Tang Daogang
variable into django template automatically? I find some materials, may be RequestContext can handle it, but I don't know how to insert my custom variable into it? Anyone can help? Thank you! -- You received this message because you are subscribed to the Google Groups "Django users" grou

Re: how to get LANGUAGE_CODE variable in flatpage's template

2009-08-28 Thread victor
No one suffered? On 8月28日, 下午1时20分, victor <xur...@gmail.com> wrote: > i need get LANGUAGE_CODE variable in flatpage's template,but only got > it under Debug status. > when set debug=False,any request to flatpage will got 500 error: > VariableDoesNotExist: Failed lookup for

how to get LANGUAGE_CODE variable in flatpage's template

2009-08-28 Thread victor
i need get LANGUAGE_CODE variable in flatpage's template,but only got it under Debug status. when set debug=False,any request to flatpage will got 500 error: VariableDoesNotExist: Failed lookup for key [LANGUAGE_CODE] in u'[{}]' when set debug=True,all works. can anyone know how to get

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-06-03 Thread Berco Beute
django.template.loader import render_to_string from django import template from django.template import Variable register = template.Library() class IncludeTemplateNode(template.Node): tagDir = 'some/dir/' def __init__(self, template): self.templateVar = Variable(template) def render

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-06-02 Thread Berco Beute
That's seems to be working, the only thing I've left to do is passing the complete context from the template to the simple_tag, else the simple_tag won't be able to render the template. How is that normally done in Python? 2B On May 31, 7:32 am, Alex Morega <[EMAIL PROTECTED]> wrote: > Create

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-31 Thread @@
On 5/31/08, Alex Morega <[EMAIL PROTECTED]> wrote: > > > > On May 31, 2008, at 00:36 , Berco Beute wrote: > > > > > Unfortunately that doesn't work. This works: > > > > {{ include dir|concat:"/tag.html" }} > > > > But not this: > > > > {% include dir|concat:"/tag.html" %} > > > > Thanks, but I'm

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-30 Thread Alex Morega
On May 31, 2008, at 00:36 , Berco Beute wrote: > > Unfortunately that doesn't work. This works: > > {{ include dir|concat:"/tag.html" }} > > But not this: > > {% include dir|concat:"/tag.html" %} > > Thanks, but I'm still searching for a solution... Create your own tag - not an inclusion tag,

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-30 Thread Berco Beute
Unfortunately that doesn't work. This works: {{ include dir|concat:"/tag.html" }} But not this: {% include dir|concat:"/tag.html" %} Thanks, but I'm still searching for a solution... 2B On May 29, 11:18 pm, Johannes Dollinger <[EMAIL PROTECTED]> wrote: > You could use a filter: > >

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-29 Thread Johannes Dollinger
You could use a filter: @register.filter(name='concat') def concat(value, arg): return "%s%s" % (value, arg) and then {% include dir|concat:"/tag.html" %}. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-29 Thread Berco Beute
I can surely pass the path variable into the context from within my view, but the view doesn't know which filename to include. So in the template, I would still have to combine path and filename when creating an include tag such as: {% include "dir/tag.html" %} But how can I combine the path

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-29 Thread Berco Beute
Inclusion tags sound good, but I'm not sure how it could solve my problem. In my template I would like to use an inclusion tag this way: ###template {% showTag 'tagName' %} ###inclusion tag @register.inclusion_tag('tag.html') def showTag(tagname): #... ###tag.html bla But

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-28 Thread [EMAIL PROTECTED]
Could you set the entire path variable from within your view, then pass the path, including the filename, into the context? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-27 Thread Juanjo Conti
You should create an inclusion tag: http://www.djangoproject.com/documentation/templates_python/#inclusion-tags Juanjo -- mi blog: http://www.juanjoconti.com.ar --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-27 Thread Berco Beute
In the following 'include' tag the 'dir' may vary: {% include "dir/tag.html" %} so I would rather use something like: {% include {{ dir }}"/tag.html" %} which of course doesn't work. Is there a way to accomplish this? Being able to set a variable inside a template wou

Re: refence a variable in a template in side another variable

2008-04-24 Thread Raisins
Awesome, this worked perfectly. I completely forgot about custom template tags. I can now build the form dynamically and display any info from the object. On Apr 24, 1:51 pm, "Phil Davis" <[EMAIL PROTECTED]> wrote: > 2008/4/24Raisins<[EMAIL PROTECTED]>: > > > > If you really want to do it you

Re: refence a variable in a template in side another variable

2008-04-24 Thread Phil Davis
2008/4/24 Phil Davis <[EMAIL PROTECTED]>: > 2008/4/24 Raisins <[EMAIL PROTECTED]>: > [...] > {% for x in form %} > {{x.item.some_x_attr}} > {{x}} > {% endfor %} > I forgot that within the template there is a BoundField wrapper around each real form field so the above example should be: {%

Re: refence a variable in a template in side another variable

2008-04-24 Thread Phil Davis
id }} no luck on that. It seems to be looking > for a field named "x" not the object I am refencing. > > The question now is how can you refence a variable in a template in > side another variable? That is not possible using the standard template syntax which is deliberatel

refence a variable in a template in side another variable

2008-04-24 Thread Raisins
}} }} {%endfor %} That doesnt work, it tries to parse the {{ and fails. I tried to switch it to {{ form.x.id }} no luck on that. It seems to be looking for a field named "x" not the object I am refencing. The question now is how can you refence a variable in a template in side another variable?

variable assignment in template (or variable alias/map)

2007-10-07 Thread zeliboba
Object", so I need kind of aliasing/mapping of variable names or variable assignment in template. currently I'm thinking about extension {% include %} tag for accepting third argument (for mapping) or custom tag like {% let object childObject %}. maybe there is better or standard approach ex

Re: How to pass an extra variable to every template?

2007-08-23 Thread Filipe Correia
rding template inheritance and the use of {% extends %}, in the > > Django book[1] says that: > > > "In most cases, the argument to {% extends %} will be a string, but it > > can also be a variable, if you don't know the name of the parent > > template until runti

Re: How to pass an extra variable to every template?

2007-08-23 Thread Aidas Bendoraitis
runtime. This lets you do some cool, dynamic stuff." > > What I am trying to do is to pass an extra variable to every template > (which I have defined in settings.py), so that I can use that value > with {% extends%}. > > What is the best way to accomplish this; will I have

How to pass an extra variable to every template?

2007-08-23 Thread Filipe Correia
cool, dynamic stuff." What I am trying to do is to pass an extra variable to every template (which I have defined in settings.py), so that I can use that value with {% extends%}. What is the best way to accomplish this; will I have to change all of my views to pass the extra var? thanks, Filipe

Re: Variable value in template

2007-04-11 Thread Ivan Sagalaev
Kai Kuehne wrote: > With this > > Team: > {% for team in object.squad.team_set.all %} > {% appearance_count_for_team team.id %} > > and > > class AppearanceCountForTeamNode(template.Node): > def __init__(self, team_id): > print team_id > ... > > I get

Variable value in template

2007-04-11 Thread Kai Kuehne
With this Team: {% for team in object.squad.team_set.all %} {% appearance_count_for_team team.id %} and class AppearanceCountForTeamNode(template.Node): def __init__(self, team_id): print team_id ... I get "team.id" printed out and not the id of the team.

Re: How do you pass a variable to a template tag?

2007-02-13 Thread [EMAIL PROTECTED]
y approach. It might help you. The following template > tag "load_obj" loads any object by id and saves passes it to the > template context variable: > > # code starts here > from django.db.models import get_model > from django import template > > regi

Re: How do you pass a variable to a template tag?

2007-02-13 Thread Aidas Bendoraitis
Hello Baxter! Take a look at my approach. It might help you. The following template tag "load_obj" loads any object by id and saves passes it to the template context variable: # code starts here from django.db.models import get_model from django import template

How do you pass a variable to a template tag?

2007-02-09 Thread [EMAIL PROTECTED]
I need to pass a user id to a template tag. After reading this: http://groups.google.com/group/django-users/ browse_thread/thread/96fe34b4561415dc/b7aba25f22bdd261? lnk=gst=template+tags+variable=1#b7aba25f22bdd261 I came up with: class SongListNode(template.Node): def __init__(self, artist

Re: Can I set a local variable in a template?

2006-11-02 Thread Rachel Willmer
Perfect! thanks Rachel On 02/11/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > Will the 'ifchanged' tag do it for you? > http://www.djangoproject.com/documentation/templates/#ifchanged --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: Can I set a local variable in a template?

2006-11-02 Thread Jay Parlar
On 11/2/06, Rachel Willmer <[EMAIL PROTECTED]> wrote: > > I'm sure this must be a FAQ but I can't see the answer anywhere... > > I'd like to buld a table from a for loop. One field in each line will > depend on the previous line, so I'd like to do something like this: > > {% for line in lines %}

Can I set a local variable in a template?

2006-11-02 Thread Rachel Willmer
I'm sure this must be a FAQ but I can't see the answer anywhere... I'd like to buld a table from a for loop. One field in each line will depend on the previous line, so I'd like to do something like this: {% for line in lines %} {% if notequal line.name prevname %} {{ line.name }} {% endif %}

Re: Declare a variable in a template

2006-08-04 Thread JHeasly
Don Arbow wrote: > > list_1 = Shows.objects.filter(upcoming=True) > list_2 = Shows.objects.filter(past=True) > > return render_to_response('template.html' > {'upcoming_shows':list_1, 'past_shows':list_2}) > > Don Don, Thanks for the clean, clear example! It helped me see a way out in a

Re: Declare a variable in a template

2006-08-03 Thread limodou
On 8/4/06, skullvulture <[EMAIL PROTECTED]> wrote: > > Is there anyway to declare variables within a template? I'm coming > from a Zope background where with dtml you have the dtml-let tag and > with ZPT you have tal:define. Django's templating seems so much cooler > than Zope's, but I'm

Re: Declare a variable in a template

2006-08-03 Thread Don Arbow
On Aug 3, 2006, at 2:45 PM, skullvulture wrote: > I have another loop above that displays upcoming shows. Is it > possible > to have two object lists, one of upcoming and one of past shows be > passed to the template? Yes, you can pass any sort of data that you want to your template. So,

Re: Declare a variable in a template

2006-08-03 Thread skullvulture
Don, I have another loop above that displays upcoming shows. Is it possible to have two object lists, one of upcoming and one of past shows be passed to the template? Thanks Adrian, I understand your philosophy of separating presentation and logic, but even in your there you say that the

Re: Declare a variable in a template

2006-08-03 Thread Don Arbow
On Aug 3, 2006, at 1:05 PM, skullvulture wrote: > > Is there anyway to declare variables within a template? I'm coming > from a Zope background where with dtml you have the dtml-let tag and > with ZPT you have tal:define. Django's templating seems so much > cooler > than Zope's, but I'm

Re: Declare a variable in a template

2006-08-03 Thread James Bennett
On 8/3/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > * If you're not using any of the objects with is_past_show == False, > then change your view so that object_list is only the objects with > is_past_show==True. Then you can do this: Assuming the use of the object_list generic view, this is

Re: Declare a variable in a template

2006-08-03 Thread Adrian Holovaty
On 8/3/06, skullvulture <[EMAIL PROTECTED]> wrote: > Is there anyway to declare variables within a template? I'm coming > from a Zope background where with dtml you have the dtml-let tag and > with ZPT you have tal:define. Django's templating seems so much cooler > than Zope's, but I'm missing

Re: Declare a variable in a template

2006-08-03 Thread James Bennett
s, but I'm missing a declare or define tag. There is no way to declare a new variable using only the template language's constructs, and I'd say that's pretty much a deliberate choice; the template system isn't meant to be a programming language, and the place to set variables is in the view. -

Declare a variable in a template

2006-08-03 Thread skullvulture
Is there anyway to declare variables within a template? I'm coming from a Zope background where with dtml you have the dtml-let tag and with ZPT you have tal:define. Django's templating seems so much cooler than Zope's, but I'm missing a declare or define tag. The idea I want to be able to do

Re: Declare a variable in a template

2005-12-05 Thread Waylan Limberg
On 12/3/05, Jiri Barton <[EMAIL PROTECTED]> wrote: > > Wow, dorodok, that is elegant, indeed. I have already implemented by > the inclusion_tag as the guys suggested, but I'm going to do it the CSS > way. > Just remember that every time you want to add another tab, then you'll have to edit the

Re: Declare a variable in a template

2005-12-02 Thread Jiri Barton
Wow, dorodok, that is elegant, indeed. I have already implemented by the inclusion_tag as the guys suggested, but I'm going to do it the CSS way. Robert: autocorrected it to register.inclusion_tag in my code already :-) thanks Jiri

Re: Declare a variable in a template

2005-12-02 Thread dorodok
Hi Jiri! if you are only about highlighting of the active item of your UI menu in pure CSS way, I suggest you to look at solution of www.djangoproject.com site, the source of templates is: base template: http://code.djangoproject.com/browser/djangoproject.com/django_website/templates/base.html

Re: Declare a variable in a template

2005-12-02 Thread Robert Wittams
> @inclusion_tag("myapp/menu") That should be @register.inclusion_tag("myapp/menu")

Re: Declare a variable in a template

2005-12-02 Thread Jiri Barton
I like it! Thanks

Re: Declare a variable in a template

2005-12-02 Thread Adrian Holovaty
: > > > endifequal %}>mushrooms > endifequal %}>tomatoes > endifequal %}>cheese > endifequal %}>onion/li> > > > A couple of questions: does anyone have a better idea how to do it? > And, of course, the declare tag does not exists - is there a way o

Declare a variable in a template

2005-12-02 Thread Jiri Barton
lude "menu" %} The menu would have been defined as follows: mushrooms tomatoes cheese onion/li> A couple of questions: does anyone have a better idea how to do it? And, of course, the declare tag does not exists - is there a way of defining a variable from within a template? Thanks, Jiri