How to make django use psycopg2 as the default engine?

2006-09-18 Thread 叮叮当当

i use postgres database and i installed psycopg2 engine, but it seems
the django use psycopg as the default engine , how to change psycopg2
as the engine?

thx.


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



Re: static content -- authentication?

2006-09-18 Thread shaunc

Wonderful, James --

I had overlooked the existence of this. Small feature enhancement might
be to mention it in doc in other places where static content is being
talked about.

- Shaun


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



Re: Portlet like features

2006-09-18 Thread [EMAIL PROTECTED]

Well - yes but most MVC type applications have a dispatcher like
architecture where the request is caught by a single resource which
then locates the controller to handle the request.
Anyways, I think I got most of it to work (using my sparse python
knowledge :-) )
but each time I tried to read from an URL to the web-server my program
stopped (halted).
This really puzzled me for some time (since I can't seem to find a way
to
get a thread dump thank you very much (yes - Im program mostly in
java)) but
then I thought to my self, perhaps this mini webserver is only single
threaded and what do you know... it is...   So - If I ain't going to
install apache is there any other way I can get an multi-threaded
webserver, perhaps using twisted ?

regards / Lars Borup


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



Re: Download counter?

2006-09-18 Thread Malcolm Tredinnick

On Tue, 2006-09-19 at 06:04 +, spacedman wrote:
> 
> frank wrote:
> >  Sure, I could create a download button for each
> > item, but that would be an extra step for the user.  'It would be nice'
> > if that weren't necessary.
> > BTW the downloads are static files, served by Apache.  That extra
> > button
> > is looking more and more likely...
> 
>  At some point the user is going to click on a link to download the
> file. What you do is make that a URL to a django app that increments a
> counter and then sends a redirect HTTP message to the actual file which
> apache then spits back.
> 
>  So you have a Django model called 'Downloads' with an integer 'Count'
> field and a text 'Filename' field. This could be initially empty...
> 
>  ..then your URL would be:
> 
>  http://mymachine.com/downloads/package/version/file-1.0.tar.gz
> 
>  ...then your  urls.conf  would match /downloads/(.*)
> 
>  ...the associated view then increments the counter for
> /package/version/file-1.0.tar.gz, or creates it if new...
> 
>  ...then sends a redirect (http code 304?) message to
> http://mymachine.com/files/package/version/file-1.0.tar.gz, which is
> the path to the file on the apache server.
> 
>  You might want to check the file exists in the Django view first
> 
>  ...so that the browser goes and gets that without asking the user.

The minor problem with that approach is that it means people can avoid
the Django counter and directly fetch the URL. So if counting is a
requirement, that solution needs an extra tweak to ensure that you have
first visited the counter page. This can be done with a nonce in the URL
or a session setting.

>  The only thing I'm unsure of is the exact HTTP message to send and how
> to get Django to do it, but it should be in the docs somewhere

There is a django.http.HttpResponseRedirect class that you can return
from a view (passing in the target URL) and Django handles the rest.

Regards,
Malcolm



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



Re: Download counter?

2006-09-18 Thread spacedman


frank wrote:
>  Sure, I could create a download button for each
> item, but that would be an extra step for the user.  'It would be nice'
> if that weren't necessary.
> BTW the downloads are static files, served by Apache.  That extra
> button
> is looking more and more likely...

 At some point the user is going to click on a link to download the
file. What you do is make that a URL to a django app that increments a
counter and then sends a redirect HTTP message to the actual file which
apache then spits back.

 So you have a Django model called 'Downloads' with an integer 'Count'
field and a text 'Filename' field. This could be initially empty...

 ..then your URL would be:

 http://mymachine.com/downloads/package/version/file-1.0.tar.gz

 ...then your  urls.conf  would match /downloads/(.*)

 ...the associated view then increments the counter for
/package/version/file-1.0.tar.gz, or creates it if new...

 ...then sends a redirect (http code 304?) message to
http://mymachine.com/files/package/version/file-1.0.tar.gz, which is
the path to the file on the apache server.

 You might want to check the file exists in the Django view first

 ...so that the browser goes and gets that without asking the user.

 The only thing I'm unsure of is the exact HTTP message to send and how
to get Django to do it, but it should be in the docs somewhere

Barry


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



Re: a conflict between django and php4

2006-09-18 Thread Nikolaus Schlemm

hi,

Am Dienstag, 19. September 2006 07:28 schrieb zhongke chen:
> Thanks! i solve this by removing libmhash package. but it's only a
> workaround solution. i expect to see a perfect one.

unfortunately, the problem seems to be somewhere within modpython which 
somehow doesn't use the md5-module that's used when running python in scripts 
or your interpreter... on the modpy-mailinglist I had posted an example that 
used the checksums from the md5-rfc. sadly this would only work correctly 
after the mentioned workarounds (disabling mod-php or uninstalling libmhash).

if both those two workarounds don't work for you, I have offered a third one 
on:

http://code.djangoproject.com/ticket/2249
-- 
cheers,

Nikl

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



Re: Download counter?

2006-09-18 Thread Nikolaus Schlemm

hi,

Am Dienstag, 19. September 2006 01:41 schrieb frank:
> This will probably show my incredible lack of understanding regarding
> web
> servers vs. django once more, but...
>
> Is there a reasonably simple and transparent (to the user) way of
> counting downloads?  Sure, I could create a download button for each
> item, but that would be an extra step for the user.  'It would be nice'
> if that weren't necessary.
> BTW the downloads are static files, served by Apache.  That extra
> button
> is looking more and more likely...

that should be trivial if your webserver provides you with access logs (which 
it most likely already does) - just grep through them...
-- 
cheers,

Nikl

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



Re: a conflict between django and php4

2006-09-18 Thread zhongke chen

Thanks! i solve this by removing libmhash package. but it's only a
workaround solution. i expect to see a perfect one.


On 9/19/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
> On Tue, 2006-09-19 at 12:52 +0800, zhongke chen wrote:
> > Not the same problem.
> >
> > if i enable php4, and i do not log in under django, my django app
> > works too. if i log in, error occurs.
>
> Could it possibly be a repeat of this problem:
>
> http://groups.google.com/group/django-users/browse_frm/thread/eeb44c894342d6f7/535749bbc456d296?lnk=gst&q=md5+problem&rnum=7#535749bbc456d296
>
> I'm not sure if there was ever a resolution to that one. There is
> another thread on the same list around that time (search for md5) with
> some related information, if memory serves.
>
> Regards,
> Malcolm
>
>
>
> >
>


-- 
from czk.
My old mail boxes([EMAIL PROTECTED], [EMAIL PROTECTED]) have been
deprecated. Please contact with me using the following email address
from now on: [EMAIL PROTECTED]
If you want to attach word/excel/powerpoint files for me, please
convert them to pdf. because i have no money to buy ms-office.

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



Re: a conflict between django and php4

2006-09-18 Thread Malcolm Tredinnick

