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:
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
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
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
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
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':
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
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.
>
>
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
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
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
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':
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}}
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
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."
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
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:
>
>
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)
...
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
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 %}
>>
>>
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
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
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
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
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
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
--~--~-~--~~~---~--~~
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
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
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
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
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
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
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
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 =
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
>
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
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
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
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
[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}},
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
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
42 matches
Mail list logo