Re: passing variables

2015-01-13 Thread Scot Hacker
On Monday, January 12, 2015 at 5:29:08 PM UTC-8, suabiut wrote: > > How to you pass variable from one template to another template? > You haven't provided any information about your problem, but it sounds like you might want to read the docs on template inheritance:

passing variables

2015-01-12 Thread sum abiut
How to you pass variable from one template to another template? cheers -- 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, send an email to

Re: Passing variables to css file in django

2013-08-27 Thread Giulio Calacoci
May I suggest to save user defined css to a file saved in a specific path? for example if user John_Doe submits a customized css, save it in //css/users/john_doe/override.css then in the head of the html file load the user defined css always after the default one. this way is always

Re: Passing variables to css file in django

2013-08-26 Thread Chris Lawlor
The simplest solution is probably to keep all of the CSS that users can't customize in an external file (to be served as a static asset), but move anything that's user customizable to the of your base template, in a

Re: Passing variables to css file in django

2013-08-25 Thread Robin Lery
Oh! I am sorry. What I meant was, how do I let users customize their page if they wanted to? I suppose I could have done this without using external stylesheet, but yes, CSS is served fastest if it's static. I hope, I made myself clear. Please guide me if there's a way to achive this On Mon, Aug

Re: Passing variables to css file in django

2013-08-25 Thread Andy McKay
Any string can be rendered as a template. This is covered pretty well in the docs: https://docs.djangoproject.com/en/dev/ref/templates/api/ For example: >>> from django.template import Context, Template >>> t = Template("body { background-color: {{ bgcolor }} }") >>> c = Context({'bgcolor':

Passing variables to css file in django

2013-08-25 Thread Robin Lery
Is it possible to pass variables in css files, like in html file. Example: In views.py: def home(request): bgcolor = "#999" ... ... In the css file: body { background-color : {{bgcolor}}; } If yes, can you please guide me how to achieve this? I

Re: Template inheritance and passing variables

2012-04-10 Thread andrea mucci
plate view the footer block and add different html code cheers El 10/04/2012, a las 23:36, bnkwsk escribió: > Hi, > while writing my first website in Django I ran into troubles with > passing variables in my inherited templates. Let me describe my > templates' structure. > >

Template inheritance and passing variables

2012-04-10 Thread bnkwsk
Hi, while writing my first website in Django I ran into troubles with passing variables in my inherited templates. Let me describe my templates' structure. I have a base template for all applications' templates which includes some parts - just to divide the code into smaller parts. My goal

Re: Passing variables from a context processor to a template

2012-01-06 Thread Guy Nesher
Thanks, Works perfectly now (and yeah I'm fairly new to Python/Django) On Jan 5, 5:44 pm, Rainy wrote: > On Jan 5, 12:38 pm, Rainy wrote: > > > > > > > > > > > On Jan 5, 12:35 pm, Guy Nesher wrote: > > > > Thanks, > > > > I've

Re: Passing variables from a context processor to a template

2012-01-05 Thread Rainy
On Jan 5, 12:38 pm, Rainy wrote: > On Jan 5, 12:35 pm, Guy Nesher wrote: > > > Thanks, > > > I've initially tried to use a dictionary but was still unable to pull > > the data in the template. > > > I'm using your updated context processor: > > def

Re: Passing variables from a context processor to a template

2012-01-05 Thread Rainy
On Jan 5, 12:35 pm, Guy Nesher wrote: > Thanks, > > I've initially tried to use a dictionary but was still unable to pull > the data in the template. > > I'm using your updated context processor: > def swiss_context_processors(request): >     added_context = { 'mytest':

Re: Passing variables from a context processor to a template

2012-01-05 Thread Guy Nesher
Thanks, I've initially tried to use a dictionary but was still unable to pull the data in the template. I'm using your updated context processor: def swiss_context_processors(request): added_context = { 'mytest': 'aaa', } return added_context and trying to call {{added_context.mytest}}

Re: Passing variables from a context processor to a template

2012-01-05 Thread Nan
Two things: 1) make sure the context processor is installed in your settings file. 2) context processors should return dicts. Try: def swiss_context_processors(request): added_context = { 'mytest': 'aaa', } return added_context On Jan 5, 12:03 pm, Guy Nesher

Re: Passing variables from a context processor to a template

2012-01-05 Thread Michael Elkins
On Thu, Jan 05, 2012 at 09:03:56AM -0800, Guy Nesher wrote: I've created a simple context processor which simply returns a variable, however I'm unable to retrieve it from my template. "Each context processor must return a dictionary."