On Tue, 2006-09-19 at 12:52 +0800, zhongke chen wrote:
> Not the same problem.
> 
> if i enable php4, and i do not log in under django, my django app
> works too. if i log in, error occurs.

Could it possibly be a repeat of this problem:

http://groups.google.com/group/django-users/browse_frm/thread/eeb44c894342d6f7/535749bbc456d296?lnk=gst&q=md5+problem&rnum=7#535749bbc456d296

I'm not sure if there was ever a resolution to that one. There is
another thread on the same list around that time (search for md5) with
some related information, if memory serves.

Regards,
Malcolm



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



Re: a conflict between django and php4

2006-09-18 Thread zhongke chen

Not the same problem.

if i enable php4, and i do not log in under django, my django app
works too. if i log in, error occurs.

On 9/19/06, Bryan Murdock <[EMAIL PROTECTED]> wrote:
>
> On 9/18/06, zhongke chen <[EMAIL PROTECTED]> wrote:
> >
> > i'm using django with apache2. if i disable php4 module of
> > apache2(using a2dismod php4), my django application runs well. if i
> > enable php4 module and log a user in, my django application gives the
> > following error message:
> >
> > Mod_python error: "PythonHandler django.core.handlers.modpython"
> 
>
> Are you having this problem?
>
> http://www.modpython.org/FAQ/faqw.py?req=show&file=faq02.013.htp
>
> Bryan
>
> >
>


-- 
from czk.

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



Re: a conflict between django and php4

2006-09-18 Thread Bryan Murdock

On 9/18/06, zhongke chen <[EMAIL PROTECTED]> wrote:
>
> i'm using django with apache2. if i disable php4 module of
> apache2(using a2dismod php4), my django application runs well. if i
> enable php4 module and log a user in, my django application gives the
> following error message:
>
> Mod_python error: "PythonHandler django.core.handlers.modpython"


Are you having this problem?

http://www.modpython.org/FAQ/faqw.py?req=show&file=faq02.013.htp

Bryan

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



Re: Non-unicode strings.

2006-09-18 Thread Malcolm Tredinnick

On Tue, 2006-09-19 at 02:27 +, Pupeno wrote:
> Hello,
> I am using Django 0.95 and SimpleTAL for templating. SimpleTAL expects all 
> the 
> strings, it seems, to be unicode (something sane from my point of view). It 
> seems that some data from PostgreSQL extracted using Django classes is not in 
> Unicode

That's true. We aren't using unicode universally at the moment. There is
work in progress to fix this, but it has no completion date at the
moment.

>  and triggers this error:
[...]
> 
> Any ideas ?

Either use something other than SimpleTAL for now or start diving into
the source to track down all the places strings are extracted and
convert them to unicode.

Regards,
Malcolm


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



a conflict between django and php4

2006-09-18 Thread zhongke chen

i'm using django with apache2. if i disable php4 module of
apache2(using a2dismod php4), my django application runs well. if i
enable php4 module and log a user in, my django application gives the
following error message:

Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):

  File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
result = object(req)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/modpython.py",
line 163, in handler
return ModPythonHandler()(req)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/modpython.py",
line 136, in __call__
response = self.get_response(req.uri, request)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/base.py",
line 59, in get_response
response = middleware_method(request)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/middleware/locale.py",
line 16, in process_request
language = translation.get_language_from_request(request)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/utils/translation/trans_real.py",
line 308, in get_language_from_request
lang_code = request.session.get('django_language', None)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/sessions/middleware.py",
line 35, in get
return self._session.get(key, default)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/sessions/middleware.py",
line 57, in _get_session
self._session_cache = s.get_decoded()

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/sessions/models.py",
line 65, in get_decoded
raise SuspiciousOperation, "User tampered with session cookie."

SuspiciousOperation: User tampered with session cookie.

i need to use php4 and django together, how can i solve it?appreciate any help

my system:
debian linux
kernal version 2.6.17-2-686
apache2 2.0.55-4.2
libapache2-mod-python 3.2.10-1
python 2.4.3
django 0.95

-- 
from czk.

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



Non-unicode strings.

2006-09-18 Thread Pupeno
Hello,
I am using Django 0.95 and SimpleTAL for templating. SimpleTAL expects all the 
strings, it seems, to be unicode (something sane from my point of view). It 
seems that some data from PostgreSQL extracted using Django classes is not in 
Unicode and triggers this error:

Request Method:
GET
  Request URL:
http://127.0.0.1:8000/search/
  Exception Type:
ContextContentException
  Exception Value:
Found non-unicode string in Context!
  Exception Location:
/usr/lib/python2.4/site-packages/simpletal/simpleTAL.py in expandInline, line 
619

the traceback is:

Traceback (most recent call last):
 File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py" in 
get_response
   74. response = callback(request, *callback_args, **callback_kwargs)
 
File 
"/home/pupeno/Software/hostingcompass-django/hostingcompass/../hostingcompass/hostingmap/views.py"
 
in search
   45. template.expand(context, output)
 File "/usr/lib/python2.4/site-packages/simpletal/simpleTAL.py" in expand
   730. self.expandInline (context, encodingFile, interpreter)
 File "/usr/lib/python2.4/site-packages/simpletal/simpleTAL.py" in 
