Problems loading static files on runserver (I mean images and css)

2010-08-26 Thread Karim Gorjux
As I read here http://docs.djangoproject.com/en/dev/howto/static-files/ I
configure the settings.py and the urls.py to load a template in runserver.

## urls.py ##

from django.conf import settings

[...]

(r'^media/(?P.*)$', 'django.views.static.serve',
{'document_root': 'settings.STATIC_DOC_ROOT'}),

## end of urls.py ##


## settings.py ##
[...]
STATIC_DOC_ROOT = '/Users/karim/Projects/simplesite/template/media/'
[...]
## end of settings.py ##

My doubt is in these 3 variables. How I have to use they?

MEDIA_ROOT = ''
MEDIA_URL = ''
ADMIN_MEDIA_PREFIX = '/media/'


I tried a lot but without success.

Another question. In the template how I have to refer to the files? I have
just 2: "style.css" and "header.jpg" that are located in
"/Users/karim/Projects/simplesite/template/media"

Is these code right?





Thanks!

-- 
Karim Gojux
www.karimblog.net

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: App for Registration/Authorization which is Email & Password based (not username)

2010-08-26 Thread nobosh
Thanks for the reply. The learning curve to get started has been
harder than I expected.

I found this: http://github.com/redvasily/django-emailauth

Which seems to handle things well but it's still a hack (it's adding
IDs in front of the email to create a username. I ran the setup.py and
loaded the code's example but noticed the example app is not using the
templates. Do the templates/App get copied to the Django core during
the installation?

I was hoping to app it:
/
 / emailauth
  / emailauth/templates

And then customize those email templates. Is that they way things are
done with Django? did I setup this up wrong? Any advice is
appreciated. thxs

On Aug 26, 10:19 pm, Shawn Milochik  wrote:
> If you still want to use the contrib.auth app, you can just add your
> own backend to the user authentication. It's very easy to do.
>
> http://docs.djangoproject.com/en/dev/topics/auth/#writing-an-authenti...
>
> There are some very smart people who prefer not to use contrib.auth
> for a variety of reasons, but if you're new to Django it's much *much*
> easier to stick with it because there's plenty of documentation, most
> people use it, and many open-source apps rely on it.
>
> Here's a backend I wrote to allow users to log in by e-mail address
> instead of username. If you read the docs above then this will make
> sense (it's based on the sample in the docs):
>
> http://dpaste.com/hold/234692/
>
> However, this doesn't exactly meet your needs, because it doesn't
> address the creation of new users with valid, unique usernames as
> required by contrib.auth. What my backend does is, when added to
> AUTHENTICATION_BACKENDS in settings.py, allow users to log in with
> either their username or e-mail address. If you have users who don't
> even know they have a "username" then it amounts to the same thing.
>
> Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: App for Registration/Authorization which is Email & Password based (not username)

2010-08-26 Thread Shawn Milochik
If you still want to use the contrib.auth app, you can just add your
own backend to the user authentication. It's very easy to do.

http://docs.djangoproject.com/en/dev/topics/auth/#writing-an-authentication-backend

There are some very smart people who prefer not to use contrib.auth
for a variety of reasons, but if you're new to Django it's much *much*
easier to stick with it because there's plenty of documentation, most
people use it, and many open-source apps rely on it.

Here's a backend I wrote to allow users to log in by e-mail address
instead of username. If you read the docs above then this will make
sense (it's based on the sample in the docs):

http://dpaste.com/hold/234692/

However, this doesn't exactly meet your needs, because it doesn't
address the creation of new users with valid, unique usernames as
required by contrib.auth. What my backend does is, when added to
AUTHENTICATION_BACKENDS in settings.py, allow users to log in with
either their username or e-mail address. If you have users who don't
even know they have a "username" then it amounts to the same thing.

Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



App for Registration/Authorization which is Email & Password based (not username)

2010-08-26 Thread nobosh
Hello, I'm on day 7 learning Django and would appreciate any info
around getting my Django app started with a Registration/Authorization
which is Email & Password based (not username). I'll don't currently
have a need for usernames. Is there an app or a clean/smart way to
implement. I'm trying to avoid bad habits as this is my first step
after reading the book.

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-us...@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: question on directory structure for deploying project

2010-08-26 Thread Joel Klabo
Could someone just show me how theirs is set up?

On Aug 26, 4:54 pm, Joel Klabo  wrote:
> It does have __init__.py, but not the server isn't seeing it... '500
> internal server error'
>
> On Aug 26, 4:48 pm, Kenneth Gonsalves  wrote:
>
>
>
> > On Thu, 2010-08-26 at 16:44 -0700, Joel Klabo wrote:
> > > also, when I change the virtual host path to: /srv/www/brooski.net
> > > (instead of /srv/www/brooski.net/brooski/) I get an internal server
> > > error. Whereas with '/srv/www/brooski.net/brooski/' I get the actual
> > > django error page
>
> > the question is that does brooski directory have an __init__.py file in
> > it. If so, It should not be on the path - only the parent directory
> > should be in the path.
> > --
> > regards
> > Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: ModelMultipleChoiceField queryset argument does not limit widget choices

2010-08-26 Thread The Boss
Ok, I sort of found a solution.  After much digging and looking at
class dictionaries
I found that i could manually update the dictionary self.base_fields.

self.base_fields['associated_files']
=self.__class__.associated_files

It's seems that class attrs assigned in init do not get added to the
declared fields dict
which may be why they don't show in the self.base_fields.
This should really be much easier.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Django + GAE, Changing Auth from userid/password to email/password

2010-08-26 Thread dar
Nonrel is more actively discussed on their mailing list:
http://groups.google.com/group/django-non-relational

GAE python is actively discussed here: 
http://groups.google.com/group/google-appengine-python

The django helper on GAE is discussed here, but there isn't much
traffic on the mailing list.  Most of the discussion happens in the
issue tracker.  http://groups.google.com/group/app-engine-django



On Aug 26, 7:49 pm, Karen Tracey  wrote:
> On Thu, Aug 26, 2010 at 1:38 PM, nobosh  wrote:
> > Good to know I'm not the only one :) this forum seems to be a little
> > low with activity. Do you know of a better place to get Django
> > support / advice to help a newbie like myself along?
>
> Low activity? This group gets about 60 posts a day. The high volume likely
> contributes to some questions going unanswered.
>
> Are you looking for Django support or Django+GAE+nonrel? If the former, this
> is likely the best place to ask questions, but if you throw in GAE and
> django-nonrel likely a large fraction of the audience reading this forum
> just skips over the question because the expertise here does appear to be
> mainly straight Django, not Django under GAE. I have a sense there are other
> forums for GAE but I don't know what they are specifically.
>
> Karen
> --http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Мобильная версия

2010-08-26 Thread Олег Корсак
English?

27.08.2010 04:42, Vanger - irk пишет:
> не могу понять, как лучше реализовать определение того, что человек
> зашел сейчас с мобилы, и что мне нужно подсунуть ему мобильную
> версию ?
> Может быть кто-то уже реализовывал эти моменты?
> 



signature.asc
Description: OpenPGP digital signature


Мобильная версия

2010-08-26 Thread Vanger - irk
не могу понять, как лучше реализовать определение того, что человек
зашел сейчас с мобилы, и что мне нужно подсунуть ему мобильную
версию ?
Может быть кто-то уже реализовывал эти моменты?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: permissions and ownership

2010-08-26 Thread Graham Dumpleton
And for those who could't work out what the solution was from the 'Got
It!' response, you will find these errors covered in my mod_wsgi talk.
See:

  
http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_Presentations

:-)

Graham

On Aug 27, 2:40 am, Bradley Hintze 
wrote:
> I got it :)
>
> On Thu, Aug 26, 2010 at 12:35 PM, Bradley Hintze
>
>
>
>
>
>  wrote:
> > Not getting much of a respose BUT I did make progress. I had a major
> > typo but now i get Internal Server Error
>
> > error_log
>
> > Thu Aug 26 12:30:25 2010] [error] [client 152.16.223.251]
> > (13)Permission denied: mod_wsgi (pid=594, process='',
> > application='summit.research.duhs.duke.edu|'): Call to fopen() failed
> > for 
> > '/Users/bradleyhintze/djcode/MolProbity_Compare_test/apache/django.wsgi'.
> > [Thu Aug 26 12:30:25 2010] [error] [client 152.16.223.251] mod_wsgi
> > (pid=594): Exception occurred processing WSGI script
> > '/Users/bradleyhintze/djcode/MolProbity_Compare_test/apache/django.wsgi'.
> > [Thu Aug 26 12:30:25 2010] [error] [client 152.16.223.251] IOError:
> > [Errno 13] Permission denied
>
> > I hope someone can help me given this.
>
> > Bradley
>
> > On Thu, Aug 26, 2010 at 11:45 AM, Bradley Hintze
> >  wrote:
> >> Here are some more details.
>
> >> httpd.conf
>
> >> Alias /media/ /Users/bradleyhintze/django/MolProbity_Compare_test/media/
>
> >> 
> >> Order deny,allow
> >> Allow from all
> >> 
>
> >> WSGIScriptAlias /
> >> /Users/bradleyhintze/django/MolProbity_Compare_test/apache/django.wsgi
>
> >> 
> >> Order deny,allow
> >> Allow from all
> >> 
>
> >> Error_log
>
> >> [Thu Aug 26 11:27:15 2010] [error] [client 152.16.223.251] client
> >> denied by server configuration: /Users/bradleyhintze/django
> >> [Thu Aug 26 11:27:16 2010] [error] [client 152.16.223.251] client
> >> denied by server configuration: /Users/bradleyhintze/django
> >> [Thu Aug 26 11:27:16 2010] [error] [client 152.16.223.251] client
> >> denied by server configuration: /Users/bradleyhintze/django
>
> >> permission set for   /Users/bradleyhintze/django
>
> >> drwxr-x--x    7 _www           admin   238 Aug 26 09:19 djcode
>
> >> permission set for   /Users/bradleyhintze/django/MolProbity_Compae_test
>
> >> drwxrwx--x  22 _www           admin  748 Aug 26 09:35 
> >> MolProbity_Compare_test
>
> >> Any ideas out there???
>
> >> On Thu, Aug 26, 2010 at 10:06 AM, Bradley Hintze
> >>  wrote:
> >>> Hi all,
>
> >>> I am a newbie when it comes to Appach and mod_wsgi. I followed
> >>>http://code.google.com/p/modwsgi/wiki/IntegrationWithDjangoand think
> >>> I did everthing correctly. However, I am having permission issues. I
> >>> have been exposed to but am no entirely comfortable with permissions
> >>> and ownership. Here is what I get when I go to my site:
>
> >>> Forbidden
>
> >>> You don't have permission to access / on this server.
>
> >>> I assume 'mysite' directory needs to be owned by www? What about the
> >>> files and directories within 'mysite'? What about permissions?
>
> >>> Any help and/direction will be greatly appreciated.
>
> >>> Thanks,
>
> >>> Bradley
>
> >> --
> >> Bradley J. Hintze
> >> Graduate Student
> >> Duke University
> >> School of Medicine
> >> 801-712-8799
>
> > --
> > Bradley J. Hintze
> > Graduate Student
> > Duke University
> > School of Medicine
> > 801-712-8799
>
> --
> Bradley J. Hintze
> Graduate Student
> Duke University
> School of Medicine
> 801-712-8799

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Which PostgreSQL driver do you use

2010-08-26 Thread Kenneth Gonsalves
On Fri, 2010-08-27 at 08:26 +0800, Russell Keith-Magee wrote:
> > pyscopg has been more or less standard ever since I can remember.
> 
> Due to a lack of maintenance (last psycopg release was in 2005),
> psycopg was added to the deprecation path in 1.2. It will be removed
> in 1.4.
> 
> psycopg2 is now the preferred driver for Django (using the
> postgres_psycopg2 backend). 

that is what I meant (forgot to add the '2')
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Which PostgreSQL driver do you use