Passing variables from a context processor to a template

2012-01-05 Thread Guy Nesher
Hi, I've created a simple context processor which simply returns a variable, however I'm unable to retrieve it from my template. The context processor is quite simple : def swiss_context_processors(request): mytest = "aaa" return mytest and I am calling the context processor in my view

Re: Passing variables to the template... I've having logic problems

2011-04-15 Thread Karen McNeil
Yes, that worked. Thank you! Of course, now that I fixed that, I have to deal with the other problem that I was avoiding... But I'll post that in a different question. :-) Thanks again, Pedro. On Apr 15, 9:35 pm, Pedro Kroger wrote: > You can try something like: > >

Re: Passing variables to the template... I've having logic problems

2011-04-15 Thread Pedro Kroger
You can try something like: def my_view(request): ... context = [] for offset in offsets: before = ' '.join(tokens[offset-5:offset]) word = tokens[offset] after = ' '.join(tokens[offset+1:offset+5]) context.append(before, word, after) ...

Passing variables to the template... I've having logic problems

2011-04-15 Thread Karen McNeil
I'm trying to make a concordance (ie, a list of a certain searchterm, including its surrounding context) and I can get it to work in the interpreter, but I'm having problems figuring out how to make it a list that I can pass it to the template. This is what works in the interpreter (tokens is a

Re: Passing variables to template filters

2011-02-04 Thread Andres Lucena
On Fri, Feb 4, 2011 at 11:07 AM, Tom Evans wrote: > On Fri, Feb 4, 2011 at 9:53 AM, Andres Lucena wrote: >> Hi, >> >> In my base.html I'm trying to do this: >> >>        {% block title %}{{title|default:"{{SITE_NAME}}"}}{% >> endblock %} >> >>

Re: Passing variables to template filters

2011-02-04 Thread Tom Evans
On Fri, Feb 4, 2011 at 9:53 AM, Andres Lucena wrote: > Hi, > > In my base.html I'm trying to do this: > >        {% block title %}{{title|default:"{{SITE_NAME}}"}}{% > endblock %} > > But I'm getting this: > > TemplateSyntaxError at / > default requires 1 arguments, 0

Passing variables to template filters

2011-02-04 Thread Andres Lucena
Hi, In my base.html I'm trying to do this: {% block title %}{{title|default:"{{SITE_NAME}}"}}{% endblock %} But I'm getting this: TemplateSyntaxError at / default requires 1 arguments, 0 provided So, SITE_NAME is not passed to the filter. As a workaround I did this: {% block

passing variables to other views / initial function executed before every views

2009-06-09 Thread Bastien
Hi, I need to use some kind of box (thickbox or other) popping up in front of any page that a user is redirected to after successfully registering a new account. The user gets redirected to the page she initially opened before being sent to the registration form. So it could be any page on the

Re: Passing variables from Django to Javascript after page load

2009-02-22 Thread Alex Gaynor
On Sun, Feb 22, 2009 at 7:07 PM, CALdan wrote: > > Hi! > > I want to pass data from Django to populate javascript variables > dynamically after page load. I'm using ajax.updater to call url's > from Django to update div's within my pages but in some instances it > would

Passing variables from Django to Javascript after page load

2009-02-22 Thread CALdan
Hi! I want to pass data from Django to populate javascript variables dynamically after page load. I'm using ajax.updater to call url's from Django to update div's within my pages but in some instances it would be of great use to pass just a variable instead of HTML code. Is there a way of

Re: A question about spaces and passing variables...

2008-09-26 Thread djandrow
Thanks Karen, its working fine now, Brian, I will have a look at slug fields, for now i'm trying just to get a basic site going, but then I'm going to try and come back and improve things so i will take a look at then then. Regards, Andrew --~--~-~--~~~---~--~~

Re: A question about spaces and passing variables...

2008-09-24 Thread Brian Neal
On Sep 24, 7:23 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Wed, Sep 24, 2008 at 6:37 PM, djandrow <[EMAIL PROTECTED]> wrote: > > > So after messing around a for a couple of minutes I discovered the > > urlencode changes About Me to About%20Me, (if you are using firefox 3 > > or above it

Re: A question about spaces and passing variables...

2008-09-24 Thread Karen Tracey
On Wed, Sep 24, 2008 at 6:37 PM, djandrow <[EMAIL PROTECTED]> wrote: > > So after messing around a for a couple of minutes I discovered the > urlencode changes About Me to About%20Me, (if you are using firefox 3 > or above it will still display "About Me" in the address bar, that > confused me

Re: A question about spaces and passing variables...

2008-09-24 Thread djandrow
So after messing around a for a couple of minutes I discovered the urlencode changes About Me to About%20Me, (if you are using firefox 3 or above it will still display "About Me" in the address bar, that confused me for a while). But now if i put in: url.net/blog/About%20Me/, it doesn't match

Re: A question about spaces and passing variables...

2008-09-23 Thread djandrow
Ok, thanks Karen, i;ll have a go with messing about. If someone else with more time could explain it to me that would be great, otherwise i'll just try playing about with it. regards, Andrew --~--~-~--~~~---~--~~ You received this message because you are

Re: A question about spaces and passing variables...

2008-09-23 Thread Karen Tracey
On Tue, Sep 23, 2008 at 12:22 PM, djandrow <[EMAIL PROTECTED]>wrote: > > Thanks Karen, how does urlencode work though? > I imangine its a filter, but what does it do? > > Yes well the doc is a bit sparse for that filter, but if you do a little playing around with it and research into how spaces

Re: A question about spaces and passing variables...

2008-09-23 Thread djandrow
Thanks Karen, how does urlencode work though? I imangine its a filter, but what does it do? regards, Andrew --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: A question about spaces and passing variables...

2008-09-23 Thread Karen Tracey
On Tue, Sep 23, 2008 at 11:23 AM, djandrow <[EMAIL PROTECTED]>wrote: > > I have a list of categories, which entries are filed into, then some > can click a category link in a template and it will take them to a > list of entries in that particular category. The problem is one of > this categories

A question about spaces and passing variables...

2008-09-23 Thread djandrow
I have a list of categories, which entries are filed into, then some can click a category link in a template and it will take them to a list of entries in that particular category. The problem is one of this categories is "About Me", what I have so far in my view is: current_entries =

Re: Passing variables to include? (and New call tag)

2006-04-21 Thread Glenn Tenney
On Fri, Apr 21, 2006 at 09:38:56AM +0400, Ivan Sagalaev wrote: > You use it then like this: > > {% product bestOffer %} > > ... and bestOffer will be passed in product.html by the name 'product'. And On Fri, Apr 21, 2006 at 10:16:29PM +0800, limodou wrote in re: Subject: New call tag >

Re: Passing variables to include?

2006-04-21 Thread tonemcd
And enlightenment descends ;) Cheers for the pointer Ivan! Tone --~--~-~--~~~---~--~~ 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

Re: Passing variables to include?

2006-04-21 Thread Ivan Sagalaev
tonemcd wrote: >I don't understand why a more generic form of this tag isn't available; > >{% datatofillinthetemplate "templates/macrosnippet.html" %} > >Is there a philosophical reason why this doesn't exist > > Inclusion tag doesn't always just renames context vars. It can (and very often

Re: Passing variables to include?

2006-04-21 Thread tonemcd
I don't understand why a more generic form of this tag isn't available; {% datatofillinthetemplate "templates/macrosnippet.html" %} Is there a philosophical reason why this doesn't exist? Cheers, Tone --~--~-~--~~~---~--~~ You received this message because you

Re: Passing variables to include?

2006-04-21 Thread [EMAIL PROTECTED]
Ivan, that *does* look like EXACTLY what I need. Great! Thanks a lot for your detailed response -- I will try it out as soon as I'm off work and back to my pet project :-) Cheers, Daniel --~--~-~--~~~---~--~~ You received this message because you are

Re: Passing variables to include?

2006-04-20 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: >Say I want to have a reusable component, included via {% include %}, >which renders a product. So I only have to deal with layout, >formatting, images, etc., once (I'm a big fan of re-use and DRY). The >template fragment will have a lot of {{product.price}},

Re: Passing variables to include?

2006-04-20 Thread James Bennett
On 4/20/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > This would mean I would have to assign different context variables to > my {%include%}'s "product" variable. This sounds more like a use case for a template tag than for an include. -- "May the forces of evil become confused on the way

Passing variables to include?

2006-04-20 Thread [EMAIL PROTECTED]
Maybe I missed something in the docs or the FAQ, but... Is there a way to pass different variables to an {% include %}? Say I want to have a reusable component, included via {% include %}, which renders a product. So I only have to deal with layout, formatting, images, etc., once (I'm a big fan