expandInline
   619. raise simpleTALES.ContextContentException ("Found non-unicode string 
in Context!")
 
   ContextContentException at /search/
   Found non-unicode string in Context!

Any ideas ?

Thanks.
-- 
Pupeno <[EMAIL PROTECTED]> (http://pupeno.com)


pgpYFhFxhskPA.pgp
Description: PGP signature


Re: Problem with INSTALLED_APPS setting

2006-09-18 Thread Waylan Limberg

On 9/18/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Waylan Limberg wrote:
> > First, you only point to the app, not the models in your app. Second,
> > you need to start from a place that is on your pythonpath. If liger is
> > on your pythonpath, then just 'liger' will work, However, it's more
> > likely that is not the case, so you'll need to do something like
> > 'yourproject.liger'
>
> Hi Waylan,
>
> thanks for the answer. Shouldn't my project dir be added to the
> pythonpath? I created my project called "liger" which resides in
> C:\www\liger

Go reread your first post (I did a few times). You said 'liger' was an
app not a project. Which is it? If it is an app but not within a
project, that could be your problem.
>
> I have another project residing under the same dir C:\www and has no
> problems in resolving my names.

Make sure your project and app dirs each have init.py files in them.
Of course, the files can be blank, but without them, you'll never be
able to import from that dir.

>
> > if neither of those work, open a python shell and try:
> > import youproject.liger
> > or
> > import liger
> >
> > Experiment with your path till you find something that works. Whatever
> > works is what you should use in INSTALLED_APPS.
>
> Will keep trying.
>
> Thanks,
> Lorenzo
>
>
> >
>


-- 

Waylan Limberg
[EMAIL PROTECTED]

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



Re: login error admin interface

2006-09-18 Thread mauiblu

Yes..it is..but thanks.

It's Firefox 1.5 and cookies are set to be allowed.

Jim


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



Unable to login to admin interface

2006-09-18 Thread mauiblu

I get a message saying my browser isn't configured to accept
cookies..but it is.


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



Re: How to save parents and multiple children with single form?

2006-09-18 Thread Malcolm Tredinnick

On Tue, 2006-09-19 at 09:04 +0900, Sean Schertell wrote:
> Anyone? Please? My project is stalled until I learn how to do this  
> and it's no where in the docs. I'm dead in the water until someone  
> takes pity on me and explains how to do this.

It's only been 12 hours since your first post; sometimes it will take a
little longer than that for somebody to answer your question.

> > Let's say I have a form called add-new-group.html that looks like  
> > this:
> >
> > Group Name: __
> >
> > Member 1 -->  Name:___  Age: 
> > Member 2 -->  Name:___  Age: 
> > Member 3 -->  Name:___  Age: 
> >
> > So when the form is saved, it needs to save the new group to the
> > 'group' table, and it needs to save up to three new members to the
> > 'member' table.
> >
> > How in the world can I do this?

There are two ways that should work. Which one you choose depends on how
your models are set up and what you feel more comfortable with, so
experiment with both and see which works.

The first way is to create a custom manipulator (see [1]) that contains
fields for the group name and the three member names and ages (e.g.
name1, age1, name2, age2, etc). Then create a normal form as in the
forms documentation. After checking for errors and calling the
html2python() method, you then pull out the fields and use them to
create the new objects (using the model/database API as in [2]). You
will be able to access the fields as manipulator.name1,
manipulator.group, etc.

[1]
http://www.djangoproject.com/documentation/forms/#custom-forms-and-manipulators

[2] http://www.djangoproject.com/documentation/db_api/#creating-objects

This method has a limitation that the number 3 is hard-coded into it.
You could work around that with a bit of reading of the Django source
and using django.forms.InlineObjectCollection, I suspect, but that's
probably more work than you want to do at this point.

The second method works if the members can be edited inline with the
group model. Then you can use the standard AddManipulator for the Group
model and the create_update generic view form ([3]). I have given a bit
of an outline how to do that in [4].

[3]
http://www.djangoproject.com/documentation/generic_views/#create-update-delete-generic-views

[4]
http://www.pointy-stick.com/blog/2006/07/03/django-tips-forms-multiple-inline-objects/

Hopefully this gives you something to work with. Basically, though, any
time you are wondering how to do something with a form that is more than
just working with a single model, think of using custom manipulators.

Regards,
Malcolm


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



Re: How to save parents and multiple children with single form?

2006-09-18 Thread Sean Schertell

Anyone? Please? My project is stalled until I learn how to do this  
and it's no where in the docs. I'm dead in the water until someone  
takes pity on me and explains how to do this.

> Let's say I have a form called add-new-group.html that looks like  
> this:
>
> Group Name: __
>
> Member 1 -->  Name:___  Age: 
> Member 2 -->  Name:___  Age: 
> Member 3 -->  Name:___  Age: 
>
> So when the form is saved, it needs to save the new group to the
> 'group' table, and it needs to save up to three new members to the
> 'member' table.
>
> How in the world can I do this?
>
> Sean

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



Re: Strange Error when 404 or 500 error

2006-09-18 Thread Gary Wilson

[EMAIL PROTECTED] wrote:
>   File "/usr/lib/python2.4/site-packages/django/views/debug.py", line
> 144, in technical_404_response
> t = Template(TECHNICAL_404_TEMPLATE, name='Technical 404 template')
>
> TypeError: __init__() got an unexpected keyword argument 'name'
> <---
> I don't really understand where it comes from ( a django bug? my own
> bug?)
> Anybody who knows how to get rid of this?

Maybe you got caught in a weird state bewteen revisions 3666 and 3707
or updated some but not all of your files.  Are you using svn?  If so,
try updating your working copy with svn update.


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



Download counter?

2006-09-18 Thread frank

This will probably show my incredible lack of understanding regarding
web
servers vs. django once more, but...

Is there a reasonably simple and transparent (to the user) way of
counting downloads?  Sure, I could create a download button for each
item, but that would be an extra step for the user.  'It would be nice'
if that weren't necessary.
BTW the downloads are static files, served by Apache.  That extra
button
is looking more and more likely...

TIA for your insights...
   -f


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



Re: Problem loading a js file

2006-09-18 Thread Malcolm Tredinnick

On Mon, 2006-09-18 at 18:32 -0300, Luis Gustavo wrote:
> I am trying to use the calender code I found in
> http://www.dynarch.com/projects/calendar/
> in my form template, with a generic view.  I have copied the script
> files to many places in my project and tried different configurations
> in settings, but I always get the same error, Calendar is not defined.

Check your server logs. What is the HTTP status code when it tries to
retrieve the relevant Javascript files? You would expect to see 200, but
it sounds like you might be returning 404's.

Regards,
Malcolm



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



Problem loading a js file

2006-09-18 Thread Luis Gustavo

I am trying to use the calender code I found in
http://www.dynarch.com/projects/calendar/
in my form template, with a generic view.  I have copied the script
files to many places in my project and tried different configurations
in settings, but I always get the same error, Calendar is not defined.
My template starts with

@import url(calendar-win2k-1.css);





and has the date field

start: {{ form.data }} ...

  Calendar.setup(
{
  inputField  : "id_data", // ID of the input field
  ifFormat: "%m %d, %Y",// the date format
  button  : "trigger"   // ID of the button
}
  );


as described on the script site. What is wrong?

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



Spam Attack. GAH!

2006-09-18 Thread Tyson Tate

Hey fellow Djangoers-

My site is currently being attacked by an awful spam bot and I'm  
quickly trying to implement Akismet spam filtering. I'm using Django  
0.95 and am using the following code for Akismet:

http://www.b-list.org/weblog/2006/07/16/django-tips-hacking-freecomment

I followed James' instructions fully on a fresh copy of 0.95.  
However, I get the following error every time the spam bot posts a  
comment:

AttributeError: 'PublicFreeCommentManipulator' object has no  
attribute 'id'

On the following line of code:

   File "/home/ohgoditb/django_src/django/contrib/comments/views/ 
comments.py", line 167, in save
 mail_subject = 'New comment posted on %s "%s"' %  
(self.site.name, self.get_content_object().title)

Changing that line of code to "mail_subject = "New Spam!" doesn't  
solve the error. Even with the error, the spam gets through and is  
posted on my site. Where in the heck is Django getting "self.id" on a  
simple string variable?

I'd appreciate any and all help because my blog is absolutely flooded  
with spam. :(

-Tyson

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



Generalized questions as forms and user response handling?

2006-09-18 Thread Rob Hudson

Hi fellow Django users,

I'm coming up on a phase of a project where I need to do a lot of work 
with Forms and Manipulators.  I've got some historical bits of old CMS 
ideas that I'm trying to work with.  I wanted to ask Django-users if 
this approach seems reasonable, or if another approach would work 
better.  If anything this might be a good use-case for the new Forms 
work but I'm building against 0.95 currently.

For various teams we've set up some default question types to display on 
pages, such as:
- Multiple choice (radio buttons)
- Multiple choice (checkboxes)
- Short text input
- Long text input
- Likert scale series of questions

Typically we've had a data schema along the lines of this (not valid 
Python or Django, but trying to be similar for ease of comprehension):

class Question:
content = Text
type = ForeignKey(QuestionType)

class Option:
question = ForeignKey(Question)
sequence = Integer # for ordering of options
content = Text
value = Char

 From there we'd take the type and build the necessary HTML and form 
elements to display to the user.  User responses are stored in a 
"response" table and references the question id and user id.  The 
response table schema is something like this:

Response:
user_id
question_id
answer = Text
answered = DateTime
session = Char

In the past, this has been sufficient and generic enough for us to allow 
teams to build their own mini surveys.  And we've been able to tie user 
response data back into our programs if we need to customize or tailor 
content based on responses (think "cosmo" quiz style questions with 
appropriate feedback.)

So how does this system fit with Django, if at all?

On first glance at the FormField and Manipulators documentation I'm 
having a little trouble seeing the solution.  I'm trying to imagine 
where all the pieces fall into place.  Does this belong in its own app? 
  Or is each URL mapped to a different view that handles each question 
(ie: /page/20100/ is the quiz, /page/20101/ is the result based on user 
response)?

We do already have a Page model that has 1-to-many relationships to each 
of Text, Graphic, or Media for a basic template based CMS.  Adding 
another reference to Question would be feasible.  It would then simply 
be up to the view to render the Question -- though on the POST side I'm 
not sure how Django would catch the data in that case.

Any thoughts or guidance is appreciated.  I'll be testing a few 
approaches (I'm guessing) over the coming weeks.

Thanks,
Rob

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



Re: admin complains when adding a new User

2006-09-18 Thread Jim Moses
At least you got to admin...;-)I got stuck at logging in...says I'm not set to accept cookies..but I am.If you happened to hit this and know the answer... I'll buy you a beer for it!Jimnara <[EMAIL PROTECTED]> wrote: I must be missing something simple. Just using the admininterface, adding a user, and clicking Save elicits this:Traceback (most recent call last):  File"/usr/local/lib/python2.4/site-packages/django/core/servers/basehttp.py",line 272, in runself.result = application(self.environ, self.start_response)  File"/usr/local/lib/python2.4/site-packages/django/core/servers/basehttp.py",line 611, in __call__return self.application(environ, start_response) 
 File"/usr/local/lib/python2.4/site-packages/django/core/handlers/wsgi.py",line 148, in __call__response = self.get_response(request.path, request)  File"/usr/local/lib/python2.4/site-packages/django/core/handlers/base.py",line 59, in get_responseresponse = middleware_method(request)  File"/usr/local/lib/python2.4/site-packages/django/middleware/common.py",line 43, in process_requestraise RuntimeError, "You called this URL via POST, but the URLdoesn't end in a slash and you have APPEND_SLASH set. Django can'tredirect to the slash URL while maintaining POST data. Change your formto point to %s%s (note the trailing slash), or set APPEND_SLASH=Falsein your Django settings." % (new_url[0], new_url[1])RuntimeError: You called this URL via POST, but the URL doesn't end ina slash and you have APPEND_SLASH set. Django can't redirect to theslash URL while maintaining POST data. Change
 your form to point tolocalhost:8000/admin/auth/user/add/-TEMPLATE-VARIABLE-IS-MISSING-/(note the trailing slash), or set APPEND_SLASH=False in your Djangosettings.		 All-new Yahoo! Mail - Fire up a more powerful email and get things done faster.
--~--~-~--~~~---~--~~
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  -~--~~~~--~~--~--~---


admin complains when adding a new User

2006-09-18 Thread nara

I must be missing something simple. Just using the admin
interface, adding a user, and clicking Save elicits this:


Traceback (most recent call last):

  File
"/usr/local/lib/python2.4/site-packages/django/core/servers/basehttp.py",
line 272, in run
self.result = application(self.environ, self.start_response)

  File
"/usr/local/lib/python2.4/site-packages/django/core/servers/basehttp.py",
line 611, in __call__
return self.application(environ, start_response)

  File
"/usr/local/lib/python2.4/site-packages/django/core/handlers/wsgi.py",
line 148, in __call__
response = self.get_response(request.path, request)

  File
"/usr/local/lib/python2.4/site-packages/django/core/handlers/base.py",
line 59, in get_response
response = middleware_method(request)

  File
"/usr/local/lib/python2.4/site-packages/django/middleware/common.py",
line 43, in process_request
raise RuntimeError, "You called this URL via POST, but the URL
doesn't end in a slash and you have APPEND_SLASH set. Django can't
redirect to the slash URL while maintaining POST data. Change your form
to point to %s%s (note the trailing slash), or set APPEND_SLASH=False
in your Django settings." % (new_url[0], new_url[1])

RuntimeError: You called this URL via POST, but the URL doesn't end in
a slash and you have APPEND_SLASH set. Django can't redirect to the
slash URL while maintaining POST data. Change your form to point to
localhost:8000/admin/auth/user/add/-TEMPLATE-VARIABLE-IS-MISSING-/
(note the trailing slash), or set APPEND_SLASH=False in your Django
settings.


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



Re: Charfield maxlength (bug?)

2006-09-18 Thread Ivan Sagalaev

Enrico wrote:
> Ivan, I think it's not a problem on the DB side, I'm using MySQL and
> AFAIK it just crops the string without any warning.

Then may be I am mistaken... What I'm talking about is that maxlength is 
validated properly on manipulator level (method TextField.isValidLength 
in django.forms.__init__.py) but may be there's something that breaks 
deeper. What exact error do you get from Django?

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



Re: Problem with INSTALLED_APPS setting

2006-09-18 Thread [EMAIL PROTECTED]

Waylan Limberg wrote:
> First, you only point to the app, not the models in your app. Second,
> you need to start from a place that is on your pythonpath. If liger is
> on your pythonpath, then just 'liger' will work, However, it's more
> likely that is not the case, so you'll need to do something like
> 'yourproject.liger'

Hi Waylan,

thanks for the answer. Shouldn't my project dir be added to the
pythonpath? I created my project called "liger" which resides in
C:\www\liger

I have another project residing under the same dir C:\www and has no
problems in resolving my names.

> if neither of those work, open a python shell and try:
> import youproject.liger
> or
> import liger
>
> Experiment with your path till you find something that works. Whatever
> works is what you should use in INSTALLED_APPS.

Will keep trying.

Thanks,
Lorenzo


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



Re: Charfield maxlength (bug?)

2006-09-18 Thread Enrico

Thanks guys.

Yes, it may be an encoding issue.

The HTML form counts 10 chars, no matter what encoding, but on the
python side it can exceed the byte count.

Ivan, I think it's not a problem on the DB side, I'm using MySQL and
AFAIK it just crops the string without any warning.

Best regards.
Enrico


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



Re: static content -- authentication?

2006-09-18 Thread James Bennett

On 9/18/06, shaunc <[EMAIL PROTECTED]> wrote:
> We have a bunch of things like PDF reports, etc that can only be
> downloaded by properly authenticated users.

http://www.djangoproject.com/documentation/apache_auth/


-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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



Re: Pro Django from Apress

2006-09-18 Thread Bryan L. Fordham

> Try searching the list, this question has been asked and answered to
> varying degrees a few times before. If memory serves me right, the
> authors seem to think that October is overly optimistic and it will
> more likely be latter.

someone should set up a FAQ page for this 8)