2010-08-26 Thread Russell Keith-Magee
On Fri, Aug 27, 2010 at 7:35 AM, Kenneth Gonsalves  wrote:
> On Thu, 2010-08-26 at 22:17 -0100, Joshua Russo wrote:
>> There are a lot of PostgreSQL drivers listed on the Python Wiki
>> http://wiki.python.org/moin/PostgreSQL
>>
>> Has anyone found one to be better or even that different from
>> another?
>
> pyscopg has been more or less standard ever since I can remember.

Due to a lack of maintenance (last psycopg release was in 2005),
psycopg was added to the deprecation path in 1.2. It will be removed
in 1.4.

psycopg2 is now the preferred driver for Django (using the
postgres_psycopg2 backend).

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Django 1.2 unittests: Second time through, things get weird

2010-08-26 Thread Russell Keith-Magee
On Fri, Aug 27, 2010 at 1:43 AM, Elf_Sternberg  wrote:
> Is anyone seeing this?  I have this function at the top of my
> unittest:
>
> def create_user(name):
>    username = name.replace(' ', '').lower()
>    return User.objects.create_user(username, username + '@a.com',
> 'password')
>
> And then (this is ultimately the code I derived to examine this
> behavior):
>
> class StartupTest(TestCase):
>    def setUp(self):
>        users = [create_user(name) for name in ["Fred", "Barney",
> "Pebbles"]]
>
>    def test1(self):
>        print User.objects.all()
>
>    def test2(self):
>        print User.objects.all()
>
> The output was:
> [, , ]
> [, , ]
>
> Where did the usernames go in the second test?  My understanding of
> the documentation is that the test driver is supposed to update the
> database with every new test.  It doesn't seem to be working with
> Users, and I'm not sure why.

Are you using a django.test.TestCase or unittest.TestCase?

If you're using unittest.TestCase, then the 'units' won't be as
isolated as you perhaps think. The database persists between database
runs, so objects created in one test will still exist when the second
executes.

If you use django.test.TestCase, Django will return the database to a
pristine state at the start of each test. Alternatively, you could use
a tearDown() method in your testcase to clean up the objects that you
create.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Django 1.2 unittests: Second time through, things get weird

2010-08-26 Thread Karen Tracey
On Thu, Aug 26, 2010 at 1:43 PM, Elf_Sternberg wrote:

> Is anyone seeing this?  I have this function at the top of my
> unittest:
>
> def create_user(name):
>username = name.replace(' ', '').lower()
>return User.objects.create_user(username, username + '@a.com',
> 'password')
>
> And then (this is ultimately the code I derived to examine this
> behavior):
>
> class StartupTest(TestCase):
>def setUp(self):
>users = [create_user(name) for name in ["Fred", "Barney",
> "Pebbles"]]
>
>def test1(self):
>print User.objects.all()
>
>def test2(self):
>print User.objects.all()
>
> The output was:
> [, , ]
> [, , ]
>
> Where did the usernames go in the second test?  My understanding of
> the documentation is that the test driver is supposed to update the
> database with every new test.  It doesn't seem to be working with
> Users, and I'm not sure why.
>

For me, copy/paste of your code into a tests.py file in one of my apps,
importing TestCase from django.test and User from
django.contrib.auth.models, and running with manage.py test produces the
output:

[, , ]
.[, , ]
.
--
Ran 2 tests in 0.000s

OK
Destroying test database...

You are using django.test.TestCase? and the regular auth User model? Any
special test runner?

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: question on directory structure for deploying project

2010-08-26 Thread Joel Klabo
It does have __init__.py, but not the server isn't seeing it... '500
internal server error'

On Aug 26, 4:48 pm, Kenneth Gonsalves  wrote:
> On Thu, 2010-08-26 at 16:44 -0700, Joel Klabo wrote:
> > also, when I change the virtual host path to: /srv/www/brooski.net
> > (instead of /srv/www/brooski.net/brooski/) I get an internal server
> > error. Whereas with '/srv/www/brooski.net/brooski/' I get the actual
> > django error page
>
> the question is that does brooski directory have an __init__.py file in
> it. If so, It should not be on the path - only the parent directory
> should be in the path.
> --
> regards
> Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Django + GAE, Changing Auth from userid/password to email/password

2010-08-26 Thread Karen Tracey
On Thu, Aug 26, 2010 at 1:38 PM, nobosh  wrote:

> Good to know I'm not the only one :) this forum seems to be a little
> low with activity. Do you know of a better place to get Django
> support / advice to help a newbie like myself along?
>

Low activity? This group gets about 60 posts a day. The high volume likely
contributes to some questions going unanswered.

Are you looking for Django support or Django+GAE+nonrel? If the former, this
is likely the best place to ask questions, but if you throw in GAE and
django-nonrel likely a large fraction of the audience reading this forum
just skips over the question because the expertise here does appear to be
mainly straight Django, not Django under GAE. I have a sense there are other
forums for GAE but I don't know what they are specifically.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: question on directory structure for deploying project

2010-08-26 Thread Kenneth Gonsalves
On Thu, 2010-08-26 at 16:44 -0700, Joel Klabo wrote:
> also, when I change the virtual host path to: /srv/www/brooski.net
> (instead of /srv/www/brooski.net/brooski/) I get an internal server
> error. Whereas with '/srv/www/brooski.net/brooski/' I get the actual
> django error page 

the question is that does brooski directory have an __init__.py file in
it. If so, It should not be on the path - only the parent directory
should be in the path.
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: ip to distance mapping

2010-08-26 Thread Sam Walters
I have used geoip in conjunction with the rest of the geodjango
functionality. However you shouldnt have to deal with all the extra
complexity of geodjango (which isnt too bad one you get used to it ;).

Basically the process involves querying 2 IP's , getting a 'Point' for
each and then calculating the distance between them. Where the
distance is an arc length.

http://docs.djangoproject.com/en/dev/ref/contrib/gis/geoip/

cheers

sam_w

On Fri, Aug 27, 2010 at 7:13 AM, Bobby Roberts  wrote:
> I'm needing an easy way to convert a client IP to a geo location and
> then get the distance from that lat/long to a fixed lat/long
> coordinate.  Is there anything out there that can do this with
> django.  I've been looking at geodjango but that looks pretty dang
> complicated and i'm not even sure it will do what i'm needing.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: question on directory structure for deploying project

2010-08-26 Thread Joel Klabo
also, when I change the virtual host path to: /srv/www/brooski.net
(instead of /srv/www/brooski.net/brooski/) I get an internal server
error. Whereas with '/srv/www/brooski.net/brooski/' I get the actual
django error page

On Aug 26, 4:20 pm, Joel Klabo  wrote:
> on my VPS i have my project at: /srv/www/brooski.net/brooski/(all my
> files, settings.py, url.py are here)
>
> and my VirtualHost is setup like this:
>
> 
>         ServerAdmin r...@brooski.net
>         ServerName brooski.net
>         ServerAliaswww.brooski.net
>         DocumentRoot /srv/www/brooski.net/public_html/
>         PythonPath "['/srv/www/brooski.net/brooski', '/usr/lib/
> pymodules/python2.6/'] + sys.path"
>         
>                 SetHandler python-program
>                 PythonHandler django.core.handlers.modpython
>                 SetEnv DJANGO_SETTINGS_MODULE settings
>                 PythonDebug Off
>         
>
>         ErrorLog /srv/www/brooski.net/logs/error.log
>         CustomLog /srv/www/brooski.net/logs/access.log combined
> 
>
> And when i goto brooski.net i get the django error page saying:
>
> ImportError at /
> No module named brooski.urls
>
> So, I tried going and removing the 'brooski.' everywhere in my project
> and that got me through a bunch of similar errors but I eventually got
> one where it was using 'brooski.net' as my module name and it was
> causing a problem.
>
> Basically I don't know how to set up this structure, am I doing
> something wrong? Thanks for any advice, and please don't use my
> sensitive information against 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-us...@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: Which PostgreSQL driver do you use

2010-08-26 Thread Kenneth Gonsalves
On Thu, 2010-08-26 at 22:17 -0100, Joshua Russo wrote:
> There are a lot of PostgreSQL drivers listed on the Python Wiki
> http://wiki.python.org/moin/PostgreSQL
> 
> Has anyone found one to be better or even that different from
> another? 

pyscopg has been more or less standard ever since I can remember.
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Which PostgreSQL driver do you use

2010-08-26 Thread Joshua Russo
On Thu, Aug 26, 2010 at 10:17 PM, Joshua Russo wrote:

> There are a lot of PostgreSQL drivers listed on the Python Wiki
> http://wiki.python.org/moin/PostgreSQL
>
> Has anyone found one to be better or even that different from another?
>

Nevermind, It helps to read the docs.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



question on directory structure for deploying project

2010-08-26 Thread Joel Klabo
on my VPS i have my project at: /srv/www/brooski.net/brooski/(all my
files, settings.py, url.py are here)

and my VirtualHost is setup like this:


ServerAdmin r...@brooski.net
ServerName brooski.net
ServerAlias www.brooski.net
DocumentRoot /srv/www/brooski.net/public_html/
PythonPath "['/srv/www/brooski.net/brooski', '/usr/lib/
pymodules/python2.6/'] + sys.path"

SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE settings
PythonDebug Off


ErrorLog /srv/www/brooski.net/logs/error.log
CustomLog /srv/www/brooski.net/logs/access.log combined


And when i goto brooski.net i get the django error page saying:

ImportError at /
No module named brooski.urls

So, I tried going and removing the 'brooski.' everywhere in my project
and that got me through a bunch of similar errors but I eventually got
one where it was using 'brooski.net' as my module name and it was
causing a problem.

Basically I don't know how to set up this structure, am I doing
something wrong? Thanks for any advice, and please don't use my
sensitive information against 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-us...@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: save inline models when saving the father in admin

2010-08-26 Thread Karen Tracey
On Thu, Aug 26, 2010 at 12:02 PM, Alessandro Ronchi <
alessandro.ron...@soasi.com> wrote:

> I need to be sure that an inline model is saved every time I save its
> parent class.
> I need it because I want to save the last modified timestamp, and I don't
> want to overwrite the parent save because I want to track only admin saves.
>
> I cannot touch the parent class because it came from a library.
>
> Is it possible?
>

Yes. Override save_formset for the ModelAdmin containing the inline:

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_formset

Note the formset.save() only returns the modified objects -- the ones that
based on data changing appear to need to be saved. You'll also need to save
any of the initial forms (formset.initial_forms) that don't appear to be
modified, if you want to save all of the objects even if the form data has
not changed from initial values.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Which PostgreSQL driver do you use

2010-08-26 Thread Joshua Russo
There are a lot of PostgreSQL drivers listed on the Python Wiki
http://wiki.python.org/moin/PostgreSQL

Has anyone found one to be better or even that different from another?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 won't start now for some reason....

2010-08-26 Thread Joel Klabo
Got it, I had accidentally deleted my error.log file and when it
couldn't find it it borked itself.

On Aug 26, 3:36 pm, Joel Klabo  wrote:
> Apache was running fine, as far as I know I didn't change anything.
> This is the error log:http://dpaste.com/234582/
>
> SIGTERM?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Newbie question: can foreign key fields used as search fields on admin page?

2010-08-26 Thread Kenneth Gonsalves
On Wed, 2010-08-25 at 21:49 -0700, Joe Z wrote:
> class BookAdmin(admin.ModelAdmin):
> list_display = ('title', 'author', 'publisher')
> search_fields = ('first_name', 'last_name')
> 
> Is it possible to add 'publisher' into search_fields so that in admin
> page books showed can be narrow down by a specific publisher? I tried
> it but got the following exception: 

search_fields = ['foreign_key__related_fieldname'] (from the docs)
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: permissions and ownership

2010-08-26 Thread Steve Holden
On 8/26/2010 12:40 PM, Bradley Hintze wrote:
> I got it :)
> 
See how effective this group is? You just have to post to it and you
find the answers to your questions by yourself! :-)

Glad you worked in out.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 won't start now for some reason....

2010-08-26 Thread Joel Klabo
Apache was running fine, as far as I know I didn't change anything.
This is the error log:
http://dpaste.com/234582/

SIGTERM?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



fixtures: loading user profiles with user data

