Re: Template Filters

2009-08-22 Thread WilsonOfCanada

For reference:
http://google-ctemplate.googlecode.com/svn/trunk/doc/auto_escape.html
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Template Filters

2009-08-19 Thread WilsonOfCanada

Hellos,

I was wondering if there is a filter that can remove these '\' that
python added when strings are appended to a list or dictionary.  I
cannot use cut because I still need one of the '\'

ex.  C:\\moo

Code:

arrPlaces = []
intPoint =0

while (len(testline)):
testline = fileName.readline()
print testline
arrPlaces[intPoint].append(testline)
intPoint += 1

d["places"] = arrPlaces
return render_to_response('rentSearch.html', d)

> C:\moo
> C:\supermoo

the HTML using Django has:

{{ places|safe }} but returns ['C:\\moo', 'C:\\supermoo'].  I was
wondering of there is a filter for the template that would return ['C:
\moo', 'C:\supermoo'] instead.

Thanks
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Raw Strings with Variables

2009-08-18 Thread WilsonOfCanada

However, when I send the list over as a dictionary for HTML:

d["places"] = arrPlaces

return render_to_response('rentSearch.html', d)

the HTML using Django has:

{{ places }} but returns ['C:\\moo', 'C:\\supermoo']

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Javascript with built-in templates tags

2009-08-11 Thread WilsonOfCanada

I want to access the string from the list that is in the dictionary:

function changeArea()
{
alert({{list_areas.British_Columbia}});
}

I get what I want in the generated HTML:

function changeArea()
{
alert(['Metro Vancouver', 'Metro Vancouver A', 'Sunshine Coast']);
}

However, when I tried using:

function changeArea()
{
alert({{list_areas.British_Columbia.0}});
}

I get this:

function changeArea()
{
alert(Metro Vancouver);
}
(it is not a string)

Thanks
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Javascript with built-in templates tags

2009-08-08 Thread WilsonOfCanada

I tried that before, but it only seems to work when it is used on
the .html file.

onchange="changeArea('{{ list_areas.BC|safe|escapejs}}')

I need it to be onchange="changeArea('{{ list_areas|safe|escapejs}}')
so the function can use list_areas (My javascript and html are on
separate files).

On .js file,

If I use:
function changeArea(selectedAreas)
{
alert({{list_areas.BC}});
}

with or without the |escapejs would cause the entire javascript not to
work.

If I use:
function changeArea(selectedAreas)
{
alert(selectedAreas.BC);
}

or

function changeArea(selectedAreas)
{
alert(selectedAreas["BC"]);
}
would be undefined.

However, if it is:

function changeArea(selectedAreas)
{
alert(selectedAreas[0]);
}

I will get "{"

Thanks again.  (If I missed the answer in the docs, sorry :) )
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Javascript with built-in templates tags

2009-08-08 Thread WilsonOfCanada

I sent the variable as dictionary with lists
{'BC:['Vancouver', 'Kamloops'], AB:['Calgary']}

However, when I use the variable in the function, it is treated as a
string.

function changeArea(mooman)
{
alert(selectedAreas["BC"]);
}

This was not defined.  Is there something more I need to add to the
onchange="changeArea('{{ mooman|safe|escape}}');?

Thanks
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Javascript with built-in templates tags

2009-08-08 Thread WilsonOfCanada

Thanks,
It worked, but out of curiosity, what do the additional quotes change
(why are they needed)?
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Javascript with built-in templates tags

2009-08-08 Thread WilsonOfCanada

No, I placed the spaces in so it is more readable (I tested with
spaces afterwards and they still do not work).  The function is passed
in by:


Re: Javascript with built-in templates tags

2009-08-08 Thread WilsonOfCanada

I am not sure; I am just trying to pass the variable from the
dictionary using render_to_response to a javascript function.  The
function is stored as a .js file.  This is a part of the code I am
using it for:

{{ selectCity|safe }}




The {{ selectCity|safe }} works but the {{ mooman | safe | escapejs}}
does not.  I was wondering if the syntax is incorrect or they cannot
be used between " ".  Please show an example.

Thanks
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Javascript with built-in templates tags

2009-08-07 Thread WilsonOfCanada

Hellos,

I was wondering how to use {{ }} variables in javascript functions.

ex. onchange = "changeArea({{ mooman |safe|escapejs}});"

Thanks
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using Django's Cache

2009-07-20 Thread WilsonOfCanada

Well then I will have to try a different approach.  When using
render_to_response('webpage.html', d), I have d as a dictionary.  I
was wondering if you send a whole text file as a part of the
dictionary.

For example:

fileView = open('C://path//main_cities.txt', 'r+')
d['main_cities'] = fileView
render_to_response('webpage.html', d)

Thanks
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Using Django's Cache

2009-07-19 Thread WilsonOfCanada

Hellos,

I was wondering if I can use Django caching system to store .txt
or .img files on the client side (as temp file).  I want to use
javascript to use them later so it would not require to transfer files
from the server again.  The txt files are just list so there is
nothing about security, but they are just very long.

thanks
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Apache with Django

2009-07-07 Thread WilsonOfCanada

Never mind...  I figured it out.  Because the location is at "/", I
would not need the "PythonOption django.root / " part.
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Apache with Django

2009-07-07 Thread WilsonOfCanada

I think I found my problem.  I thought that the httpd.exe is the
application running in the Vista's control panel, but it was just the
"ApacheMonitor.exe" not "httpd.exe".

However, while my project worked in development, it is giving me
TypeError.
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Apache with Django

2009-07-06 Thread WilsonOfCanada

I am using Apache and mod_python with the some of the changes
suggested in http://docs.djangoproject.com/en/dev/howto/deployment/modpython/
as shown in the fourth posting.  I can start Apache Service Control
and the Test Configuration does not show any errors; however when my
ip address or my domain name is entered in the browser, it results
with either a network timeout or failed to connect.

Am I missing something with ports or is there more code?
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Apache with Django

2009-07-06 Thread WilsonOfCanada

@ Kenneth:  If I do not use runserver, what command should I use to
run the python scripts for production servers?

@ BoĊĦtjan: I am not sure if I even setup a connection between them.
In httpd.conf, I only added:

ServerName www.domainname.ca


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE Moo5.settings
PythonOption django.root /
PythonDebug On
PythonPath "['C:/Program Files/Apache Software Foundation/Apache2.2/
htdocs/Moo5', 'C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs', 'C:/Python25/Lib/site-packages/django-
trunk/', 'C:/Python25/Lib/site-packages/django-trunk/django/'] +
sys.path"


LoadModule python_module modules/mod_python.so

and changed the Directory and DocumentRoot to "C:/Program Files/Apache
Software Foundation/Apache2.2/htdocs/Moo5"
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Apache with Django

2009-07-05 Thread WilsonOfCanada

Hellos,

When running a production server, I was wondering if I still use
"python manage.py runserver [ip]:[port]" because the cmd says it is
running a development server.

Also, do I use the my LAN IP or Internet IP with which port (is it the
same one Apache listens to)?

Thanks

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---