-- 
Bryan L. Fordham
socialistsushi.com
Sushi For Everyone

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



static content -- authentication?

2006-09-18 Thread shaunc

I've read in several places about the advisability of serving static
content via Apache (or whatever) rather than via django.

Is it possible to somehow share an authentication context with Apache
(via session coookie??)?

We have a bunch of things like PDF reports, etc that can only be
downloaded by properly authenticated users.

Or should I use "flatpages" for this? What sort of performance hit does
this entail?


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



Re: Pro Django from Apress

2006-09-18 Thread Waylan Limberg

On 9/18/06, Jeff Rodenburg <[EMAIL PROTECTED]> wrote:
> I just read about this new book on Django and am looking forward to checking
> it out.  Amazon shows its availability at October 30th.
> Does anyone know if it might be available earlier than that?
>
Try searching the list, this question has been asked and answered to
varying degrees a few times before. If memory serves me right, the
authors seem to think that October is overly optimistic and it will
more likely be latter.


-- 

Waylan Limberg
[EMAIL PROTECTED]

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



Multiple Components on One Page

2006-09-18 Thread [EMAIL PROTECTED]

I am new to Django, and forgive me if this is a question that has
already been answered, but I can not seem to find the "official"
answer.  I will explain what I am trying to figure out with an example.