2010-08-26 Thread oso_foo
My initial data for testing an app includes users, and I'm using user
profiles. As the fixture for the app loads (while running "manage.py
test"), I get "DatabaseError: no such table: userprofile_userprofile".
This happens whether or not userprofile.userprofile data is in the
fixture. So, my question: how do I get user profile data to load in a
fixture? 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-us...@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.



globally change default id field type

2010-08-26 Thread andoco
I know that I can set a custom 'id' field type by using the
'primary_key' attribute, but is there a way to do this globally so
that it doesn't need to be specified in the model? For example, a
setting like this:

AUTO_ID_FIELD_TYPE = 'myfields.MyAutoUUIDField'

The reason I'd like to do this globally is so that it affects all apps
in my project, including third-party apps (which I realize could
potentially break them).

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-us...@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.



ip to distance mapping

2010-08-26 Thread Bobby Roberts
I'm needing an easy way to convert a client IP to a geo location and
then get the distance from that lat/long to a fixed lat/long
coordinate.  Is there anything out there that can do this with
django.  I've been looking at geodjango but that looks pretty dang
complicated and i'm not even sure it will do what i'm needing.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Django Multiple Quiers to Auth User

2010-08-26 Thread stephen Enright
On further investigation this seems to be caused by the auth
AuthenticationMiddleware.

It makes a call to LazyUser for every request.


Is anybody aware of a workaround for this or would this involve
creating a  new AuthenticationMiddleware implementation
and is it possible to configure a different request implementation to
only lookup the user when it is required.

Thanks



On Wed, Aug 25, 2010 at 10:44 PM, ste010  wrote:
> Hi Guys
>
> I switched on the debug toolbar in order to see what sql queires are
> being executed for each request.
>
> I Noticed that the auth_user table is queried once and the
> auth_message table is queried once for each request.
> This is two queries per request when the user is authenticated with
> the applicaiton.
>
> Has anybody any advice on how to limit these queires for views that
> dont require authentication, authorization etc.
>
>
> Also is there a way to turn  to configure sessions in an adhoc manner
> as certain requests dont require sessions?   As I also see the
> `django_session' table being hit for each request?
>
>
> 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-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



execution time of qualified view name vs alias in reverse and url tag

2010-08-26 Thread kbs
After accumulating a large number of apps over the years in a single
web project, I would say that the time it takes to reverse urls has
become quite significant, especially if we have multiple links on
screen using the reverse function.

Would there be a noticeable difference if we go back to using
qualified view names in reverse function as such 'app.views.view_func'
vs using aliased names? I'm thinking in the latter the lookup might
involve all apps included in the project and hence the long execution
time?

Now if there is no difference in using either? are there any other
optimization solutions anyone would recommend? short of hard coding
the urls?

Thanks all

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Problems with Relationships ManytoMany in Django 1.2.1

2010-08-26 Thread tkulev
Hi guys,

I want to make some simple relationship models about relations between
users. I have this model:

class Relation(models.Model):
user = models.ForeignKey(User)
relation = models.ManyToManyField(User, related_name="relations")
type = models.ForeignKey(RelationshipType, blank=False)

def __unicode__(self):
return self.name

The User is user model from django.auth app.

I've try simple add a new user and make a relation between the logged-
in user and the new:

u = User.objects.create_user('proba9', 'pr...@abv.bg', 'probapass')
u.save()
u = User.objects.using("default").get(pk=u.pk)
usr = request.user
ru = RelationshipType.objects.get(pk='1')
r = Relation(usr,ru)
r.relation.add(u)
r.save()

After r.relation.add(u) django rise me this error:

Cannot add "": instance is on database "None", value is
on database "default"

I have only one DB in settings.py and it's a mysql and it's with label
default. After the execution of the code the new user is created, but
the relation couldn't.

I have contact with some friends with more experience than me and they
think that this can be bug in Django. My currently version of Django
is 1.2.1.

If someone can help me I'll be very thankful.

Best, Tihomil Kulev!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Template not found

2010-08-26 Thread Bradley Hintze
Got it!

On Thu, Aug 26, 2010 at 2:56 PM, Bradley Hintze
 wrote:
> A found the template error, a typo. But now I have an impor error:
>
> [Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251] mod_wsgi
> (pid=1440): Exception occurred processing WSGI script
> '/Users/bradleyhintze/djcode/MolProbity_Compare_test/apache/django.wsgi'.,
> referer: http://summit.research.duhs.duke.edu/home/
> [Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251] Traceback
> (most recent call last):, referer:
> http://summit.research.duhs.duke.edu/home/
> [Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]   File
> "/Library/Python/2.6/site-packages/django/core/handlers/wsgi.py", line
> 230, in __call__, referer: http://summit.research.duhs.duke.edu/home/
> [Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]
> self.load_middleware(), referer:
> http://summit.research.duhs.duke.edu/home/
> [Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]   File
> "/Library/Python/2.6/site-packages/django/core/handlers/base.py", line
> 33, in load_middleware, referer:
> http://summit.research.duhs.duke.edu/home/
> [Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]     for
> middleware_path in settings.MIDDLEWARE_CLASSES:, referer:
> http://summit.research.duhs.duke.edu/home/
> [Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]   File
> "/Library/Python/2.6/site-packages/django/utils/functional.py", line
> 276, in __getattr__, referer:
> http://summit.research.duhs.duke.edu/home/
> [Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]
> self._setup(), referer: http://summit.research.duhs.duke.edu/home/
> [Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]   File
> "/Library/Python/2.6/site-packages/django/conf/__init__.py", line 40,
> in _setup, referer: http://summit.research.duhs.duke.edu/home/
> [Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]
> self._wrapped = Settings(settings_module), referer:
> http://summit.research.duhs.duke.edu/home/
> [Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]   File
> "/Library/Python/2.6/site-packages/django/conf/__init__.py", line 75,
> in __init__, referer: http://summit.research.duhs.duke.edu/home/
> [Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]     raise
> ImportError("Could not import settings '%s' (Is it on sys.path? Does
> it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)), referer:
> http://summit.research.duhs.duke.edu/home/
> [Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]
> ImportError: Could not import settings
> 'MolProbity_Compare_test.settings' (Is it on sys.path? Does it have
> syntax errors?): No module named settings, referer:
> http://summit.research.duhs.duke.edu/home/
>
> I do have it on the sys.path in django.wsgi, here it is:
>
> import os
> import sys
> sys.path.append('/Users/bradleyhintze/djcode')
> sys.path.append('/Users/bradleyhintze/djcode/MolProbity_Compare_test')
>
> os.environ['DJANGO_SETTINGS_MODULE'] = 'MolProbity_Compare_test.settings'
>
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
>
> Any ideas??
> Thanks,
> Bradley
>
> On Thu, Aug 26, 2010 at 2:50 PM, Piotr Kilczuk  wrote:
>> Hi,
>>
>> If you need to debug, set DEBUG to True, obviously...
>>
>> Second thing - what is your TEMPLATE_DIRS and TEMPLATE_LOADERS setting?
>>
>> Regards,
>> Piotr
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-us...@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.
>>
>>
>
>
>
> --
> Bradley J. Hintze
> Graduate Student
> Duke University
> School of Medicine
> 801-712-8799
>



-- 
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Template not found

2010-08-26 Thread Piotr Kilczuk
> I do have it on the sys.path in django.wsgi, here it is:
>
> import os
> import sys
> sys.path.append('/Users/bradleyhintze/djcode')
> sys.path.append('/Users/bradleyhintze/djcode/MolProbity_Compare_test')

Seems like it is somehow not there - is settings.py inside
/Users/bradleyhintze/djcode/MolProbity_Compare_test?

You can also try inserting the path at the first position of the
sys.path instead of appending. Remember to restart Apache when you are
making config changes.

http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html

Regards,
Piotr

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Template not found

2010-08-26 Thread Bradley Hintze
A found the template error, a typo. But now I have an impor error:

[Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251] mod_wsgi
(pid=1440): Exception occurred processing WSGI script
'/Users/bradleyhintze/djcode/MolProbity_Compare_test/apache/django.wsgi'.,
referer: http://summit.research.duhs.duke.edu/home/
[Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251] Traceback
(most recent call last):, referer:
http://summit.research.duhs.duke.edu/home/
[Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]   File
"/Library/Python/2.6/site-packages/django/core/handlers/wsgi.py", line
230, in __call__, referer: http://summit.research.duhs.duke.edu/home/
[Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]
self.load_middleware(), referer:
http://summit.research.duhs.duke.edu/home/
[Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]   File
"/Library/Python/2.6/site-packages/django/core/handlers/base.py", line
33, in load_middleware, referer:
http://summit.research.duhs.duke.edu/home/
[Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251] for
middleware_path in settings.MIDDLEWARE_CLASSES:, referer:
http://summit.research.duhs.duke.edu/home/
[Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]   File
"/Library/Python/2.6/site-packages/django/utils/functional.py", line
276, in __getattr__, referer:
http://summit.research.duhs.duke.edu/home/
[Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]
self._setup(), referer: http://summit.research.duhs.duke.edu/home/
[Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]   File
"/Library/Python/2.6/site-packages/django/conf/__init__.py", line 40,
in _setup, referer: http://summit.research.duhs.duke.edu/home/
[Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]
self._wrapped = Settings(settings_module), referer:
http://summit.research.duhs.duke.edu/home/
[Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]   File
"/Library/Python/2.6/site-packages/django/conf/__init__.py", line 75,
in __init__, referer: http://summit.research.duhs.duke.edu/home/
[Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251] raise
ImportError("Could not import settings '%s' (Is it on sys.path? Does
it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)), referer:
http://summit.research.duhs.duke.edu/home/
[Thu Aug 26 14:50:50 2010] [error] [client 152.16.223.251]
ImportError: Could not import settings
'MolProbity_Compare_test.settings' (Is it on sys.path? Does it have
syntax errors?): No module named settings, referer:
http://summit.research.duhs.duke.edu/home/

I do have it on the sys.path in django.wsgi, here it is:

import os
import sys
sys.path.append('/Users/bradleyhintze/djcode')
sys.path.append('/Users/bradleyhintze/djcode/MolProbity_Compare_test')

os.environ['DJANGO_SETTINGS_MODULE'] = 'MolProbity_Compare_test.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Any ideas??
Thanks,
Bradley

On Thu, Aug 26, 2010 at 2:50 PM, Piotr Kilczuk  wrote:
> Hi,
>
> If you need to debug, set DEBUG to True, obviously...
>
> Second thing - what is your TEMPLATE_DIRS and TEMPLATE_LOADERS setting?
>
> Regards,
> Piotr
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>



-- 
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Template not found

2010-08-26 Thread Piotr Kilczuk
Hi,

If you need to debug, set DEBUG to True, obviously...

Second thing - what is your TEMPLATE_DIRS and TEMPLATE_LOADERS setting?

Regards,
Piotr

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: How to create navigation urls in an intelligent manner

2010-08-26 Thread bruno desthuilliers


On 26 août, 19:33, Steve Holden  wrote:

> As long as you acknowledge it as an ugly hack I suspect your reputation
> will survive ...
>

+1 !-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: How to create navigation urls in an intelligent manner

2010-08-26 Thread bruno desthuilliers
On 26 août, 17:30, Uwe Schuerkamp  wrote:
>
> Hello Bruno,
>
> thanks for your answer. I'm already using a custom context_processor
> (yay! ;-), so I'll follow that suggestion, too. I've tried wrapping my
> head around the process_view function, but I'm not exactly clear on
> how it works just yet.

Well, middleware.process_view is rather clearly documented. What do
you have problems with exactly ?

> So juet for laffs, I wrote my first custom
> template tag (another yay! ;-) and it does the job nicely:
>
(snip)
>
> register.simple_tag(pathfinder)

You cheated !-) You should have wrote a full blown tag with the parser
and node !-)


> so now in my navigation bar (actually it's just a table ), I can
> employ the following syntax:
>
>  add observation

{% url %} - or the python function it's based on, namely
urlresolvers.reverse - can build the proper url (reverse of the url
resolving part) given the appropriate arguments.


> Storing the data in the request object also seems like a great idea,

FWIW you could just pass the needed view function's arguments to the
context from within the view function itself, but that means you have
to do so in all your views. Using a middleware + templatetag might
prove more generic, even if more involved.

Duh... Just crossed my mind that you could also use a simple decorator
to store the relevant infos on the request object. And that's
something you can do in your urls (wrapping the view function in the
decorator within the urlpattern itself).

> I'll certainly look into that! Of course you're right about having to
> change two spots in case I ever decide to redesign my URL's, so a
> refactoring is in order!

Case of "first make it work" (ok, done) "then make it right" !-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: How to create navigation urls in an intelligent manner

2010-08-26 Thread bruno desthuilliers


On 26 août, 18:55, Aspontus  wrote:
> Hi.
> If I understand your problem correctly, you are looking for a way to
> capture different optional parameters from the url, to use them in
> further url construction.


> Why not use /country/de/district/hf/observation/add/ with entries

Why add unneeded parts to the url ?

> Then in your view just check which parameters were assigned via
> urlconf and pass them to the template to use in url construction.
>
> /{% if country %}country/{{ country }}/{% if district %}district/
> {{ district }}/{% endif %}{% endif %}observers/ranking

And why not just use the urlresolver's ability to build the correct
url based on the url's name and arguments ?



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



unset vary:cookie header with generic views / 13285

2010-08-26 Thread jfenton
I'm using 1.1.1.  I've got a bunch of legacy code written with date-
based generic views: django.views.generic.date_based . I think that
these views set a vary:Cookie header, which messes up my upstream
caching (see related ticket: http://code.djangoproject.com/ticket/13285
)

The vary:Cookie header isn't needed on these pages (the content
doesn't actually vary) but I'm not sure how to get rid of it. Trying
to set the vary header in the view only adds a different vary header,
i.e. doing this:

response = object_detail(request, 
response['Vary'] = "other junk"
return response

results in Vary being set to both "cookie" and "other junk".

Is there a straightforward way make the vary:cookie header go away
without breaking too many dishes? I can probably work around this at
the cache level, but it would be much cleaner not to...

Thanks for any suggestions.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Django 1.2 unittests: Second time through, things get weird

2010-08-26 Thread Elf_Sternberg
Is anyone seeing this?  I have this function at the top of my
unittest:

def create_user(name):
username = name.replace(' ', '').lower()
return User.objects.create_user(username, username + '@a.com',
'password')

And then (this is ultimately the code I derived to examine this
behavior):

class StartupTest(TestCase):
def setUp(self):
users = [create_user(name) for name in ["Fred", "Barney",
"Pebbles"]]

def test1(self):
print User.objects.all()

def test2(self):
print User.objects.all()

The output was:
[, , ]
[, , ]

Where did the usernames go in the second test?  My understanding of
the documentation is that the test driver is supposed to update the
database with every new test.  It doesn't seem to be working with
Users, and I'm not sure why.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: double for in the template

2010-08-26 Thread Tim Chase

On 08/26/10 11:10, Andrea Imparato wrote:

How can i scan the zipped list in the template page? If I do

{% for f in zip %}
{{ f }}
{% endfor %}

How can I access the second item in the index?


I think since version 1.0, you can just use standard 
tuple-unpacking syntax as detailed in the help[1]:


 
 {% for thing1, thing2 in zipped_item_passed_from_view %}
  {{ thing1 }}
  {{ thing2 }}
 {% endfor %}
 

in pre-1.0, I think you had to do

 
 {% for pair in zipped_item_passed_from_view %}
  {{ pair.0 }}
  {{ pair.1 }}
 {% endfor %}
 

to produce the same results.

-tkc


[1]
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#for




--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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: Template not found

2010-08-26 Thread Bradley Hintze
I forgot to include the error_log message:

[Thu Aug 26 17:41:27 2010] [error] [client 152.16.223.251] mod_wsgi
(pid=938): Exception occurred processing WSGI script
'/Users/bradleyhintze/djcode/MolProbity_Compare_test/apache/django.wsgi'.
[Thu Aug 26 17:41:27 2010] [error] [client 152.16.223.251] Traceback
(most recent call last):
[Thu Aug 26 17:41:27 2010] [error] [client 152.16.223.251]   File
"/Library/Python/2.6/site-packages/django/core/handlers/wsgi.py", line
241, in __call__
[Thu Aug 26 17:41:27 2010] [error] [client 152.16.223.251]
response = self.get_response(request)
[Thu Aug 26 17:41:27 2010] [error] [client 152.16.223.251]   File
"/Library/Python/2.6/site-packages/django/core/handlers/base.py", line
130, in get_response
[Thu Aug 26 17:41:27 2010] [error] [client 152.16.223.251] return
self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Thu Aug 26 17:41:27 2010] [error] [client 152.16.223.251]   File
"/Library/Python/2.6/site-packages/django/core/handlers/base.py", line
181, in handle_uncaught_exception
[Thu Aug 26 17:41:27 2010] [error] [client 152.16.223.251] return
callback(request, **param_dict)
[Thu Aug 26 17:41:27 2010] [error] [client 152.16.223.251]   File
"/Library/Python/2.6/site-packages/django/views/defaults.py", line 23,
in server_error
[Thu Aug 26 17:41:27 2010] [error] [client 152.16.223.251] t =
loader.get_template(template_name) # You need to create a 500.html
template.
[Thu Aug 26 17:41:27 2010] [error] [client 152.16.223.251]   File
"/Library/Python/2.6/site-packages/django/template/loader.py", line
157, in get_template
[Thu Aug 26 17:41:27 2010] [error] [client 152.16.223.251]
template, origin = find_template(template_name)
[Thu Aug 26 17:41:27 2010] [error] [client 152.16.223.251]   File
"/Library/Python/2.6/site-packages/django/template/loader.py", line
138, in find_template
[Thu Aug 26 17:41:27 2010] [error] [client 152.16.223.251] raise
TemplateDoesNotExist(name)
[Thu Aug 26 17:41:27 2010] [error] [client 152.16.223.251]
TemplateDoesNotExist: 500.html

On Thu, Aug 26, 2010 at 1:51 PM, Bradley Hintze
 wrote:
> I just moved my site onto apache and can get the 'home' site up which
> directs you to upload two files. When you submit the form you get a
> 500 Internal Server Error. The error log indicates that it can't find
> a 500 template, which I do have in my templates folder, which
> indicates to me that it may not be finding my other templates. I've
> checked my settings.py aand the template path is set correctly. Could
> there be something else going on?
>
> Thanks
>
> --
> Bradley J. Hintze
> Graduate Student
> Duke University
> School of Medicine
>



-- 
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 not found

2010-08-26 Thread Bradley Hintze
I just moved my site onto apache and can get the 'home' site up which
directs you to upload two files. When you submit the form you get a
500 Internal Server Error. The error log indicates that it can't find
a 500 template, which I do have in my templates folder, which
indicates to me that it may not be finding my other templates. I've
checked my settings.py aand the template path is set correctly. Could
there be something else going on?

Thanks

-- 
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Django + GAE, Changing Auth from userid/password to email/password

2010-08-26 Thread nobosh
Good to know I'm not the only one :) this forum seems to be a little
low with activity. Do you know of a better place to get Django
support / advice to help a newbie like myself along?

On Aug 25, 5:23 pm, James Saxon  wrote:
> I'm curious too about both questions.
>
> The only answer I got at one point was to capture email and not username on
> registration, and then set username to the email either in the view (which I
> believe you'd have to do before the registration signal gets sent???)
>
> I haven't implemented it yet.
>
> J
>
>
>
>
>
> On Wed, Aug 25, 2010 at 4:15 PM, nobosh  wrote:
> > Curious. Is the reason for the lack of reply due to no one using
> > google app engine GAE? Thanks
>
> > On Aug 24, 4:13 pm, nobosh  wrote:
> > > Hello, I just got my first app up:http://hellman470.appspot.com/
>
> > > I'm now trying to learn how to change the authentication model to
> > > support email/password, eliminating userids. I'm guessing this is a
> > > pretty common request? Does anyone know of any tutorials on how to
> > > accomplish this with Django-norel & app engine?
>
> > > 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-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> J A M E S   B E N N E T T   S A X O N  ja...@saxon.com
> Biz: 310.823.0545 - Cell: 310.722.2785

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: How to create navigation urls in an intelligent manner

2010-08-26 Thread Steve Holden
On 8/26/2010 11:30 AM, Uwe Schuerkamp wrote:
[...]
> It's probably not a good idea to have google groups archive this ugly
> hack with my name on it, but right now it seems to do the job nicely.
> Storing the data in the request object also seems like a great idea,
> I'll certainly look into that! Of course you're right about having to
> change two spots in case I ever decide to redesign my URL's, so a
> refactoring is in order!
> 
As long as you acknowledge it as an ugly hack I suspect your reputation
will survive ...

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: app engine and the non-rel stuff going on lately

2010-08-26 Thread Waldemar Kornewald
On Wed, Aug 25, 2010 at 5:08 PM, Russell Keith-Magee
 wrote:
> On Wed, Aug 25, 2010 at 10:21 PM, Waldemar Kornewald
>  wrote:
>> On Wed, Aug 25, 2010 at 2:36 PM, Russell Keith-Magee
>>  wrote:
>>> On Wed, Aug 25, 2010 at 4:00 PM, Waldemar Kornewald
>>>  wrote:
 As Alex' MongoDB backend demonstrates, all nonrel backends can
 retrieve the Query's filters.
>>>
>>> No - Alex's MongoDB backend demonstrates that the basic query
>>> requirements of MongoDB can be met.
>>
>> MongoDB is basically a superset of the other DBs. That's why we chose
>> it for GSoC. Cassandra can only do pk queries. So can MongoDB. App
>> Engine has filtering support. So has MongoDB. CouchDB supports
>> embedded documents. So does MongoDB.
>>
>> Of course some DBs have extra features like map/reduce or optimistic
>> locking, but those can't be mapped to Django's current ORM, anyway, so
>> they need platform-specific APIs.
>>
>> What you're expecting here (4 backends!) is a *lot*. Who will write
>> those backends? If that's what you want then the merge might have to
>> wait for Django 1.5 or later.
>
> I'm not saying that 4 *finished* backends is a pre-requisite for
> merging to trunk.
>
> What I'm saying is that 4 *proof of concept* backends would be enough
> to satisfy me that enough people have looked at the API we're
> proposing in sufficient detail to validate that it's sufficient for
> the task.
>
> The backends themselves aren't the important feature in all this. The
> important features are:
>  * the eyeballs that come along for the ride -- preferably, several
> pairs of them, with in-depth knowledge and experience in the various
> platforms we're looking to service with these changes; and
>  * the hard evidence that they've actually looked into the problem,
> not just glanced at the API and assumed that everything will work the
> way it needs to.

That might take a while. Writing a backend isn't trivial and few
people can afford to first write a backend and then implement their
project on top of it. I've know of two people interested in writing a
CouchDB and Cassandra backend, but as always "being interested"
doesn't mean that they'll find the time to do it. I'd still rather get
something out to attract the first users, then get the first
complaints about missing features, and suddenly those who complain
have incentive to help fix the issue. That's easier than waiting for
someone to deal with unofficial technology. At least then officially
ask for help on the Django blog and the Django discussion groups. Just
leaving Alex' work in some separate branch probably won't lead to the
desired results.

Bye,
Waldemar Kornewald

--
Django on App Engine, MongoDB, ...? Browser-side Python? It's open-source:
http://www.allbuttonspressed.com/blog/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-us...@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.



order of middleware

2010-08-26 Thread Alessandro Ronchi
Is this middleware classes correctly ordered for performance?
thanks in advance,

MIDDLEWARE_CLASSES = (


"django.middleware.common.CommonMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.locale.LocaleMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.middleware.doc.XViewMiddleware",
'django.middleware.gzip.GZipMiddleware',
'django.middleware.http.ConditionalGetMiddleware',
'pagination.middleware.PaginationMiddleware',
"django.contrib.flatpages.middleware.FlatpageFallbackMiddleware",
'django.contrib.redirects.middleware.RedirectFallbackMiddleware',


-- 
Alessandro Ronchi
http://www.soasi.com

Hobby & Giochi
http://hobbygiochi.com
http://www.facebook.com/hobbygiochi

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: How to create navigation urls in an intelligent manner

2010-08-26 Thread Aspontus
Hi.
If I understand your problem correctly, you are looking for a way to
capture different optional parameters from the url, to use them in
further url construction.
Why not use /country/de/district/hf/observation/add/ with entries in
urlconf like:
urlpatterns += patterns('some.app.views',
url(r'^observation/(?P\[a-z]+)/$', 'observations', name =
'observations_at_large'),
url(r'^country/(?P[a-z]+)/observation/(?P\[a-z]+)/
$', 'observations', name = 'observations_by_country'),
url(r'^country/(?P[a-z]+)/district/(?P[a-z]+)/
observation/(?P\[a-z]+)/$', 'observations', name =
'observations_by_district'),
)
and so on.
Then in your view just check which parameters were assigned via
urlconf and pass them to the template to use in url construction.

/{% if country %}country/{{ country }}/{% if district %}district/
{{ district }}/{% endif %}{% endif %}observers/ranking

Hope it helps.
Cheers.

On 25 Sie, 23:40, Uwe Schuerkamp  wrote:
> Hi folks,
>
> this posting sort of refers to my previous problem from last week as
> I'm still working on the birdwatcher's site. I cannot wrap my head
> around how to create intelligent navigation links from the current
> context or http request. For instance, if the user enters via the url
>
> /de/observers/ranking
>
> for a germany wide ranking display or even
>
> /de/hf/observers/ranking
>
> I need to find an elegant way to render the navigation links to the
> other site functions like "ranking by location"," add a new
> observation" and so on which should look like this, depending on the
> URL above:
>
> /de/observations/add
>
> to add an observation that will limit the list of locations to those
> in "de"  or maybe
>
> /de/hf/observations/add
>
> to add an observation for the hf district.
>
> I've played around with including
> django.core.context_processors.request in my processors list which
> results in the request.path variable being available, but I somehow
> refuse to believe that this problem hasn't been solved before in some
> clever, django-ish way.
>
> Thanks much in advance for any help or input,
>
> Uwe

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: how to turn off CSRF in django 1.2?

2010-08-26 Thread João Rodrigues
what about 'django.contrib.csrf.middleware.CsrfMiddleware' ?
http://docs.djangoproject.com/en/1.0/ref/contrib/csrf/#how-to-use-it

On 26 August 2010 16:33, Alan  wrote:
>
> Ops, sorry, but I don't have this line
> django.middleware.csrf.CsrfViewMiddleware, as I said, it's a project
> done in 1.0.2. and I want it to run on my django 1.2 but without any
> reference to Csrf, since the server where the portal is runs 1.0.2
> yet.
>
> On 26 Aug, 15:54, João Rodrigues  wrote:
> > go to your settings.py and comment out
> > django.middleware.csrf.CsrfViewMiddleware in your MIDDLEWARE_CLASSES
> >
> > On 26 August 2010 10:33, Alan  wrote:
> >
> >
> >
> > > Hi there,
> >
> > > I developed in a system that uses django 1.2, but the server is still
> > > django 1.0.2.
> >
> > > Upgrading for a moment is not possible. Unless someone knows a nice
> > > simple alternative, in order to keep my web portal compatible between
> > > 1.0.2 and 1.2, I would like to switch off CSRF on my developing
> > > computer.
> >
> > > How can I do this simply and easily?
> >
> > > Many thanks,
> >
> > > Alan
> >
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To post to this group, send email to django-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com > >  groups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Error working on many-to-many lookups

2010-08-26 Thread Christos Jonathan Hayward
Thanks.

On Thu, Aug 26, 2010 at 9:08 AM, Alex Robbins  wrote:

> Jonathan,
>
> Pretty much any time you use __exact='text', you could use
> ='text' instead. I think the orm treats those two cases the
> same. (It adds __exact if there isn't another lookup specified.
>
> Alex
>
> On Aug 25, 1:37 pm, Christos Jonathan Hayward
>  wrote:
> > I think I found the problem; for the record, I wanted text__exact, not
> > text__equals.
> >
> > On Wed, Aug 25, 2010 at 1:27 PM, Christos Jonathan Hayward <
> >
> >
> >
> > christos.jonathan.hayw...@gmail.com> wrote:
> > > I am trying to get a many-to-many tagging setup working, and I am
> getting
> > > an error which may or may not be an issue with many-to-many
> specifically. An
> > > Entity has a many-to-many field to Tag models; a Tag model only has one
> > > (declared) field, text, a TextField. My code:
> >
> > > tag = directory.models.Tag.objects.filter(text__equals = name)[0]
> >
> > > is getting:
> >
> > > Exception Value: Join on field 'text' not permitted. Did you misspell
> > > 'equals' for the lookup type?
> >
> > > Is text a reserved word here, or do I need to prepend the model name?
> I'm
> > > trying to get the first Tag, if any exists, where the text field equals
> a
> > > name I am testing against.
> >
> > > --
> > > [image: Christos Jonathan Hayward] 
> > > Christos Jonathan Hayward, an Orthodox Christian author.
> >
> > > Author Bio  • Books<
> http://CJSHayward.com/>
> > >  • *Email * • Facebook<
> http://www.facebook.com/christos.jonathan.hayward>
> > >  • LinkedIn  • Twitter<
> http://twitter.com/JonathansCorner>
> > >  • *Web * • What's New?<
> http://JonathansCorner.com/>
> > > I invite you to visit my "theology, literature, and other creative
> works"
> > > site.
> >
> > --
> > [image: Christos Jonathan Hayward] 
> > Christos Jonathan Hayward, an Orthodox Christian author.
> >
> > Author Bio  • Books<
> http://CJSHayward.com/>
> >  • *Email * •
> > Facebook
> >  • LinkedIn  •
> > Twitter
> >  • *Web * • What's
> > New?
> > I invite you to visit my "theology, literature, and other creative works"
> > site.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 
[image: Christos Jonathan Hayward] 
Christos Jonathan Hayward, an Orthodox Christian author.

Author Bio  • Books
 • *Email * •
Facebook
 • LinkedIn  •
Twitter
 • *Web * • What's
New?
I invite you to visit my "theology, literature, and other creative works"
site.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: permissions and ownership

2010-08-26 Thread Bradley Hintze
I got it :)

On Thu, Aug 26, 2010 at 12:35 PM, Bradley Hintze
 wrote:
> Not getting much of a respose BUT I did make progress. I had a major
> typo but now i get Internal Server Error
>
> error_log
>
> Thu Aug 26 12:30:25 2010] [error] [client 152.16.223.251]
> (13)Permission denied: mod_wsgi (pid=594, process='',
> application='summit.research.duhs.duke.edu|'): Call to fopen() failed
> for '/Users/bradleyhintze/djcode/MolProbity_Compare_test/apache/django.wsgi'.
> [Thu Aug 26 12:30:25 2010] [error] [client 152.16.223.251] mod_wsgi
> (pid=594): Exception occurred processing WSGI script
> '/Users/bradleyhintze/djcode/MolProbity_Compare_test/apache/django.wsgi'.
> [Thu Aug 26 12:30:25 2010] [error] [client 152.16.223.251] IOError:
> [Errno 13] Permission denied
>
> I hope someone can help me given this.
>
> Bradley
>
> On Thu, Aug 26, 2010 at 11:45 AM, Bradley Hintze
>  wrote:
>> Here are some more details.
>>
>> httpd.conf
>>
>> Alias /media/ /Users/bradleyhintze/django/MolProbity_Compare_test/media/
>>
>> 
>> Order deny,allow
>> Allow from all
>> 
>>
>> WSGIScriptAlias /
>> /Users/bradleyhintze/django/MolProbity_Compare_test/apache/django.wsgi
>>
>> 
>> Order deny,allow
>> Allow from all
>> 
>>
>> Error_log
>>
>> [Thu Aug 26 11:27:15 2010] [error] [client 152.16.223.251] client
>> denied by server configuration: /Users/bradleyhintze/django
>> [Thu Aug 26 11:27:16 2010] [error] [client 152.16.223.251] client
>> denied by server configuration: /Users/bradleyhintze/django
>> [Thu Aug 26 11:27:16 2010] [error] [client 152.16.223.251] client
>> denied by server configuration: /Users/bradleyhintze/django
>>
>> permission set for   /Users/bradleyhintze/django
>>
>> drwxr-x--x    7 _www           admin   238 Aug 26 09:19 djcode
>>
>> permission set for   /Users/bradleyhintze/django/MolProbity_Compae_test
>>
>> drwxrwx--x  22 _www           admin  748 Aug 26 09:35 MolProbity_Compare_test
>>
>>
>> Any ideas out there???
>>
>> On Thu, Aug 26, 2010 at 10:06 AM, Bradley Hintze
>>  wrote:
>>> Hi all,
>>>
>>> I am a newbie when it comes to Appach and mod_wsgi. I followed
>>> http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango and think
>>> I did everthing correctly. However, I am having permission issues. I
>>> have been exposed to but am no entirely comfortable with permissions
>>> and ownership. Here is what I get when I go to my site:
>>>
>>> Forbidden
>>>
>>> You don't have permission to access / on this server.
>>>
>>> I assume 'mysite' directory needs to be owned by www? What about the
>>> files and directories within 'mysite'? What about permissions?
>>>
>>> Any help and/direction will be greatly appreciated.
>>>
>>> Thanks,
>>>
>>> Bradley
>>>
>>
>>
>>
>> --
>> Bradley J. Hintze
>> Graduate Student
>> Duke University
>> School of Medicine
>> 801-712-8799
>>
>
>
>
> --
> Bradley J. Hintze
> Graduate Student
> Duke University
> School of Medicine
> 801-712-8799
>



-- 
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: permissions and ownership

2010-08-26 Thread Bradley Hintze
Not getting much of a respose BUT I did make progress. I had a major
typo but now i get Internal Server Error

error_log

Thu Aug 26 12:30:25 2010] [error] [client 152.16.223.251]
(13)Permission denied: mod_wsgi (pid=594, process='',
application='summit.research.duhs.duke.edu|'): Call to fopen() failed
for '/Users/bradleyhintze/djcode/MolProbity_Compare_test/apache/django.wsgi'.
[Thu Aug 26 12:30:25 2010] [error] [client 152.16.223.251] mod_wsgi
(pid=594): Exception occurred processing WSGI script
'/Users/bradleyhintze/djcode/MolProbity_Compare_test/apache/django.wsgi'.
[Thu Aug 26 12:30:25 2010] [error] [client 152.16.223.251] IOError:
[Errno 13] Permission denied

I hope someone can help me given this.

Bradley

On Thu, Aug 26, 2010 at 11:45 AM, Bradley Hintze
 wrote:
> Here are some more details.
>
> httpd.conf
>
> Alias /media/ /Users/bradleyhintze/django/MolProbity_Compare_test/media/
>
> 
> Order deny,allow
> Allow from all
> 
>
> WSGIScriptAlias /
> /Users/bradleyhintze/django/MolProbity_Compare_test/apache/django.wsgi
>
> 
> Order deny,allow
> Allow from all
> 
>
> Error_log
>
> [Thu Aug 26 11:27:15 2010] [error] [client 152.16.223.251] client
> denied by server configuration: /Users/bradleyhintze/django
> [Thu Aug 26 11:27:16 2010] [error] [client 152.16.223.251] client
> denied by server configuration: /Users/bradleyhintze/django
> [Thu Aug 26 11:27:16 2010] [error] [client 152.16.223.251] client
> denied by server configuration: /Users/bradleyhintze/django
>
> permission set for   /Users/bradleyhintze/django
>
> drwxr-x--x    7 _www           admin   238 Aug 26 09:19 djcode
>
> permission set for   /Users/bradleyhintze/django/MolProbity_Compae_test
>
> drwxrwx--x  22 _www           admin  748 Aug 26 09:35 MolProbity_Compare_test
>
>
> Any ideas out there???
>
> On Thu, Aug 26, 2010 at 10:06 AM, Bradley Hintze
>  wrote:
>> Hi all,
>>
>> I am a newbie when it comes to Appach and mod_wsgi. I followed
>> http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango and think
>> I did everthing correctly. However, I am having permission issues. I
>> have been exposed to but am no entirely comfortable with permissions
>> and ownership. Here is what I get when I go to my site:
>>
>> Forbidden
>>
>> You don't have permission to access / on this server.
>>
>> I assume 'mysite' directory needs to be owned by www? What about the
>> files and directories within 'mysite'? What about permissions?
>>
>> Any help and/direction will be greatly appreciated.
>>
>> Thanks,
>>
>> Bradley
>>
>
>
>
> --
> Bradley J. Hintze
> Graduate Student
> Duke University
> School of Medicine
> 801-712-8799
>



-- 
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Django Nav - is there anything similar that is actively maintained

2010-08-26 Thread Yo-Yo Ma
I haven't tried http://code.google.com/p/django-nav/ but I would
imagine that it probably has issues because it hasn't changed since
2007. Does anyone know if there is a very intuitive navigation helper
like this, but newer?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



save inline models when saving the father in admin

2010-08-26 Thread Alessandro Ronchi
I need to be sure that an inline model is saved every time I save its parent
class.
I need it because I want to save the last modified timestamp, and I don't
want to overwrite the parent save because I want to track only admin saves.

I cannot touch the parent class because it came from a library.

Is it possible?

-- 
Alessandro Ronchi
http://www.soasi.com

Hobby & Giochi
http://hobbygiochi.com
http://www.facebook.com/hobbygiochi

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: double for in the template

2010-08-26 Thread Tom Evans
On Thu, Aug 26, 2010 at 4:17 PM, Andrea Imparato
 wrote:
>
> I have 2 lists and I have to scan them "concurrently" with the same
> indexes at the same time. Something like:
>
> {% for lists %}
> first item from the first list
> first item from the second list
> {% endfor %}
>
> I thought about creating something like a map with 2 values in each
> index but I don't know how to use it in the template.
>
> Any advice?:)
>

Figure out the data structures you need in your view, pass them to
your template in the context.

For instance

import itertools

names = [ 'Bob', 'Jim', 'Jane' ]
ages = [ 24, 17, 37 ]

ctxt = RequestContext(request, {
  'names_and_ages': itertools.izip(names, ages),
  })

return render_to_response('my_template.html', context_instance=ctxt)

{% for tuple in names_and_ages %}
Hello {{ tuple.0 }}, you are {{ tuple.1 }} yrs old.
{% endfor %}

Cheers

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-us...@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: double for in the template

2010-08-26 Thread Tim Chase

On 08/26/10 10:17, Andrea Imparato wrote:


I have 2 lists and I have to scan them "concurrently" with the same
indexes at the same time. Something like:

{% for lists %}
first item from the first list
first item from the second list
{% endfor %}

I thought about creating something like a map with 2 values in each
index but I don't know how to use it in the template.


Just zip() them up in your view:


  def my_view(request, ...):
first = ...
second = ...
pairs = zip(first, second)
return render_to_response(... pairs ...)


-tkc



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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: permissions and ownership

2010-08-26 Thread Bradley Hintze
Here are some more details.

httpd.conf

Alias /media/ /Users/bradleyhintze/django/MolProbity_Compare_test/media/


Order deny,allow
Allow from all


WSGIScriptAlias /
/Users/bradleyhintze/django/MolProbity_Compare_test/apache/django.wsgi


Order deny,allow
Allow from all


Error_log

[Thu Aug 26 11:27:15 2010] [error] [client 152.16.223.251] client
denied by server configuration: /Users/bradleyhintze/django
[Thu Aug 26 11:27:16 2010] [error] [client 152.16.223.251] client
denied by server configuration: /Users/bradleyhintze/django
[Thu Aug 26 11:27:16 2010] [error] [client 152.16.223.251] client
denied by server configuration: /Users/bradleyhintze/django

permission set for   /Users/bradleyhintze/django

drwxr-x--x7 _www   admin   238 Aug 26 09:19 djcode

permission set for   /Users/bradleyhintze/django/MolProbity_Compae_test

drwxrwx--x  22 _www   admin  748 Aug 26 09:35 MolProbity_Compare_test


Any ideas out there???

On Thu, Aug 26, 2010 at 10:06 AM, Bradley Hintze
 wrote:
> Hi all,
>
> I am a newbie when it comes to Appach and mod_wsgi. I followed
> http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango and think
> I did everthing correctly. However, I am having permission issues. I
> have been exposed to but am no entirely comfortable with permissions
> and ownership. Here is what I get when I go to my site:
>
> Forbidden
>
> You don't have permission to access / on this server.
>
> I assume 'mysite' directory needs to be owned by www? What about the
> files and directories within 'mysite'? What about permissions?
>
> Any help and/direction will be greatly appreciated.
>
> Thanks,
>
> Bradley
>



-- 
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: how to turn off CSRF in django 1.2?

2010-08-26 Thread Alan
Ops, sorry, but I don't have this line
django.middleware.csrf.CsrfViewMiddleware, as I said, it's a project
done in 1.0.2. and I want it to run on my django 1.2 but without any
reference to Csrf, since the server where the portal is runs 1.0.2
yet.

On 26 Aug, 15:54, João Rodrigues  wrote:
> go to your settings.py and comment out
> django.middleware.csrf.CsrfViewMiddleware in your MIDDLEWARE_CLASSES
>
> On 26 August 2010 10:33, Alan  wrote:
>
>
>
> > Hi there,
>
> > I developed in a system that uses django 1.2, but the server is still
> > django 1.0.2.
>
> > Upgrading for a moment is not possible. Unless someone knows a nice
> > simple alternative, in order to keep my web portal compatible between
> > 1.0.2 and 1.2, I would like to switch off CSRF on my developing
> > computer.
>
> > How can I do this simply and easily?
>
> > Many thanks,
>
> > Alan
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: How to create navigation urls in an intelligent manner

2010-08-26 Thread Uwe Schuerkamp
On 26 Aug., 17:08, bruno desthuilliers 
wrote:
> > So would it be possible to access the request.path property from
> > within a custom template tag?
>
> Of course, as long as
> 1/ you pass it explicitely or
> 2/ the request.path is available in the context passed to the tag's
> render() method.
>
> You may want to have a look at context_processors and ContextRequest
> in the fine manual.

Hello Bruno,

thanks for your answer. I'm already using a custom context_processor
(yay! ;-), so I'll follow that suggestion, too. I've tried wrapping my
head around the process_view function, but I'm not exactly clear on
how it works just yet. So juet for laffs, I wrote my first custom
template tag (another yay! ;-) and it does the job nicely:

# snip snip
from django import template
import re
area_pattern=re.compile(r"/(?P[a-z]{2})/(?P[a-
z]{2,3})/")
country_pattern=re.compile(r"/(?P[a-z]{2})/")
register = template.Library()
def pathfinder(request):
result = area_pattern.match(request.path)
if result:
return result.group()[:-1]

result = country_pattern.match(request.path)
if result:
return result.group()[:-1]

return ""

register.simple_tag(pathfinder)

### snip snip

so now in my navigation bar (actually it's just a table ), I can
employ the following syntax:

 add observation

and the URL will change according to the path via which I'm accessing
the view.

It's probably not a good idea to have google groups archive this ugly
hack with my name on it, but right now it seems to do the job nicely.
Storing the data in the request object also seems like a great idea,
I'll certainly look into that! Of course you're right about having to
change two spots in case I ever decide to redesign my URL's, so a
refactoring is in order!

All the best,

Uwe

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: how to turn off CSRF in django 1.2?

2010-08-26 Thread Alan
Thanks João, you got exactly what I need.


On 26 Aug, 15:54, João Rodrigues  wrote:
> go to your settings.py and comment out
> django.middleware.csrf.CsrfViewMiddleware in your MIDDLEWARE_CLASSES
>
> On 26 August 2010 10:33, Alan  wrote:
>
>
>
> > Hi there,
>
> > I developed in a system that uses django 1.2, but the server is still
> > django 1.0.2.
>
> > Upgrading for a moment is not possible. Unless someone knows a nice
> > simple alternative, in order to keep my web portal compatible between
> > 1.0.2 and 1.2, I would like to switch off CSRF on my developing
> > computer.
>
> > How can I do this simply and easily?
>
> > Many thanks,
>
> > Alan
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: double for in the template

2010-08-26 Thread Andrea Imparato

I have 2 lists and I have to scan them "concurrently" with the same
indexes at the same time. Something like:

{% for lists %}
first item from the first list
first item from the second list
{% endfor %}

I thought about creating something like a map with 2 values in each
index but I don't know how to use it in the template.

Any advice?:)


On 26 Ago, 00:56, bruno desthuilliers 
wrote:
> On 25 août, 18:30, Andrea Imparato  wrote:
>
> > Hello all,
>
> > is possible to do in templates double for like in C:
>
> > for(int i = 0, int j = 0; i<0 && j<0;i++,j++) ?
>
> What's your use case exactly ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: semicolon separated parameter gets inaccessible in QueryDict

2010-08-26 Thread bruno desthuilliers


On 26 août, 15:28, k4rlchen  wrote:
> Thank you Bruno,
>
> it didn't work "copy 'n paste'

Code typed directly in googlegroups and working right OOTB ? Now
_this_ would have been a very unexpected accident !-)

> but lead me to the solution!

Fine.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: How to create navigation urls in an intelligent manner

2010-08-26 Thread bruno desthuilliers
On 26 août, 16:43, Uwe Schuerkamp  wrote:
> On 26 Aug., 15:56, joconnell  wrote:
>
> > Hi Uwe,
>
> > You might be able to leverage the 'url' template tag which comes with
> > django?
>
> Hi John & Bruno,
>
> thanks for your answer.
>
> I've looked at the url tag, but sadly it doesn't help me with
> customizing the url's in the left navigation. The idea is that those
> url's should change according to the URL of the page, so the
> add_observation view (which accepts those parrameters you mention,
> btw ;-) can change from
>
> /add_observation
> /de/add_observation
> /de/hf/add_observation
>
> and so should all others like location_ranking (a ranking of locations
> where birds have been observed), observer_ranking (rankings of
> observers and so on.
>
> I think right now it would be easiest to add a custom tag called
> "pathfinder" someting similar which does the following:
>
> - check if request.path matches a /??/???/ pattern (/country_code/
> aread_code/)
> - check if it matches /??/ (just country_code)
> - or none of the above, and according to what matched, return a simple
> string I can prepend to the {% url club300.views.add_observation %}
> for instance.

Might work, but all this will somehow duplicate the urlpatterns
declaration AND the urlresolvers's job. Duplicate work, AND duplicate
maintainance when you redesign your urls...

middleware.process_view is called with the request (of course), but
also the view function and the view args and kwargs. IOW, by that
time, you get the result of all the above parsing done for free -
aint' that nice ?-)

Then it's only a matter of storing the relevant args somewhere - the
one you need to build the correct urls - so you can access them in the
template and use them to build the correct related urls. The request
object comes to mind here - usually your best friend when you need to
make soemthing available to views, templates, etc.


> So would it be possible to access the request.path property from
> within a custom template tag?

Of course, as long as
1/ you pass it explicitely or
2/ the request.path is available in the context passed to the tag's
render() method.

You may want to have a look at context_processors and ContextRequest
in the fine manual.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: how to turn off CSRF in django 1.2?

2010-08-26 Thread João Rodrigues
go to your settings.py and comment out
django.middleware.csrf.CsrfViewMiddleware in your MIDDLEWARE_CLASSES

On 26 August 2010 10:33, Alan  wrote:

> Hi there,
>
> I developed in a system that uses django 1.2, but the server is still
> django 1.0.2.
>
> Upgrading for a moment is not possible. Unless someone knows a nice
> simple alternative, in order to keep my web portal compatible between
> 1.0.2 and 1.2, I would like to switch off CSRF on my developing
> computer.
>
> How can I do this simply and easily?
>
> Many thanks,
>
> Alan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: How to create navigation urls in an intelligent manner

2010-08-26 Thread Uwe Schuerkamp
On 26 Aug., 15:56, joconnell  wrote:
> Hi Uwe,
>
> You might be able to leverage the 'url' template tag which comes with
> django?
>

Hi John & Bruno,

thanks for your answer.

I've looked at the url tag, but sadly it doesn't help me with
customizing the url's in the left navigation. The idea is that those
url's should change according to the URL of the page, so the
add_observation view (which accepts those parrameters you mention,
btw ;-) can change from

/add_observation
/de/add_observation
/de/hf/add_observation

and so should all others like location_ranking (a ranking of locations
where birds have been observed), observer_ranking (rankings of
observers and so on.

I think right now it would be easiest to add a custom tag called
"pathfinder" someting similar which does the following:

- check if request.path matches a /??/???/ pattern (/country_code/
aread_code/)
- check if it matches /??/ (just country_code)
- or none of the above, and according to what matched, return a simple
string I can prepend to the {% url club300.views.add_observation %}
for instance.

The URL pattern won't exceed two levels of "area designation" as I'll
be using iso country codes and 3-letter codes for the areas in a
country (german car number plates come in handy as they also represent
the districts I'm interesting in ranking).

So would it be possible to access the request.path property from
within a custom template tag?

All the best & thanks again for your guidance,

Uwe

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Error working on many-to-many lookups

2010-08-26 Thread Alex Robbins
Jonathan,

Pretty much any time you use __exact='text', you could use
='text' instead. I think the orm treats those two cases the
same. (It adds __exact if there isn't another lookup specified.

Alex

On Aug 25, 1:37 pm, Christos Jonathan Hayward
 wrote:
> I think I found the problem; for the record, I wanted text__exact, not
> text__equals.
>
> On Wed, Aug 25, 2010 at 1:27 PM, Christos Jonathan Hayward <
>
>
>
> christos.jonathan.hayw...@gmail.com> wrote:
> > I am trying to get a many-to-many tagging setup working, and I am getting
> > an error which may or may not be an issue with many-to-many specifically. An
> > Entity has a many-to-many field to Tag models; a Tag model only has one
> > (declared) field, text, a TextField. My code:
>
> > tag = directory.models.Tag.objects.filter(text__equals = name)[0]
>
> > is getting:
>
> > Exception Value: Join on field 'text' not permitted. Did you misspell
> > 'equals' for the lookup type?
>
> > Is text a reserved word here, or do I need to prepend the model name? I'm
> > trying to get the first Tag, if any exists, where the text field equals a
> > name I am testing against.
>
> > --
> > [image: Christos Jonathan Hayward] 
> > Christos Jonathan Hayward, an Orthodox Christian author.
>
> > Author Bio  • 
> > Books
> >  • *Email * • 
> > Facebook
> >  • LinkedIn  • 
> > Twitter
> >  • *Web * • What's 
> > New?
> > I invite you to visit my "theology, literature, and other creative works"
> > site.
>
> --
> [image: Christos Jonathan Hayward] 
> Christos Jonathan Hayward, an Orthodox Christian author.
>
> Author Bio  • 
> Books
>  • *Email * •
> Facebook
>  • LinkedIn  •
> Twitter
>  • *Web * • What's
> New?
> I invite you to visit my "theology, literature, and other creative works"
> site.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



permissions and ownership

2010-08-26 Thread Bradley Hintze
Hi all,

I am a newbie when it comes to Appach and mod_wsgi. I followed
http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango and think
I did everthing correctly. However, I am having permission issues. I
have been exposed to but am no entirely comfortable with permissions
and ownership. Here is what I get when I go to my site:

Forbidden

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

I assume 'mysite' directory needs to be owned by www? What about the
files and directories within 'mysite'? What about permissions?

Any help and/direction will be greatly appreciated.

Thanks,

Bradley

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: How to create navigation urls in an intelligent manner

2010-08-26 Thread joconnell
Hi Uwe,

You might be able to leverage the 'url' template tag which comes with
django?

e.g. For the 'add observation' example above, if you pass in the
country code as part of the context you return in your view(s), or
leverage middleware to automatically add it to every response based on
the request path, then something like the below might mitigate the
need to write a custom template tag?

# Name the url in urls.py
# Assuming your view is called 'add_observation' and it accepts a
parameter 'country_code'

url(r'/(?P[a-zA-Z]{2})/observations/add/$',
'add_observation', \
name='add_observation'),

You can then use the 'url' template tag to reference the view

 Add
Observation 

This is an interesting problem, please do let us know how you solve it
in the end :)

John

p.s. I haven't tested the above, the regex might be dodgy ;)


On Aug 26, 1:16 pm, bruno desthuilliers
 wrote:
> On 26 août, 13:27, Uwe Schuerkamp  wrote:
>
> > Thanks Bruno,
>
> > I'll look into the custom template tags you mentioned.
>
> Well, the way I see it you should first investigate the middleware
> part - that's probably where you'll get the most relevant infos. The
> templatetag part was mostly here to help with formatting etc - IOW to
> factor out template logic.
>
> > I had no idea
> > when I started out with this project that I'd be knee deep into
> > advanced django after a couple of weeks ;-)
>
> I wouldn't label custom templatetags as "advanced" - it's very
> straightforward, basic stuff - at least once you've written a couple
> ones !-) More seriously, I fail to see how one could write a
> maintainable non-trivial django project without custom templatetags,
> so this is something you have to learn anyway, and there's really no
> magic involved.
>
> > BTW, can you recommend the "pro django" book?
>
> Never heard of it, sorry... From the TOC and reviews it looks like it
> might be an interesting reading if you don't already master advanced
> Python stuff like metaclasses and the descriptor protocol, but that's
> all I can say without actually reading the book.
>
> @++
> B.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Error configuring Django to run customized comments framework

2010-08-26 Thread Groady
I'm having an issue with setting up a Django website which uses the
Django comments framework on my server. The site runs fine when run
locally (using manage.py runserver) but when pushed live I'm getting
the error:

ImproperlyConfigured at /
The COMMENTS_APP setting refers to a non-existing package.

My server is an apache/mod_wsgi setup. My site contains 2 applications
called weblog and weblog_comments. I've appended my site's path and
it's parent directories to my django.wsgi file as per the guide
located here: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
I can comment out the COMMENTS_APP line from my settings.py and the
site runs fine so I know site is on the python path correctly.

My custom comment model is called WeblogComment and extends the
default Comment model. It only extends this to add methods to the
model, it doesn't change Comment model fields thus It has proxy=True
in it's Meta class.

Any advice would be great.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: semicolon separated parameter gets inaccessible in QueryDict

2010-08-26 Thread k4rlchen

Thank you Bruno,

it didn't work "copy 'n paste' but lead me to the solution!



-- 
View this message in context: 
http://old.nabble.com/semicolon-separated-parameter-gets-inaccessible-in-QueryDict-tp29539791p29542413.html
Sent from the django-users mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Color in Console

2010-08-26 Thread Ramiro Morales
On Thu, Aug 26, 2010 at 3:28 AM, gasphynx  wrote:
> http://docs.djangoproject.com/en/dev/ref/django-admin/#syntax-coloring
>
> I'm using Python's logging module to output to the console with ./
> manage.py runserver. Is there anyway to colorize this output? I tried
> explicitly setting colors for notice and error but my logging output
> is colorless.

There is nothing ready to use in Django for you specific needs. But I think
you can create something by yourself with the help of any of:

* The console output coloring code already included with Django.
* Some of the code proposed in discussions you find when googling
  color logging console, e.g. [1]
* The integration-with-logging facilities provided by Fabulous[2].

HTH

-- 
Ramiro Morales  |  http://rmorales.net

1. 
http://stackoverflow.com/questions/384076/how-can-i-make-the-python-logging-output-to-be-colored
2. http://lobstertech.com/fabulous.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-us...@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: How to create navigation urls in an intelligent manner

2010-08-26 Thread bruno desthuilliers


On 26 août, 13:27, Uwe Schuerkamp  wrote:
> Thanks Bruno,
>
> I'll look into the custom template tags you mentioned.

Well, the way I see it you should first investigate the middleware
part - that's probably where you'll get the most relevant infos. The
templatetag part was mostly here to help with formatting etc - IOW to
factor out template logic.

> I had no idea
> when I started out with this project that I'd be knee deep into
> advanced django after a couple of weeks ;-)

I wouldn't label custom templatetags as "advanced" - it's very
straightforward, basic stuff - at least once you've written a couple
ones !-) More seriously, I fail to see how one could write a
maintainable non-trivial django project without custom templatetags,
so this is something you have to learn anyway, and there's really no
magic involved.

> BTW, can you recommend the "pro django" book?

Never heard of it, sorry... From the TOC and reviews it looks like it
might be an interesting reading if you don't already master advanced
Python stuff like metaclasses and the descriptor protocol, but that's
all I can say without actually reading the book.


@++
B.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: static files + index.html dynamic usign django

2010-08-26 Thread malo29
Thank you, problem solved.

On 24 Ago, 14:33, Piotr Kilczuk  wrote:
> Hi,
>
> > Is it possible to mix static anddynamiccontent in the same directory
> > using django?
>
> Yes :) At least as far as I understand your goal.
>
> Basic urlconf stuff - matter of order.
>
> P.S. Don't think about URLs as directories.
>
> Regards,
> Piotr

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: semicolon separated parameter gets inaccessible in QueryDict

2010-08-26 Thread bruno desthuilliers
On 26 août, 12:01, k4rlchen  wrote:
> Thanks Łukasz,
>
> unfortunatly, the application is in use for 10 years and delivered to > 300
> mobile computers.
> A change of application would mean a big scale operation.
>
> I was not 100% correct describing the matter. The values are not passed via
> url but in a form input field.

If the form's method is GET (which seems to be the case according to
your first post), the values ARE actually passed via the url. And
there's indeed a W3C recommandation that ';' should be treated as
equivalent to '&' in querystring, which doesn't contradict the URIs
rfc that clearly states that ';' is a reserved character in a query
string.

FWIW, if the form's method is POST, the values are encoded in the POST
request's body. Since the default encoding is application/x-www-form-
urlencoded (pretty self-explanatory I think). The alternative is
multipart/form-data, but I don't know if this change much here...

Also and FWIW, the CorrectWay(tm) to pass multiple values for a same
name in a query string is to use as many 'name=XXX' as values, ie : "/
foo?bar=1&bar=2&bar=3".

If I understand correctly, the client app is not a generic browser but
your own specific mobile app ? if yes, I strongly suggest you fix it
ASAP (next release or so), and warn your customers that they'll have
to upgrade sooner or later.

But anyway...

> The old cgi uses cgi.FieldStorage() , which works with this.

Django uses either cgi.parse_qsl or mod_python.utils.parse_qsl,
depending on mod_python's availability.

>>> from cgi import parse_qsl
>>> parse_qsl("asdf=1;2;3;4;")
[('asdf', '1')]
>>> parse_qsl("asdf=1;2;3;4;", True)
[('asdf', '1'), ('2', ''), ('3', ''), ('4', '')]
>>> parse_qsl("asdf=1;2;3;4;", True, True)
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.6/cgi.py", line 192, in parse_qsl
return urlparse.parse_qsl(qs, keep_blank_values, strict_parsing)
  File "/usr/lib/python2.6/urlparse.py", line 343, in parse_qsl
raise ValueError, "bad query field: %r" % (name_value,)
ValueError: bad query field: '2'
>>>


> Any posibility to use a regular expression to replace the semicolon before
> the QueryDict is created?.

Depending on how your django application is deployed, you may try&use
a rewrite rule (Apache) - not tested - or a WSGI Middeleware (not
tested neither). But all you can do this way (with a simple,
maintainable regexp at least) is to replace a reserved char by a non-
reserved one, insetad of turning a badly written querystring into a
well-formed one.

My own solution would be to just monkeypatch
django.http.QueryDict.__init__ to do the replacement before the
querystring is parsed, ie:

# myapp.models.py
# NB : put this in a models files to make sure it's executed as soon
as possible

from django import http
from urllib import urlencode

def _fix_qs(qs):
   query = list()
   parts = qs.split('&')
   for part in parts:
  try:
  k, v = part.split("=")
  except ValueError:
  parts.append((part, ""))
  else:
  if ";" in v:
  args = v.split(";")
  for arg in args:
  query.append((k, arg))
  else:
  query.append((k, v))
return urlencode(query)


def _patch_qd_init(init_func):
   def _patched_init(self, query_string, mutable=False,
encoding=None):
 if ";" in query_string:
 query_string = _fix_qs(query_string)
 init_func(self, query_string, mutable, encoding)
   return _patched_init

http.QueryDict.__dict__['__init__'] =
_patch_qd_init(http.QueryDict.__dict__['__init__'])


NB : not tested neither, so very probably broken one way or another -
but at least you get the idea.

HTH
B.


HTH


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: How to create navigation urls in an intelligent manner

2010-08-26 Thread Uwe Schuerkamp
Thanks Bruno,

I'll look into the custom template tags you mentioned. I had no idea
when I started out with this project that I'd be knee deep into
advanced django after a couple of weeks ;-)

BTW, can you recommend the "pro django" book?

All the best & thanks again for your help,
Uwe

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: how to turn off CSRF in django 1.2?

2010-08-26 Thread Mathieu Leduc-Hamel
If I was you,

I would not install django directly on the system. It's not generally
a good practice.

The best thing you might do is to use of these two methods:

1. virtualenv 
(http://tumblr.intranation.com/post/766290325/python-virtualenv-quickstart-django)

2. buildout (http://jacobian.org/writing/django-apps-with-buildout/)

As you wish these two methods worked pretty well, on my side i like
buildout cause it's easier to maintain.

On Thu, Aug 26, 2010 at 1:07 PM, Sven Bröckling  wrote:
> Hi Alan,
>
>> I developed in a system that uses django 1.2, but the server is still
>> django 1.0.2.
>> Upgrading for a moment is not possible. Unless someone knows a nice
>> simple alternative, in order to keep my web portal compatible between
>> 1.0.2 and 1.2, I would like to switch off CSRF on my developing
>> computer.
>> How can I do this simply and easily?
> I have one project which has several issues with django 1.2, and so i
> use 1.1 for that, 1.2 for other projects.
>
> I have two versions of Django in my home dir, both svn checkouts. I need
> only one version at a time, so i wrote two quick and dirty shell aliases
> to switch the django version.
>
> [s...@troy sven] which django1.1
> django1.1: aliased to sudo rm -f
> /usr/lib/python2.6/dist-packages/django; sudo ln -s
> /home/sven/projects/programming/python/django/django-1.1/django
> /usr/lib/python2.6/dist-packages/
>
> [s...@troy sven] which django1.2
> django1.2: aliased to sudo rm -f
> /usr/lib/python2.6/dist-packages/django; sudo ln -s
> /home/sven/projects/programming/python/django/django-trunk/django
> /usr/lib/python2.6/dist-packages/
>
> Sven
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>



-- 
Mathieu Leduc-Hamel

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: how to turn off CSRF in django 1.2?

2010-08-26 Thread Sven Bröckling
Hi Alan,

> I developed in a system that uses django 1.2, but the server is still
> django 1.0.2.
> Upgrading for a moment is not possible. Unless someone knows a nice
> simple alternative, in order to keep my web portal compatible between
> 1.0.2 and 1.2, I would like to switch off CSRF on my developing
> computer.
> How can I do this simply and easily?
I have one project which has several issues with django 1.2, and so i
use 1.1 for that, 1.2 for other projects.

I have two versions of Django in my home dir, both svn checkouts. I need
only one version at a time, so i wrote two quick and dirty shell aliases
to switch the django version.

[s...@troy sven] which django1.1
django1.1: aliased to sudo rm -f
/usr/lib/python2.6/dist-packages/django; sudo ln -s
/home/sven/projects/programming/python/django/django-1.1/django
/usr/lib/python2.6/dist-packages/

[s...@troy sven] which django1.2
django1.2: aliased to sudo rm -f
/usr/lib/python2.6/dist-packages/django; sudo ln -s
/home/sven/projects/programming/python/django/django-trunk/django
/usr/lib/python2.6/dist-packages/

Sven

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Color in Console

2010-08-26 Thread gasphynx
http://docs.djangoproject.com/en/dev/ref/django-admin/#syntax-coloring

I'm using Python's logging module to output to the console with ./
manage.py runserver. Is there anyway to colorize this output? I tried
explicitly setting colors for notice and error but my logging output
is colorless.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



ModelMultipleChoiceField queryset argument does not limit widget choices

2010-08-26 Thread The Boss
The documentation made this seem trivial but I must be missing
something.
I have an order form with a many to many field to ArchivedFiles. I
want to just show file choices that start with the order number given
to the form at instantiation.
I almost works.

class OrderForm(ModelForm):
def __init__(self,*args,**kw):
self.ordernumber = '%06d'%kw.pop('ordernumber',0)
print 'myquery',self.myquery()
 
self.__class__.associated_files=ModelMultipleChoiceField(queryset=self.myquery(),required=False)
ModelForm.__init__(self,*args,**kw)

def myquery(self):
 
A=ArchivedFile.objects.filter(name__startswith=str(self.ordernumber))
return A

but now if i run it:

>>> F=OrderForm(ordernumber=02)
myquery []
>>> m=F.fields['associated_files']
>>> m._queryset
[, ,
, ,
]

I give a queryset that clearly has one item but the formfield ends up
with all 5 of the files.
what goes wrong with the queryset keyword system?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: semicolon separated parameter gets inaccessible in QueryDict

2010-08-26 Thread Tom Evans
On Thu, Aug 26, 2010 at 11:01 AM, k4rlchen  wrote:
>
> Thanks Łukasz,
>
> unfortunatly, the application is in use for 10 years and delivered to > 300
> mobile computers.
> A change of application would mean a big scale operation.
>
> I was not 100% correct describing the matter. The values are not passed via
> url but in a form input field.
> The old cgi uses cgi.FieldStorage() , which works with this.
>
> Any posibility to use a regular expression to replace the semicolon before
> the QueryDict is created?.
>
> Cheers
> Stefan

No, you wouldn't be able to do that.

However there is nothing to stop you from creating some middleware or
view decorator that re-parses your raw data (from
request.META['QUERY_STRING'] for GET, from request.raw_post_data for
POST requests) and replaces/updates request.POST/request.GET.

Cheers

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-us...@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: semicolon separated parameter gets inaccessible in QueryDict

2010-08-26 Thread k4rlchen

Thanks Łukasz,

unfortunatly, the application is in use for 10 years and delivered to > 300
mobile computers.
A change of application would mean a big scale operation.

I was not 100% correct describing the matter. The values are not passed via
url but in a form input field.
The old cgi uses cgi.FieldStorage() , which works with this.

Any posibility to use a regular expression to replace the semicolon before
the QueryDict is created?.

Cheers
Stefan
-- 
View this message in context: 
http://old.nabble.com/semicolon-separated-parameter-gets-inaccessible-in-QueryDict-tp29539791p29540697.html
Sent from the django-users mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



how to turn off CSRF in django 1.2?

2010-08-26 Thread Alan
Hi there,

I developed in a system that uses django 1.2, but the server is still
django 1.0.2.

Upgrading for a moment is not possible. Unless someone knows a nice
simple alternative, in order to keep my web portal compatible between
1.0.2 and 1.2, I would like to switch off CSRF on my developing
computer.

How can I do this simply and easily?

Many thanks,

Alan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: semicolon separated parameter gets inaccessible in QueryDict

2010-08-26 Thread Łukasz Rekucki
Hi,

On 26 August 2010 09:56, k4rlchen  wrote:
> GET /order?asdf=1;2;3;4;

In terms of HTTP this query is the same as: GET /order?asdf=1&2&3&4&
and Django parses quesry strings accordingly to the HTTP
specification. This is consitent with cgi.parse_qs(), so you should
probably fix your application.

-- 
Łukasz Rekucki

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: How to create navigation urls in an intelligent manner

2010-08-26 Thread bruno desthuilliers
On 25 août, 23:40, Uwe Schuerkamp  wrote:
> Hi folks,
>
> this posting sort of refers to my previous problem from last week as
> I'm still working on the birdwatcher's site. I cannot wrap my head
> around how to create intelligent navigation links from the current
> context or http request.

(snip practical example)

> I've played around with including
> django.core.context_processors.request in my processors list which
> results in the request.path variable being available, but I somehow
> refuse to believe that this problem hasn't been solved before in some
> clever, django-ish way.

The problem is that there's no one-size-fits-all solution here - it's
a reoccurring problem indeed, but it's somehow very application /
project specific too. But anyway : there's just too much logic
involved to implement this in the template itself, and that's
certainly not something you want to manually handle in each and every
view. I don't know enough about your project to provide a working OOTB
solution, but given your example use case, I'd probably try to handle
this in a middleware - process_view() seems like the right place -,
with possibly some custom templatetag involved too.

http://docs.djangoproject.com/en/1.2/topics/http/middleware/#writing-your-own-middleware

HTH

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



semicolon separated parameter gets inaccessible in QueryDict

2010-08-26 Thread k4rlchen

I am migrating an old CGI to a django application. Some of the values passed
to the interface are semicolon separated. 

The requests come in like this:
[26/Aug/2010 02:49:03] "GET /order?asdf=1;2;3;4; HTTP/1.1" 200 71

Django's QueryDict (request.POST) looks like this:


When I do request.POST.getlists('asdf') I only get the first of the values:
[u'1']

What can I do? 

Stefan
-- 
View this message in context: 
http://old.nabble.com/semicolon-separated-parameter-gets-inaccessible-in-QueryDict-tp29539791p29539791.html
Sent from the django-users mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Building a generic list template - where should I start?

2010-08-26 Thread bruno desthuilliers


On 26 août, 04:00, Yo-Yo Ma  wrote:
> I'm wanting to build out a list template that can display any list of
> objects in this manor (pseudo code:
>
> {% for thing in things %}
> 
>     {{ thing.foo }}
>     {{ thing.bar }}
>     {{ thing.spam }}
>     {{ thing.eggs }}
> 
> {% endfor %}
>
> The problem is, of course, that I want to list more than just "things"
> using the same template. Things have "foo", "bar", "spam", and "eggs".
> "Widgets" might only have "snafu", and "peanut_butter" attributes.

Well, the problem is not really with the template code - mostly
trivial FWIW, but mostly : how do you decide which attributes you want
to display for a given object ? Once you have this sorted, you can
preprocess the objects list in the view code as Steve suggested:

# views.py
def view(request, ...):
   objects = however_you_get_your_objects()
   attributes = however_you_get_the_attribute_names()
   data = []
   for obj in objects:
   data.append(tuple(getattr(obj, attr) for attr in attributes))
   context = {
  attributes=attributes,
  data=data
}
   return render_to_response("template.html", context)

# template.html

  
  {% for name in attributes %}
{{ name }}
  
  {% endfor %}
  {% for row in data %}
  
 {% for field in row %}
  {{ field }}
 {% endfor %}
  
  {% endfor %}


This of course imply that your objects list is homomgenous...


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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, mod_wsgi, windows: config hints?

2010-08-26 Thread Reinout van Rees

On 08/26/2010 05:01 AM, Sam Lai wrote:

On 25 August 2010 20:09, Reinout van Rees  wrote:


I normally deploy everything on linux, but a customer requires windows.  I
have a working setup with apache and mod_wsgi, but I wonder about the
efficiency.

I see hints like "mod_wsgi, daemon mode" including "but that doesn't work on
windows".  Similarly with other apache settings like the worker you have to
chose.  The best one isn't available on windows.

=>  Could someone give me a pointer on how to best set up apache and
mod_wsgi+django on windows?  My google skills seem to let me down a bit.
  I'm probably overlooking something obvious.


I'd stick with IIS on Windows - much better supported than Apache, not
to mention easier to manage on a Windows box, particularly if you only
have Windows sysadmins.


I doubt one of those windows-is-easier-for-us sysadmins is willing to 
give me a working IIS configuration :-)  So I'll have to figure that out 
myself.



Here's a pretty good overview of your options -
http://jasonmbaker.wordpress.com/2009/06/04/windows-for-python-programmers-iis/


Good link.  That's pretty convincing that apache might really not be a 
good idea.  Bit of a shame as I'm suddenly down to 0 knowledge on how to 
set up a webserver :-)



ISAPI-WSGI would be the best option.
http://code.google.com/p/isapi-wsgi/


I'll look at that, thanks.


Reinout


--
Reinout van Rees - rein...@vanrees.org - http://reinout.vanrees.org
Collega's gezocht!
Django/python vacature in Utrecht: http://tinyurl.com/35v34f9

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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.