I am building a wiki, I have a number of views which show a wiki page,
edit a wiki page, save a wiki page.  I want on the page that shows
a wiki page contents, to also have a listing of all wiki pages for the
wiki.  Essentially I want data from two different views on the same
page, but I don't want to couple the code.

Looking through the groups and some blogs I seem to keep finding two
things:

1.  Template Tags
2.  "nested" templates (base template with blocks for using other
templates).

If someone could point me in the right direction for this I would
appreciate it.

Thanks,
Ken.


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



Re: models wierdness

2006-09-18 Thread Rob Hudson

Thanks for the reply.  :)


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



Re: Hierarchical menu for pages with nice formatting for selecting a parent

2006-09-18 Thread [EMAIL PROTECTED]

Hi Dan,
I don't have a place where I can test this right now. Do you have a
site that illustrates what you're trying to do?

Thanks
Mark Underwood
[frameworks : django : navigation]


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



Re: template and special character problem

2006-09-18 Thread Jorge Gajon

On 9/18/06, Phil <[EMAIL PROTECTED]> wrote:
> I tried what you suggested (replace my meta http-equiv by your version)
> and it does no good )c:

Sorry to hear that Phil, I don't know what else to suggest :(  It is
really weird that it works when you duplicate the content-type line
though.

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



Re: Problem with INSTALLED_APPS setting

2006-09-18 Thread Waylan Limberg

On 9/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> i've got an app named liger with a settings.py file which in
> INSTALLED_APPS has:
>
> 'liger.profiles'... along with other apps

First, you only point to the app, not the models in your app. Second,
you need to start from a place that is on your pythonpath. If liger is
on your pythonpath, then just 'liger' will work, However, it's more
likely that is not the case, so you'll need to do something like
'yourproject.liger'

if neither of those work, open a python shell and try:
import youproject.liger
or
import liger

Experiment with your path till you find something that works. Whatever
works is what you should use in INSTALLED_APPS.



-- 

Waylan Limberg
[EMAIL PROTECTED]

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



Pro Django from Apress

2006-09-18 Thread Jeff Rodenburg
I just read about this new book on Django and am looking forward to checking it out.  Amazon shows its availability at October 30th.Does anyone know if it might be available earlier than that?
http://www.amazon.com/Pro-Django-Development-Done-Right/dp/1590597257/sr=8-1/qid=1158597493/ref=pd_bbs_1/102-1006706-7676164?ie=UTF8&s=bookscheers,j

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


Re: Re: printable documentation

2006-09-18 Thread James Bennett

On 9/18/06, Jay Parlar <[EMAIL PROTECTED]> wrote:
> I think all the documentation pages have a "print" stylesheet. So just
> print it from your browser, and you should get it printing using the
> correct stylesheet.

The docs are also included in the Django download, in ReSt format,
which can be converted to the printer-friendly format of your choice
(e.g., PDF).

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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



Re: printable documentation

2006-09-18 Thread Jay Parlar

I think all the documentation pages have a "print" stylesheet. So just
print it from your browser, and you should get it printing using the
correct stylesheet.

Jay P.

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



Re: ChangeManipulator for model with multi-field key (unique_together)

2006-09-18 Thread DavidA


DavidA wrote:
> I have a model whose identity is defined by two fields: a foreign key
> field and a boolean field. I'm trying to use a ChangeManipulator for it
> but am stuck because ChangeManipulator assumes there is a single
> primary key field.
>
> Has anyone run into this? Can someone suggest a workaround?

Never mind - I see that this is a job for a custom manipulator.


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



ChangeManipulator for model with multi-field key (unique_together)

2006-09-18 Thread DavidA

I have a model whose identity is defined by two fields: a foreign key
field and a boolean field. I'm trying to use a ChangeManipulator for it
but am stuck because ChangeManipulator assumes there is a single
primary key field.

Has anyone run into this? Can someone suggest a workaround?

Thanks
-Dave


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



printable documentation

2006-09-18 Thread g.gomes

Hello all,

One of the things I've been looking forward for and which seems missing to me 
(or perhaps I overlooked it) is a set of straightforward printable 
documentation - the tutorials. A little change to add a printable version to 
the online manuals and tutorials in the frontpage might not take a lot and be 
actually a cool idea to add to the site. This is a sugestion, but if I have 
missed the printable versions or the link to the printer-friendly versions, let 
me know and disregard my sugestion!

Thank you,

Cheers,
Gonçalo

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



Re: Re: Database query question

2006-09-18 Thread James Bennett

On 9/18/06, Tom Smith <[EMAIL PROTECTED]> wrote:
> Not really.. having built and manipulated (with exludes, filters, order
> etc.) I'd quite like to peep at the SQL before it gets executed to see if it
> makes sense

I think it probably is possible by screwing around with internal
variables of the QuerySet class, provided you know what those
variables are, but the easier way, if you're just testing, is
mentioned here (it shows you the query after the fact, but throws in
the execution time as a bonus):

http://www.djangoproject.com/documentation/faq/#how-can-i-see-the-raw-sql-queries-django-is-running

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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



Re: Database query question

2006-09-18 Thread Tom Smith
On 18 Sep 2006, at 16:26, James Bennett wrote:p.exclude() returns a new QuerySet with the filtering, so you need to grab the return value, like this:  if len(notsitelist)>=1:     print "excluding sites: ", notsitelist     p = p.exclude(fk_site__in=notsitelist) That was it... silly me, just missed it trying to keep the code simple...Thanks!! tom
--~--~-~--~~~---~--~~
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  -~--~~~~--~~--~--~---



Re: Database query question

2006-09-18 Thread Tom Smith
On 18 Sep 2006, at 16:27, Michael Radziej wrote: Is there way to do  p.get_query(.)p.show_sql()  I really don't get what this is supposed to mean, it just looks like seriously broken syntax. Not really.. having built and manipulated (with exludes, filters, order etc.) I'd quite like to peep at the SQL before it gets executed to see if it makes senseregards and thankstom
--~--~-~--~~~---~--~~
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  -~--~~~~--~~--~--~---



Re: Re: custom validator in a model, not a manipulator

2006-09-18 Thread James Bennett

On 9/18/06, patrickk <[EMAIL PROTECTED]> wrote:
> NameError: name 'self' is not defined
>
> it´s defined inside the model.

Ah. I think this is a case of Django wanting to resolve that at the
time the class is created, even though 'self' can't be resolved until
you're dealing with an instance of the class. But I could be wrong.

Probably the best way to do this is to define the validator outside
the model, and then reference it normally.

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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



Re: Re: Database query question

2006-09-18 Thread James Bennett

On 9/18/06, Tom Smith <[EMAIL PROTECTED]> wrote:
> I have...
>
> p = Product.objects
> if len(notsitelist)>=1:
> print "exluding sites: ", notsitelist
> p.exclude(fk_site__in=notsitelist)


p.exclude() returns a new QuerySet with the filtering, so you need to
grab the return value, like this:

if len(notsitelist)>=1:
print "excluding sites: ", notsitelist
p = p.exclude(fk_site__in=notsitelist)

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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



Re: Database query question

2006-09-18 Thread Michael Radziej

Tom Smith wrote:
> Thanks... I'm not sure but I don't think this is working
> 
> I have...
> 
>   p = Product.objects
>   if len(notsitelist)>=1:
>   print "exluding sites: ", notsitelist
>   p.exclude(fk_site__in=notsitelist)
> 
>   if len(cats)>=1:
>   print "exluding categories: ", cats
>   p.exclude(catalog__in=cats)
> 
>   p.order_by('?')
>   return  p.select_related()[:50]
> 
> ... and funnily the order is the same every time (not random) and  
> although the print statements are printing, it doesn't seem to be  
> effecting the results.
> 

All the QuerySet methods that affect the SQL generation don't
change the QuerySet but return a modified QuerySet. You want to do

p = p.exclude(...)

etc.


> Is there way to do
>
> p.get_query(.)p.show_sql()

I really don't get what this is supposed to mean, it just looks
like seriously broken syntax.

Michael


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



Re: Database query question

2006-09-18 Thread Tom Smith

> Query sets are not executed on the database until you iterate, or
> otherwise try to extract data from them.
>
> o = Recipe.objects
> o2 = o.filter(xx)
> o3 = o2.filter(yy)
> o4 = o3.filter(zz)
>
> print o4
>
> will result in just 1 query getting issued to the database - the final
> query with three filters.

Thanks... I'm not sure but I don't think this is working

I have...

p = Product.objects
if len(notsitelist)>=1:
print "exluding sites: ", notsitelist
p.exclude(fk_site__in=notsitelist)

if len(cats)>=1:
print "exluding categories: ", cats
p.exclude(catalog__in=cats)

p.order_by('?')
return  p.select_related()[:50]

... and funnily the order is the same every time (not random) and  
although the print statements are printing, it doesn't seem to be  
effecting the results.

Is there way to do

p.get_query(.)p.show_sql()

?




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



Re: custom validator in a model, not a manipulator

2006-09-18 Thread patrickk

  File
"/var/www/vhosts/mydomain.at/django_src/django/contrib/flatpages/models.py",
line 10, in FlatPage
content = models.TextField(_('content'),
validator_list=[self.eatMe])

NameError: name 'self' is not defined

it´s defined inside the model.


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



Re: Re: custom validator in a model, not a manipulator

2006-09-18 Thread James Bennett

On 9/18/06, patrickk <[EMAIL PROTECTED]> wrote:
> def goodHTML(self, field_data, all_data):

Where is this defined? Is it inside the model, or somewhere else in
the file? Does this cause an error? If so, can you paste the traceback
somewhere?

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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



Re: custom validator in a model, not a manipulator

2006-09-18 Thread patrickk

sorry, but I still don´t get it:
why is this not working?

content = models.TextField(_('content'), validator_list=[self.goodHTML])

def goodHTML(self, field_data, all_data):
...

thanks,
patrick


Am 18.09.2006 um 16:31 schrieb James Bennett:

>
> On 9/18/06, patrickk <[EMAIL PROTECTED]> wrote:
>> is  it possible to define a custom validator in a model? if yes, how?
>> so far, I´ve used custom validators only with custom manipulators and
>> that works fine.
>
> Any callable that could be used as a validator in a manipulator can
> also be passed in to a field on a model by using the optional
> 'validator_list' keyword argument.
>
> -- "May the forces of evil become confused on the way to your house."
>   -- George Carlin
>
> >


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



Re: Re: Portlet like features

2006-09-18 Thread James Bennett

On 9/18/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> But that strikes me as a bad design. Normally in MVC
> apps you have your controller to fetch all data before forwarded
> to the view.

Keep in mind that Django is not strictly MVC -- the closest thing we
have to a "controller" is the URL dispatcher, which doesn't actually
execute much code.


-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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



Re: custom validator in a model, not a manipulator

2006-09-18 Thread James Bennett

On 9/18/06, patrickk <[EMAIL PROTECTED]> wrote:
> is  it possible to define a custom validator in a model? if yes, how?
> so far, I´ve used custom validators only with custom manipulators and
> that works fine.

Any callable that could be used as a validator in a manipulator can
also be passed in to a field on a model by using the optional
'validator_list' keyword argument.

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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



custom validator in a model, not a manipulator

2006-09-18 Thread patrickk

is  it possible to define a custom validator in a model? if yes, how?
so far, I´ve used custom validators only with custom manipulators and  
that works fine.

thanks,
patrick
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Portlet like features

2006-09-18 Thread patrickk

you´re right.
I`m happy if it works the way you explained. unfortunately, I don´t  
think it does.
similar discussion: http://groups.google.com/group/django-users/ 
browse_frm/thread/f6aa4c6108fd557e/

patrick


Am 18.09.2006 um 15:56 schrieb [EMAIL PROTECTED]:

>
> But that strikes me as a bad design. Normally in MVC
> apps you have your controller to fetch all data before forwarded
> to the view. By doing it the way I (tried to) explain you are
> able to use your portlet in whatever context and by
> using template inheritance you can make all portlet appear
> the base except base content... Hmm well maybe its
> just me..
>
>
> >


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



Re: Portlet like features

2006-09-18 Thread [EMAIL PROTECTED]

But that strikes me as a bad design. Normally in MVC
apps you have your controller to fetch all data before forwarded
to the view. By doing it the way I (tried to) explain you are
able to use your portlet in whatever context and by
using template inheritance you can make all portlet appear
the base except base content... Hmm well maybe its
just me..


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



base template and URLs in it

2006-09-18 Thread skink

hi,

Lets say i want to have base template with some header with site
navigation links.
Because this base tamplate is inherited by any other templates
(associated with diffrent URLs within URL tree), i need to use in it
direct (not relative) URLs. (e.g. /apps/app1/url1, /apps/app1/url2)

It has some pros, but the bad thing is when location of my apps
changes.

How to to do that in elegant way in Django?

thanks,
skink


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



Re: template and special character problem

2006-09-18 Thread Phil

Hi Jorge,

I tried what you suggested (replace my meta http-equiv by your version)
and it does no good )c:

I also checked my settings.py and there is no DEFAULT_CHARSET nor
DEFAULT_CONTENT_TYPE, so they are defaulted to uft-8 and text/html.

Thanks for the suggestion, though.

Jorge Gajon wrote:
> On 9/16/06, Phil <[EMAIL PROTECTED]> wrote:
> > In the base.html template I added in the  section a {% block
> > extrahead %}{% endblock %}.
> > And in the index.html template I added {% block extrahead %}  > http-equiv="content-type" content="application/xhtml+xml;
> > charset=UTF-8" /> {% endblock %}
>
> It is really strange that you need to duplicate your content-type to
> make it work. I believe your problem lies in how the browser is
> interpreting your html file and not in Django.
>
> Also, what happens if you instead specify your content-type in your
> base.html file like this?
>
> 
>
> There are two differences, Content-Type (first letters are uppercase)
> and the mime type is "text/html" instead of "application/xhtml+xml"
>
> By default, Django serves the Content-Type header (in the HTTP
> response headers) like that. See DEFAULT_CHARSET and
> DEFAULT_CONTENT_TYPE:
>
> http://www.djangoproject.com/documentation/settings/#default-charset
>
>
> > I plan to debug this to see why Django doesn't seem to know what is the
> > encoding of the index.html template.
>
> If your text editor is correctly writing your files in UTF-8 and you
> didn't changed the DEFAULT_CHARSET setting in your settings file, then
> there shouldn't be any problem with how Django reads your templates.


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



Re: PATCH unique_together validation

2006-09-18 Thread libraM

Sadly not so easy solution... :(

The patch breaks *blank* ForeignKey fields used in unique_together (see
coments on #2019).


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



How to save parents and multiple children with single form?

2006-09-18 Thread Sean Schertell

Let's say I have a form called add-new-group.html that looks like this:

Group Name: __

Member 1 -->  Name:___  Age: 
Member 2 -->  Name:___  Age: 
Member 3 -->  Name:___  Age: 

So when the form is saved, it needs to save the new group to the  
'group' table, and it needs to save up to three new members to the  
'member' table.

How in the world can I do this?

Sean

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



Re: custom QerySet

2006-09-18 Thread skink


Malcolm Tredinnick wrote:
> Not very easily at the moment, no. You would need to look at creating a
> subclass of QuerySet and overriding the _get_sql_clause() method to add
> in a GROUP BY clause. So it's not impossible, just inelegant (a lot of
> code duplication involved).
>
> You can't even fake it with the extra() method, because the "extra"
> stuff is added at the front of the where clause, not the end.
thats a pity... but...

>
> There's a change to the internals of query generation coming "real soon
> now" (a week or two, maybe) that will make this easier: a side-effect of
> query generation rewriting is adding the ability to have things like
> GROUP BY and HAVING clauses to query sets for those who want to subclass
> them -- it will be for advanced use only and not exposed via the
> QuerySet interface, but will be available for those who want to dive
> into the code and subclass things.
thanks for that great news!!!

regards,
skink


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



efficient fastcgi

2006-09-18 Thread richard

I'd be grateful for some advice on efficiently combining lighttpd,
fastcgi and django. I have this working after working through the
suggestions on the django site, but am unsure whether the result is
actually very efficient, nor how to optimise.
All three (and mysql) are running on the same box (I'm not expecting
more than 30 clients accessing my site, and not mor than 2-3
simultaneous requests, and the data processing is not heavy/slow). I
start django with something like:
./manage.py runfcgi host=127.0.0.1 port=xxx method=prefork pidfile=xxx
and see 5 (the default) fastcgi processes are running.
The relevant bit of lightppd.conf is:
fastcgi.server = ( "/mysite.fcgi" => ( "main" => (  "host" =>
"127.0.0.1",  "port" => xxx, "check-local" => "disable", ) ),)
My questions are:
1) Will the 5 fascgi processes actually be used? As set up all lighttpd
request are going to the same port, and all the fastcgi processes are
listening on the same port. So which will do the work? I'm not sure
having more than 2 fascgi processes makes sense with only 2 cpus and
all clients coming over the same fastish network link? Does lighttpd's
'load balancing' capability even get invoked with everythin going
through the same port?
2) Also, is this load 'obviously' reasonable on a 2 processor 1.4Ghz
AIX 5.3 system- I appreciate time will tell
Many 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Handling 404

2006-09-18 Thread Filipe

I don't know much about error handling in django. I tried raising a 404
in one of my views and disable the debug mode in the settings, to see
how the default 404 page looks like, but instead I got the following
traceback:


Traceback (most recent call last):
  File
"/usr/lib/python2.4/site-packages/django/core/servers/basehttp.py",
line 272, in run
self.result = application(self.environ, self.start_response)

  File
"/usr/lib/python2.4/site-packages/django/core/servers/basehttp.py",
line 611, in __call__
return self.application(environ, start_response)

  File "/usr/lib/python2.4/site-packages/django/core/handlers/wsgi.py",
line 148, in __call__
response = self.get_response(request.path, request)

  File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py",
line 95, in get_response
return callback(request, **param_dict)

  File "/usr/lib/python2.4/site-packages/django/views/defaults.py",
line 79, in page_not_found
return http.HttpResponseNotFound(t.render(RequestContext(request,
{'request_path': request.path})))

  File "/usr/lib/python2.4/site-packages/django/template/context.py",
line 97, in __init__
self.update(processor(request))

  File
"/usr/lib/python2.4/site-packages/django/core/context_processors.py",
line 17, in auth
return {

AttributeError: 'WSGIRequest' object has no attribute 'user'


It seems it's looking for an attribute 'user' in the current request,
should there be one? why?


Thanks in advance!
Filipe


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



Re: custom QerySet

2006-09-18 Thread Malcolm Tredinnick

On Mon, 2006-09-18 at 02:58 -0700, skink wrote:
> hi,
> 
> Is there a way to create custom QuerySet returning some "COUNT(*)" on
> some "GROUP BY" group?

Not very easily at the moment, no. You would need to look at creating a
subclass of QuerySet and overriding the _get_sql_clause() method to add
in a GROUP BY clause. So it's not impossible, just inelegant (a lot of
code duplication involved).

You can't even fake it with the extra() method, because the "extra"
stuff is added at the front of the where clause, not the end.

There's a change to the internals of query generation coming "real soon
now" (a week or two, maybe) that will make this easier: a side-effect of
query generation rewriting is adding the ability to have things like
GROUP BY and HAVING clauses to query sets for those who want to subclass
them -- it will be for advanced use only and not exposed via the
QuerySet interface, but will be available for those who want to dive
into the code and subclass things.

Regards,
Malcolm



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



custom QerySet

2006-09-18 Thread skink

hi,

Is there a way to create custom QuerySet returning some "COUNT(*)" on
some "GROUP BY" group?
I really need QuerySet since I need this for
django.views.generic.list_detail.object_list.

thanks,
skink


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



Re: Charfield maxlength (bug?)

2006-09-18 Thread Ivan Sagalaev

Malcolm Tredinnick wrote:
> If I had to guess, I would say this has to do with encoding.  When the
> form is submitted back to the web server, the content will be encoded
> as, say, UTF-8. The length of your input string as bytes is longer than
> 10 (since each of those characters is 2 bytes in UTF-8 encoding).
> 
> This is something we are slowly fixing as part of a unicode pass through
> Django, but it definitely helps to have them reported.

In fact this particular bug with maxlength was fixed almost a year ago. 
I think the problem here is not on Django side but on the DB side. It 
can happen if the DB is set up to be in some legacy encoding instead of 
UTF-8.

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



Re: cleanup (X)HTML-code

2006-09-18 Thread patrickk

thanks malcolm, jay.
your suggestions are very helpful.

patrick

Am 17.09.2006 um 19:15 schrieb Jay Parlar:

>
> On 9/17/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>> Is your input guaranteed to be well-formed XHTML? If so, ElementTree
>> (http://effbot.org/zone/element-index.htm ) will be faster,  
>> particularly
>> cElementTree. It always feels very Pythonic when you program with  
>> it, so
>> it gets ease-of-use points.
>>
>> BeautifulSoup is a lifesaver when you need to process HTML that  
>> might be
>> not particularly well constructed and I like its functionality in  
>> that
>> area. I haven't used it in very heavy multi-process environments,  
>> so I
>> must admit that the memory usage isn't something I've worried  
>> about too
>> much. Not sure who comfortable it is to write out something that
>> BeautifulSoup has parsed -- you'll need to write your own serialiser
>> (ElementTree has SimpleXMLWriter) -- but that shouldn't be a
>> showstopper.
>>
>> For BeautifulSoup you are going to have to write a tree walker to
>> process the nodes. ElementTree-based code could be handled in the  
>> same
>> fashion, but the iterparse() method for processing as you parse is my
>> favourite way of working where I have to act on potentially all the
>> input.
>>
>
>
> Or if you want the best of both worlds, you can try Fredrick's
> ElementSoup (http://effbot.org/zone/element-soup.htm). It produces an
> ElementTree wrapper around BeautifulSoup's output.
>
> Jay P.
>
> >


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



Re: Portlet like features

2006-09-18 Thread patrickk

I think you could do that (or something similar) with using template- 
tags.
we´re having a sidebar on one of our django-sites where the user is  
able to select the content (and position) she wants. since we don´t  
know what´s going to be loaded when calling the view, we have to use  
template-tags.

patrick

Am 18.09.2006 um 09:44 schrieb [EMAIL PROTECTED]:

>
> I am a happy but rather newbie user of django but one thing seems to
> rattle my chain :-). I've created a base template which includes
> several blocks which are overridden/inserted in the specific pages,  
> but
> if the template is to use any context parameters I have to set  
> these in
> ALL controller methods (or remember to call a generic template
> controller method also). I was looking for a way to include what seems
> to be quite close to be a portlet, basically it is just a way to
> include the output from another URL (being local or remote). I've
> started to write a portlet tag which would e.g. be an URL to another
> resource on the local server. To be more specific I'm doing this:
>
> BaseTemplate.html
> 
> {% portlet /portlet/SomePortlet/ %}
>
> urls.py
> 
> r'^portlet/SomePortlet/$','project.views.somePortlet'
>
> views.py
> 
> def somePortlet(request):
> fetchData()
> return render_template(...)
>
> But I am not sure if there is a smarter way to do this and/or if this
> feature is already included in django somehow?
>
> regards / Lars Borup Jensen
>
>
> >


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



Portlet like features

2006-09-18 Thread [EMAIL PROTECTED]

I am a happy but rather newbie user of django but one thing seems to
rattle my chain :-). I've created a base template which includes
several blocks which are overridden/inserted in the specific pages, but
if the template is to use any context parameters I have to set these in
ALL controller methods (or remember to call a generic template
controller method also). I was looking for a way to include what seems
to be quite close to be a portlet, basically it is just a way to
include the output from another URL (being local or remote). I've
started to write a portlet tag which would e.g. be an URL to another
resource on the local server. To be more specific I'm doing this:

BaseTemplate.html

{% portlet /portlet/SomePortlet/ %}

urls.py

r'^portlet/SomePortlet/$','project.views.somePortlet'

views.py

def somePortlet(request):
fetchData()
return render_template(...)

But I am not sure if there is a smarter way to do this and/or if this
feature is already included in django somehow?

regards / Lars Borup Jensen


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



Re: [FastCGI] - I don't have permission....

2006-09-18 Thread viestards

> Forbidden
> "You don't have permission to access / on this server."

for me problem was in
RewriteRule ^/(.*)$ /mysite.fcgi/$1 [QSA,L]

i changed to
RewriteRule ^(.*)$ mysite.fcgi/$1 [L]
and it worked

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



Re: Newbie - How do I perform custom sql queries?

2006-09-18 Thread Jakub Krajniak

bmeredyk wrote:
> I'm just starting out with django and need some help with how to
> perform custom queries.  The query I want to do is basically this:
>
> SELECT num_volunteers, num_boxes, (num_boxes * 216) as meals,
> (num_boxes/num_volunteers) as box_per_person FROM shifts WHERE site =
> %s AND date BETWEEN %s and %s
>
(...)

well you run this query in python environment so I think that best way
would be to make simple chain query without this mathematical
operation.
e.g.
Shifts.objects.filter(site=,date__gte=datetime.date(...),date__lte=datetime.date(...))

Regards,
Jakub


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