Re: serializes a object error with serializers.serialize("xml",query,ensure_ascii=False)

2008-05-20 Thread ERic ZoU

I figure it out what's going on. I define ForeignKey in the models.

data =  serializers.serialize('xml', query,
ensure_ascii=False,fields=('content'))
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



serializes a object error with serializers.serialize("xml",query,ensure_ascii=False)

2008-05-20 Thread ERic ZoU

Hi,
When I try to serializes a object with the function below:

def left(request):
 query = Talk.objects.all()
 data = serializers.serialize("xml",query,ensure_ascii=False)
 return HttpResponse(data)

Always give me this kind of error message.But if I just simply return
HttpResponse(query), it all works.
-
DoesNotExist at /Talk/Left
Talk matching query does not exist.
-


Any Idea ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Really, realy strange MySQLdb problem, cycling through error messages.

2008-05-20 Thread Rishabh Manocha

There was a permission denied error 'cause if your webserver was
running under some user other than root (as it should be), it won't be
able to write to the root's home directory (as it shouldn't).

Assuming you are using Apache with mod_python, here is something you
could put in your httpd.conf:

SetEnv PYTHON_EGG_CACHE /tmp/python-eggs

Include this with the rest of your settings for the django app.

Best,

R

On Wed, May 21, 2008 at 3:04 AM, Rodrigo Culagovski
<[EMAIL PROTECTED]> wrote:
>
> For future reference: fixed, it stabilized to the 3rd error message. I
> added this to __init.py__ in the application's directory:
>
> import os
> os.environ['PYTHON_EGG_CACHE'] = '/tmp'
>
> Apparently there was some permission error on '/root/.python-eggs'
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Testing login required views

2008-05-20 Thread Julien

In another thread [1] James Bennett suggested to use a middleware to
require login for all views. That is indeed a very simple and elegant
way. Here's the code I ended up with:

from django.contrib.auth.decorators import login_required
from django.conf import settings

public_paths = ['/accounts/register/',
'/accounts/login/',
'/accounts/logout/',]

class AuthRequiredMiddleware(object):
def process_view(self, request, view_func, view_args,
view_kwargs):
if request.path.startswith(settings.MEDIA_URL) or request.path
in public_paths:
return None
else:
return login_required(view_func)(request, *view_args,
**view_kwargs)


Cheers!

Julien


[1] 
http://groups.google.com/group/django-users/browse_thread/thread/2ab080ac86d9b820/b59196f5a0ecbd85#b59196f5a0ecbd85



On May 21, 11:19 am, Julien <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a site where pretty much all views (except for register, login
> and logout) require the user to log in. Now that the number of views
> has grown I'd like to test that I didn't forget to protect them with
> the login_required decorator.
>
> I'm looking for an automated way to do that. Is that achievable, and
> if so, how?
>
> I've started looking into unit testing but I'm struggling a bit and
> I'm not sure if that could do the trick. What I'd like to do is test
> all possible urls from the URLConf and spot those that are not
> redirected to the login page.
>
> Any hint?
>
> Thank you,
>
> Julien
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Authentication for whole app

2008-05-20 Thread Adam Gomaa

On Tue, May 20, 2008 at 10:11 PM, Graham Dumpleton
<[EMAIL PROTECTED]> wrote:
>
> But is it true SSO?

We have 'true' SSO working with multiple Django applications at my
workplace, using CAS and an authentication backend based on
django-cas; IIRC we're planning to release an updated version to the
world at large. I'll check on this tomorrow.

> Just sharing the same user database doesn't necessarily help in that
> you still have to log in to each application.

We actually don't share database across the applications, so logging
into each instance (which might just consist of a bunch of redirects
if the user's already authenticated to the CAS server) creates a new
user object in the Django instance's local database. This even works
for multiple instances on the same domain (or not), as long as you
remember to use a different SESSION_COOKIE_NAME for each instance.

Conceptually, the SSO is done one layer deeper than Django. Individual
Django instances are themselves clients to the SSO service (CAS, in
this case).

Of course, I don't think this has anything to do with what the OP was
needing, but your post reminded me of this anyway.

Adam

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Authentication for whole app

2008-05-20 Thread Graham Dumpleton

On May 21, 12:04 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Tue, May 20, 2008 at 8:57 PM, Graham Dumpleton
>
> <[EMAIL PROTECTED]> wrote:
> > Let me ask my own question then. If one is running multiple Django
> > instances, does Django provide anything that would help with single
> > sign on (SSO) across all the distinct Django application instances?
>
> Well, they can share a database and auth against a single users table
> (we do this all the time), or you can have an external authentication
> source and write an auth backend which knows how to talk to it and
> authenticate against it, then use it on all the sites which need it.
> I've seen people doing LDAP and various other corporate-love-fest auth
> systems that way.

But is it true SSO?

Just sharing the same user database doesn't necessarily help in that
you still have to log in to each application.

Although using HTTP Basic Authentication is easy to manage off a
shared authentication handler, it is generally harder when it is a
form/cookie based login system.

Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: IOError: Client read error (Timeout?)

2008-05-20 Thread Graham Dumpleton

On May 21, 10:16 am, Aljosa Mohorovic <[EMAIL PROTECTED]>
wrote:
> On May 20, 12:26 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > Generally you can ignore it, it usually indicates that the user
> > pressed reload on a page or navigated off it before the browser could
> > send through the whole request.
>
> > BTW, it is good idea to mention what hosting mechanism you are using
> > when you get errors like this. I know this is generated by mod_python,
> > but the majority wouldn't.
>
> thanks, i didn't know this is mod_python reported error and not on
> django level, what kind of error would i receive in mod_wsgi or other
> solutions?

In mod_wsgi you would probably see 'client connection closed'. At
worst if something bad happened which more precise reason couldn't be
determined then 'failed to write data'. The latter might occur though
where an output filter in Apache implemented by some other Apache
module screwed up.

See:

  http://code.google.com/p/modwsgi/issues/detail?id=29

for an example error message and some discussion about whether or not
there should be an ability to suppress the error message.

Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Authentication for whole app

2008-05-20 Thread James Bennett

On Tue, May 20, 2008 at 8:57 PM, Graham Dumpleton
<[EMAIL PROTECTED]> wrote:
> Let me ask my own question then. If one is running multiple Django
> instances, does Django provide anything that would help with single
> sign on (SSO) across all the distinct Django application instances?

Well, they can share a database and auth against a single users table
(we do this all the time), or you can have an external authentication
source and write an auth backend which knows how to talk to it and
authenticate against it, then use it on all the sites which need it.
I've seen people doing LDAP and various other corporate-love-fest auth
systems that way.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Authentication for whole app

2008-05-20 Thread Graham Dumpleton



On May 21, 11:57 am, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On May 21, 11:47 am, "James Bennett" <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Tue, May 20, 2008 at 7:14 PM, Graham Dumpleton
>
> > <[EMAIL PROTECTED]> wrote:
> > > If you want to use HTTP Basic authentication, then put everything
> > > under/behind Apache and use Apache to do it. If you want to use form
> > > based authentication with same user database across all applications
> > > gets a bit harder. Which do you want?
>
> > It's actually not that hard, even if you want to require auth only for
> > specific areas. A middleware like this might do the trick (with a
> > little tweaking):
>
> > from django.contrib.auth.decorators import login_required
>
> > class AuthRequiredMiddleware(object):
> >     def process_view(self, request, view_func, view_args, view_kwargs):
> >         if ... (fill in test here to see if it's a URL or view you
> > want to require auth for):
> >             return login_required(view_func)(request, *view_args, 
> > **view_kwargs)
>
> This is where I am ignorant of what can be done with Django. But then
> rereading OP question I may have been reading too much in it. My
> initial impression was that he was talking about distinct Django
> instances. I forgot that Django has a concept of applications within a
> specific Django instance. Because of mod_wsgi I always tend to think
> of the more complicated cases that need to be handled. :-(
>
> Let me ask my own question then. If one is running multiple Django
> instances, does Django provide anything that would help with single
> sign on (SSO) across all the distinct Django application instances?
>
> There are obviously various challenges with this because of need for
> single session database, plus any requirements for configuring
> settings.py as to naming of the cookie, setting of cookie path and any
> magic session keys that might need to be shared.
>
> I remember something about Paste (Pylons?) having some support in it
> for working with a SSO module which is available for Apache. Can't
> remember the name of the Apache module right now, not sure if it is
> mod_auth_form or not. This is handling most stuff outside of Apache,
> except perhaps for the user authentication through a special script.

Hmmm, meant 'outside of Django'.

Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Authentication for whole app

2008-05-20 Thread Graham Dumpleton

On May 21, 11:47 am, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Tue, May 20, 2008 at 7:14 PM, Graham Dumpleton
>
> <[EMAIL PROTECTED]> wrote:
> > If you want to use HTTP Basic authentication, then put everything
> > under/behind Apache and use Apache to do it. If you want to use form
> > based authentication with same user database across all applications
> > gets a bit harder. Which do you want?
>
> It's actually not that hard, even if you want to require auth only for
> specific areas. A middleware like this might do the trick (with a
> little tweaking):
>
> from django.contrib.auth.decorators import login_required
>
> class AuthRequiredMiddleware(object):
>     def process_view(self, request, view_func, view_args, view_kwargs):
>         if ... (fill in test here to see if it's a URL or view you
> want to require auth for):
>             return login_required(view_func)(request, *view_args, 
> **view_kwargs)

This is where I am ignorant of what can be done with Django. But then
rereading OP question I may have been reading too much in it. My
initial impression was that he was talking about distinct Django
instances. I forgot that Django has a concept of applications within a
specific Django instance. Because of mod_wsgi I always tend to think
of the more complicated cases that need to be handled. :-(

Let me ask my own question then. If one is running multiple Django
instances, does Django provide anything that would help with single
sign on (SSO) across all the distinct Django application instances?

There are obviously various challenges with this because of need for
single session database, plus any requirements for configuring
settings.py as to naming of the cookie, setting of cookie path and any
magic session keys that might need to be shared.

I remember something about Paste (Pylons?) having some support in it
for working with a SSO module which is available for Apache. Can't
remember the name of the Apache module right now, not sure if it is
mod_auth_form or not. This is handling most stuff outside of Apache,
except perhaps for the user authentication through a special script.

Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Authentication for whole app

2008-05-20 Thread James Bennett

On Tue, May 20, 2008 at 7:14 PM, Graham Dumpleton
<[EMAIL PROTECTED]> wrote:
> If you want to use HTTP Basic authentication, then put everything
> under/behind Apache and use Apache to do it. If you want to use form
> based authentication with same user database across all applications
> gets a bit harder. Which do you want?

It's actually not that hard, even if you want to require auth only for
specific areas. A middleware like this might do the trick (with a
little tweaking):

from django.contrib.auth.decorators import login_required

class AuthRequiredMiddleware(object):
def process_view(self, request, view_func, view_args, view_kwargs):
if ... (fill in test here to see if it's a URL or view you
want to require auth for):
return login_required(view_func)(request, *view_args, **view_kwargs)




-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Json server testing, new to Django

2008-05-20 Thread Diego Ucha

Puff,

I recommend reading "The Development Server" section from Chapter 2 of
Django Book (http://www.djangobook.com/en/1.0/chapter02/).
"The development server can handle only a single request at a time
reliably...".
Looks like that is your case.

[]s
Diego Ucha

On 20 maio, 18:40, puff <[EMAIL PROTECTED]> wrote:
> I'm rather new to Django and working on a site that will need to do
> the usual Django things by way of serving DB backed dynamic pages.  It
> addition it needs to serve JSON and make JSON requests.
>
> For the moment, I'm just experimenting with some very simple tests
> using Django's development web server.
>
> I'm able to get JSON responses ok from 'http://localhost:8000/json'
> but when I try to access a JSON URI for json_get Django hangs.  If
> instead of   'http://localhost:8000/json'I access 
> 'http://www.google.com'things work.  I assume that there is an issue with
> Django's development server that limits it to serving a single view at
> a time.  Can anyone verify this?
>
> Thanks for any clues.
>
> Puff
>
> < code >
>
> import urllib
> from django.http import HttpResponse
> from django.utils import simplejson
>
> # test json view
> mtj = 'application/json'
> mtt = 'text/plain'
> mt = mtt
>
> def json(request):
> data = {'first': 'richard', 'last': 'bell'}
> json = simplejson.dumps(data)
> return HttpResponse(json, mimetype=mt)
>
> def json_day(request, day):
> data = {'first': 'richard', 'last': 'bell', 'day': day}
> json = simplejson.dumps(data)
> return HttpResponse(json, mimetype=mt)
>
> def json_get(request):
> print 'in json_get'
> url = 'http://localhost:8000/json'
> #url = 'http://www.google.com'
> f = urllib.urlopen(url)
> print 'got f'
> print f
> doc = f.read()
> print 'got doc %s' % doc
> return HttpResponse('Inside json_get with <<%s>>' % doc)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin : Select category -> show subcategory

2008-05-20 Thread Diego Ucha

Ok Martyn, understood.
Mainly that piece of code represents many functions, one inside the
other, since you need to reuse one, than you could declare this inner
function that you are aiming at, outside the event and call it on the
event(s) (in your case onchange and document ready).
That way you will have to write this function only once.
What do you think?

[]s
Diego Ucha

Declare it somewhere else, and call him from the event

On 20 maio, 05:59, martyn <[EMAIL PROTECTED]> wrote:
> In fact, at the creation, you select a category, the the
> subcategories
> are shown. It's OK
>
> /*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-
> ===Create_Object===
>
> Category
> [--select_category--]
>
> SubCategory
> [--select_subcategory--]
>
> /*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-
>
> But, at the modification / edition of an object, I have to set the
> right category and the right subcategory.
>
> /*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-
> ===Edit_Object===
>
> Category
> [--shoes--]
>
> SubCategory
> [--pretty_shoes--]
>
> /*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-
>
> All I want is not to right the same javascript code twice
> (on_selectlist_change == on_document_ready)
> I don't know the better way to do this in django FW.
> The only thing I did is to right the same code twice... It's not the
> DRY philosophy of Django.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Testing login required views

2008-05-20 Thread Julien

Hi,

I have a site where pretty much all views (except for register, login
and logout) require the user to log in. Now that the number of views
has grown I'd like to test that I didn't forget to protect them with
the login_required decorator.

I'm looking for an automated way to do that. Is that achievable, and
if so, how?

I've started looking into unit testing but I'm struggling a bit and
I'm not sure if that could do the trick. What I'd like to do is test
all possible urls from the URLConf and spot those that are not
redirected to the login page.

Any hint?

Thank you,

Julien
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: load external xml and css with varibles?

2008-05-20 Thread Simon Tite

I'm afraid I don't quite understand all of your question, but I can
possibly answer part of it, although please bear in mind I'm quite new
at Django, so there may be better ways of doing it.

On May 19, 11:50 am, sebey <[EMAIL PROTECTED]> wrote:
>
> I am thinking about making a template that has the sturcture and and
> have a css template with the background color as a variable is this
> possible basically all the shows come form this template  and css
> file
>
As far as I know, CSS files can't have variables or constants defined
within them. To have different colour backgrounds, my first approach
would be simply to have different CSS files, e.g. base_red.css,
base_green.css, etc. This is an approach I am currently using in a
development I am doing, however, the drawback is obviously going to be
the ongoing maintenance of two or more CSS files which need to be
identical apart from one or two lines defining the colour. Probably
not a tremendous problem if it is ONLY the background colour which
needs to change... The applicable CSS file to be used can be defined
using the template system: in my base.html (which defines to overall
structure of all subordinate pages) I have the following line:

(in the . block): 

The variable {{ style }} can be defined in the URL, or maybe in the
GET data (eg www..com/?style=red), or anywhere you like.

This worked fine for me, because I am using it to define more than
just the background colour, but also to radically change the layout of
the page, such as fonts, borders, graphics, element positioning etc.

However the next stage might be, to have more than one stylesheet for
the page... I think this would work fine for just background colour
changes, for example:

Style sheet red.css:
body {background-color: #FF;}

Style sheet green.css:
body {background-color: #00FF00;}

Style sheet base.css:
All the other stuff!

base.html:

 
 


I haven't tried this yet, but I think it would work.

The third thought to occur to me was to use JavaScript (or something)
to directly modify the DOM model, however at this stage the learning
curve seem too scary to me, however it might actually be the best way
in the end, if the variations in styles become too complex.

> not to mention can you load a template with in a template like have
> the homepages with templates inside them?
>
Well, yes I think so... I'm not sure why you think that would not be
possible, have you had a problem with it, or am I misunderstanding
your question?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Creating a form class based on fields stored in the database

2008-05-20 Thread MrJogo

I want to create a web interface where users can create a form (ie,
define the number of fields and what types of fields they are and the
name to display), which will be stored in the Django database, and
then displayed elsewhere on the site as an actual form. Any ideas how
best to do this, specifically how to turn data stored in a database
(probably as a charfield) into a form object? Any examples of this
already being done? Is there a Python method to turn strings (ie,
"forms.CharField()") into the objects they represent?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: IOError: Client read error (Timeout?)

2008-05-20 Thread Aljosa Mohorovic

On May 20, 12:26 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> Generally you can ignore it, it usually indicates that the user
> pressed reload on a page or navigated off it before the browser could
> send through the whole request.
>
> BTW, it is good idea to mention what hosting mechanism you are using
> when you get errors like this. I know this is generated by mod_python,
> but the majority wouldn't.

thanks, i didn't know this is mod_python reported error and not on
django level, what kind of error would i receive in mod_wsgi or other
solutions?

Aljosa
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Authentication for whole app

2008-05-20 Thread Graham Dumpleton

On May 21, 12:49 am, Dougal <[EMAIL PROTECTED]> wrote:
> Say you have a hierarchy of apps, how can i easily require
> authentication to a whole app? or basically a whole folder.

Depends on what sort of authentication you want to use.

If you want to use HTTP Basic authentication, then put everything
under/behind Apache and use Apache to do it. If you want to use form
based authentication with same user database across all applications
gets a bit harder. Which do you want?

Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Apache (and dev server) throws "connection reset" when accessing pages via IE 6

2008-05-20 Thread Graham Dumpleton



On May 20, 10:53 pm, "Rishabh Manocha" <[EMAIL PROTECTED]> wrote:
> Hey Guys,
>
> I have just deployed my code to my test server (from my laptop) and
> setup apache/mod_python to serve the pages. Everything works just fine
> when I work with Firefox, but whenever I access my pages using IE 6, I
> keep getting the following errors in the apache error logs:
>
> [Tue May 20 17:59:43 2008] [notice] mod_python: (Re)importing module
> 'django.core.handlers.modpython'
> [Tue May 20 17:59:45 2008] [notice] mod_python: (Re)importing module
> 'django.core.handlers.modpython'
> [Tue May 20 17:59:45 2008] [notice] mod_python: (Re)importing module
> 'django.core.handlers.modpython'
> [Tue May 20 17:59:45 2008] [notice] mod_python: (Re)importing module
> 'django.core.handlers.modpython'
> [Tue May 20 17:59:45 2008] [info] [client 146.208.137.89]
> (104)Connection reset by peer: core_output_filter: writing data to the
> network
> [Tue May 20 17:59:45 2008] [info] [client 146.208.137.89] (32)Broken
> pipe: core_output_filter: writing data to the network
>
> This results in my forms being thrown off the tracks and I end up
> getting weird form results (going by the data being saved to the DB).
>
> I am using apache 2.0 and mod_python 3.2:
> httpd-2.2.3-6.el5
> mod_python-3.2.8-3.1
>
> My apache configuration is:
> 
>         SetHandler python-program
>         PythonHandler django.core.handlers.modpython
>         SetEnv DJANGO_SETTINGS_MODULE MyProject.settings
>         SetEnv PYTHON_EGG_CACHE /tmp/python-eggs
>         PythonDebug On
>         PythonPath "['/opt/proj'] + sys.path"
> 
>
> I get a similar error using the dev server:
>
> Exception happened during processing of request from ('127.0.0.1', 2144)
> Traceback (most recent call last):
>   File "C:\Python25\lib\SocketServer.py", line 222, in handle_request
>     self.process_request(request, client_address)
>   File "C:\Python25\lib\SocketServer.py", line 241, in process_request
>     self.finish_request(request, client_address)
>   File "C:\Python25\lib\SocketServer.py", line 254, in finish_request
>     self.RequestHandlerClass(request, client_address, self)
>   File "C:\Python25\Lib\site-packages\django\core\servers\basehttp.py",
> line 554, in __init__
>     BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
>   File "C:\Python25\lib\SocketServer.py", line 522, in __init__
>     self.handle()
>   File "C:\Python25\Lib\site-packages\django\core\servers\basehttp.py",
> line 594, in handle
>     self.raw_requestline = self.rfile.readline()
>   File "C:\Python25\lib\socket.py", line 346, in readline
>     data = self._sock.recv(self._rbufsize)
> error: (10054, 'Connection reset by peer')
>
> I read [1] where this guy had a similar problem but fixed it by
> changing his proxy settings to make it such that going to localhost
> does not take a route via the proxy. Trying the same thing did not
> help in my case.
>
> I was hoping someone else would have run into this problem and could
> suggest a solution.
>
> Many thanks,
>
> Rishabh
>
> [1] -http://groups.google.com/group/django-users/browse_thread/thread/bfb2...

This indicates that the browser (or proxy) closed the connection
before all response content had been sent. Use live headers extension
for Firefox to capture the response headers and make sure the Content-
Length is actually correct for the amount of data sent. Some browsers
are more tolerant of incorrect content lengths on responses than
others. If the browser is being more strict it may close connection
immediately it sees content length read, but if you were wrongly
sending more data than that, result would be truncated and would get
this error on server side if running with 'info' for LogLevel. Note
that by default LogLevel is 'warn' and you wouldn't normally see this
message.

You could also use any of the various network traffic analysers to
also monitor what is being sent in response and thus work out at what
point the connection is being cut off and whether it is consistently
at same point.

Graham

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Canberra developers

2008-05-20 Thread Russell Keith-Magee

On Mon, May 19, 2008 at 6:32 PM, Ryan <[EMAIL PROTECTED]> wrote:
>
> I live in Canberra, Australia and I'm putting together a web start-up,
> hopefully using the Django framework. Does anyone know of any
> competent Django developers, or at least Python coders, in my neck of
> the woods?

Your best bet on this is going to be http://djangopeople.net/ or
http://djangogigs.com/. If there's a Django developer in your area,
chances are they're on one of these sites (and probably both).

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem about Url

2008-05-20 Thread Simon Tite

Correction to last message:

def intropage:
query="some default value"
page="1"  #(default to page 1)
if "query" in request.GET:
query=request.GET("query")
if "page" in request.GET:
page=request.GET("page")
#go get the data or whatever you need to do...
return render_to_response("firstpage.html",locals())  #or
whatever you
need...

(Can't you edit these posts after youve posted them?)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem about Url

2008-05-20 Thread Simon Tite

On May 19, 7:32 pm, "free won" <[EMAIL PROTECTED]> wrote:
> i found this Problem  when i decide to use Paginator.
>
> the str    *(?P\w+/)$*     can express    * ?query=xxx*
>
> so if i wanna express *?query=xxx=1*,  how can I write the str for
> urls.py?

The part of the url following (and including) the question mark is not
actually part of the url, if you see what I mean, but is actually the
data passed as GET data. And Django provides an easy way to get at
this. Example,

The address required is : "http://www.mysite.com/?
query=dosomething=1" will be intercepted and passed to the
views.py module, with a line in urls.py similar to : "(r'^
$',views.intropage)" (this calls intropage for the main site name,
"mysite.com") - at this point you are NOT trying to match with the ?
query=xxx=1 part, just with the url part www.mysite.com/

Then, in views.py, you define a subroutine, which might look something
like this:

def intropage:
query="some default value"
page="1"#(default to page 1)
if "query" in request.GET:
query=request.GET("query")
if "page" in request.GET("page")
page=request.GET("page")
#go get the data or whatever you need to do...
return render_to_response("firstpage.html",locals())#or whatever you
need...

hope this helps

Simon.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



What do you use for project management?

2008-05-20 Thread Gene Campbell

I have used Jira, and I'm looking at Trac today.   Is there something
more Djangonic?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django Json server testing, new to Django

2008-05-20 Thread puff

I'm rather new to Django and working on a site that will need to do
the usual Django things by way of serving DB backed dynamic pages.  It
addition it needs to serve JSON and make JSON requests.

For the moment, I'm just experimenting with some very simple tests
using Django's development web server.

I'm able to get JSON responses ok from 'http://localhost:8000/json'
but when I try to access a JSON URI for json_get Django hangs.  If
instead of   'http://localhost:8000/json' I access 'http://
www.google.com' things work.  I assume that there is an issue with
Django's development server that limits it to serving a single view at
a time.  Can anyone verify this?

Thanks for any clues.

Puff


< code >

import urllib
from django.http import HttpResponse
from django.utils import simplejson

# test json view
mtj = 'application/json'
mtt = 'text/plain'
mt = mtt

def json(request):
data = {'first': 'richard', 'last': 'bell'}
json = simplejson.dumps(data)
return HttpResponse(json, mimetype=mt)

def json_day(request, day):
data = {'first': 'richard', 'last': 'bell', 'day': day}
json = simplejson.dumps(data)
return HttpResponse(json, mimetype=mt)

def json_get(request):
print 'in json_get'
url = 'http://localhost:8000/json'
#url = 'http://www.google.com'
f = urllib.urlopen(url)
print 'got f'
print f
doc = f.read()
print 'got doc %s' % doc
return HttpResponse('Inside json_get with <<%s>>' % doc)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Really, realy strange MySQLdb problem, cycling through error messages.

2008-05-20 Thread Rodrigo Culagovski

For future reference: fixed, it stabilized to the 3rd error message. I
added this to __init.py__ in the application's directory:

import os
os.environ['PYTHON_EGG_CACHE'] = '/tmp'

Apparently there was some permission error on '/root/.python-eggs'
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Creating search forms

2008-05-20 Thread Matt

I'm trying to figure out the best way to create basic search forms in
Django. Currently I'm using newforms and have a simple view that takes
the parameters, calls the appropriate filters and returns the results.


# newform
class ProjectSearchForm(forms.Form):
p_type = forms.ModelChoiceField(queryset =
ProjectType.objects.all(), required=False)
p_stage = forms.ModelChoiceField(queryset =
ProjectStage.objects.all(), required=False)
p_status = forms.ModelChoiceField(queryset =
ProjectStatus.objects.all(), required=False)


# view
def project_search(request):
p_type = request.GET.get('p_type', None)
p_stage = request.GET.get('p_stage', None)
p_status = request.GET.get('p_status', None)

data = {'p_type':p_type,
'p_stage':p_stage,
'p_status':p_status,
}
search_form = ProjectSearchForm(data)
if search_form.is_valid():
results = Project.objects.all.(),order('name')
if search_form.data['p_type']:
results =
results.filter(p_type=search_form.data['p_type'])
if search_form.data['p_stage']:
results =
results.filter(p_type=search_form.data['p_stage'])
if search_form.data['p_status']:
results =
results.filter(p_type=search_form.data['p_status'])
else
results = []
context = Context()
context.update({'search_form': search_form})
context.update({'results': results})
return render_to_response('projects/projects_list.html',
RequestContext(request, context))



However, it seems like I should be able to abstract things so that I
the actual field only show up in the form declaration.
  - I don't have to set each field to send into the form
  - I don't have to set a filter for each field


Something more like this:

#view
def project_search(request):
#create search form with current request variables or using intial
values for form?
search_form = ProjectSearch(request.GET)
if search_form.is_valid():
#QuerySet filter created by search form?
results = Project.objects.filter(search_form.filter)
else:
results = []
context = Context()
context.update({'search_form': search_form})
context.update({'results': results})
return render_to_response('projects/projects_list.html',
RequestContext(request, context))


I've been looking around a bit at generic views, but it didn't seem to
be quite what I am looking for. Is this type of generic search form
currently possible?

Any help would be appreciated. Thanks!

Matt

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Incrementing by 4 instead of 1?

2008-05-20 Thread ringemup

Ah -- I bet that was it.  Thanks!

On May 20, 4:20 pm, Sean <[EMAIL PROTECTED]> wrote:
> Something which may cause this is if your template includes any empty
> image, javascript, or css references (i.e. ).
>
> If you have anything like this in your template, your web browser will
> fetch the page multiple times (it will think that current page is the
> file you are trying to reference) causing your value to increment
> several steps each time you visit the page.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: problems with python setup.py build

2008-05-20 Thread Wim

Thank you, Karen. Your advice solved my problem.

I keep track of what I'm doing, just in case I have to do it a second
time. Here's an excerpt:

// Install precompiled version python-psycopg2_2.0.6-3_i386.deb
// from http://packages.ubuntu.com/hardy/python/python-psycopg2
$ sudo dpkg -i python-psycopg2_2.0.6-3_i386.deb
// gives error: python-psycopg2 is dependent on python-egenix-
mxdatetime

// ok, lets downlaod again. This time python-egenix-
mxdatetime_3.0.0-3build1_i386.deb from
// http://packages.ubuntu.com/hardy/python-egenix-mxdatetime
$ sudo dpkg -i python-egenix-mxdatetime_3.0.0-3build1_i386.deb
// gives error: python-egenix-mxdatetime is dependent on python-egenix-
mxtools

// OMG. lets downlaod again. This time python-egenix-
mxtools_3.0.0-3build1_i386.deb from
// http://packages.ubuntu.com/hardy/python-egenix-mxtools
$  sudo dpkg -i python-egenix-mxtools_3.0.0-3build1_i386.deb
// hey !! it worked !!

// Backtracking the whole bunch.
$ sudo dpkg -i python-egenix-mxdatetime_3.0.0-3build1_i386.deb
$ sudo dpkg -i python-psycopg2_2.0.6-3_i386.deb
// It all worked like a charm (Note: found all relevant .deb's on
Ubuntu site, easy to find,
// nicely grouped by Ubuntu-version. Neat)


Karen, thank you very much!
Wim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Try Except Statement not working properly.

2008-05-20 Thread Norman Harman

Greg wrote:
> Since we know what the exception is.  The email address already exist
> in the db (I have unique=True for the email field).  I thought that
> having 'except: pass' would solve that problem.  However, do I need to
> catch a certain exception in order for my loop to continue.  Because
> as of now when the exception happens my loop stops.

You don't *know* that is what the exception is, you assume that.  This 
is one reason it is bad to catch all exceptions.  You don't know what 
you are getting.

The loop, as written, will continue.  There is something else going on.

I would add print statements to determine what is in fact happening.

for row in reader:
  try:
  b = OrderEmail(name=row[0], email=row[1], been_sent="0")
  b.save()
  print "saved", row
  except Exception, msg:
  print msg

-- 
Norman J. Harman Jr.  512 912-5939
Technology Solutions Group, Austin American-Statesman
___
Get out and about this spring with the Statesman! In print and online,
the Statesman has the area's Best Bets and recreation events.
Pick up your copy today or go to statesman.com 24/7.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Incrementing by 4 instead of 1?

2008-05-20 Thread ringemup

Yeah, I actually did start with a model method, but added the temp
variable because I was worried I was missing some magic.

Anyhow, I just got it sorted out -- my browser's broken.  It's
submitting every POST as a POST followed by three GETs, and ever GET
as four GETs.  I'll be filing a bug against it.

Thanks for your help!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Incrementing by 4 instead of 1?

2008-05-20 Thread Sean

Something which may cause this is if your template includes any empty
image, javascript, or css references (i.e. ).

If you have anything like this in your template, your web browser will
fetch the page multiple times (it will think that current page is the
file you are trying to reference) causing your value to increment
several steps each time you visit the page.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Incrementing by 4 instead of 1?

2008-05-20 Thread Norman Harman

ringemup wrote:
> Hi folks,
> 
> I feel like I must be doing something stupid.  I've got the following
> view:
> 
> def adopt_bunny(request, id):
>   try:
>   bunny = Bunny.objects.get(pk=int(id))
>   except:
>   raise Http404
>   adoptions = bunny.adoption_count
>   adoptions = adoptions + 1
>   bunny.adoption_count = adoptions
>   bunny.save()
>   return single_bunny(request, id, True)
> 
> Every time I make this request (after the first time for that
> particular bunny), it increments by 3 or 4 instead of by 1.
> single_bunny() just calls the object_detail() generic view with some
> extra context.
> 
> How can I track down what's going on?  Or am I doing something
> completely braindead?
> 
> Thanks!

You don't need temp varible.  and there is a short cut for your 
try/except 
http://www.djangoproject.com/documentation/shortcuts/#get-object-or-404 
This would do

def adopt_bunny(request, id):
   bunny = get_object_or_404(Bunny, pk=id)
   bunny.adoption_count += 1
   bunny.save()

Don't know why it would inc by 3 or 4.  Assuming you are running dev 
server...  I'd add a print statement in there

   print "bunny %s: %s" % (bunny.id, bunny.adoption_count)

just to see when/if this code is being called multiple times and the 
value of adoption_count when it is.  Maybe add print to Bunny's save 
method to see where else it is getting modified/saved.

Also I'd probably make a method in the BunnyModel instead of doing this 
in the view.  Maybe overkill for this case (but today's overkill is 
tomorrow's maintenance saving feature)

Bunny(Model):
   ...
   def adopt(self):
   self.adoption_count += 1
   self.save()

Then from your view call it

def adopt_bunny(request, id):
   bunny = get_object_or_404(Bunny, pk=id)
   bunny.adopt()
   return single_bunny(request, id, True)



-- 
Norman J. Harman Jr.  512 912-5939
Technology Solutions Group, Austin American-Statesman
___
Get out and about this spring with the Statesman! In print and online,
the Statesman has the area's Best Bets and recreation events.
Pick up your copy today or go to statesman.com 24/7.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Get the 'named links' from the request path

2008-05-20 Thread deepc

Does anyone know how to get the 'named links' from the request path
from with a view? For example, I'd like to get 'blah' from the
following URL: test.com/somepage/?someget=xyz#blah

I know about the methods request.path or request.get_full_path()...
but neither these return the 'named' part of the URL.

The reason this is important is because I'm using AJAX to modify the
page. A well known practice is to use 'named links' to change the
location of the document without having the browser reload the page.
So pages like test.com/my_document#page=1 and test.com/
my_document#page=2 do not need a full reload and each can be book
marked by the user.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Really, realy strange MySQLdb problem, cycling through error messages.

2008-05-20 Thread Rodrigo Culagovski

I'm setting up a django site on the production server and ran into a
MySQLdb problem. The server is cycling through a series of error
messages:

1) ImproperlyConfigured: Error loading MySQLdb module: No module named
MySQLdb

2) ImproperlyConfigured: Error loading MySQLdb module: bad local file
header in /usr/local/lib/python2.5/site-packages/MySQL_python-1.2.2-
py2.5-linux-i686.egg

3) ExtractionError: Can't extract file(s) to egg cache

The following error occurred while trying to extract file(s) to the
Python egg
cache:

  [Errno 13] Permission denied: '/root/.python-eggs'

The Python egg cache directory is currently set to:

  /root/.python-eggs

Perhaps your account does not have write access to this directory?
You can
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible directory.

4) the "It worked! Congratulations on your first Django-powered page."

This cycling happens just by refreshing the same page, making NO
changes to the server at all. It's always in the same order. The first
2 text errors change after just 1 refresh, the last one takes 3 or 4
and the "It worked" message takes a bit longer before going back to
error 1.
I svn'ed the application into the appropriate directory, with urls.py,
etc., so I shouldn't be getting the "It worked" message at all.
I recently installed MySQLdb, and it installed setuptools
automatically.

Usiing trunk on Red Hat 4.1.2-14
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: downloadable django site example anywhere?

2008-05-20 Thread Adam Fast

Kenneth,

http://code.djangoproject.com/svn/djangoproject.com/

Is the URL you want for subversion.  The "browser" url uses the
web-based browser to look at it file by file.

Unfortunately though you won't find a lot of newforms / modelforms
stuff there I'm afraid (or lost-theories unless it's been updated
since I last looked).  I'm not positive if there is any public code
out there that does that.

I will share some simple code from one of my projects that is using it
and working.  This is all in a single app.  The
text_message_subscribe() view is called in my URLs.


models.py-

class TeamNotification(models.Model):
team = models.ForeignKey(Team)
notification_type = models.ForeignKey(TeamNotificationType,
verbose_name='Type of Notification')
destination_carrier = models.ForeignKey(NotificationCarrier,
verbose_name='Your Cellular Carrier', null=True, blank=True)
destination = models.CharField('Your (Ten-Digit) Wireless Number
or Email Address (No dashes/spaces please)', max_length=255)
welcome_sent = models.BooleanField(default=False)
reminder_sent = models.BooleanField(default=False)
active = models.BooleanField(default=True)

forms.py-

from django import newforms as forms
from project.team.models import TeamNotification

class TeamNotificationForm(forms.ModelForm):
class Meta:
model = TeamNotification
fields = ('team', 'notification_type', 'destination_carrier',
'destination')


views.py--
def text_message_subscribe(request, object_id=None):
if request.method == 'POST':
form = TeamNotificationForm(request.POST)
if form.is_valid:
new_subscription = form.save()
return HttpResponseRedirect('/subscribed/')
else:
form = TeamNotificationForm()
return render_to_response('team/team_detail_subscribe.html',
{'form': form.as_p(), })




On Tue, May 20, 2008 at 2:40 PM, Kenneth McDonald
<[EMAIL PROTECTED]> wrote:
>
> Thanks for the info. I got the jeffcroft.com dl, but an attempt to svn
> the django site
> code gives me an error:
>
> MBP:django-site Ken$ svn co 
> http://code.djangoproject.com/browser/djangoproject.com
> subversion/libsvn_ra_dav/util.c:826: (apr_err=175002)
> svn: PROPFIND request failed on '/browser/djangoproject.com'
> subversion/libsvn_ra_dav/util.c:296: (apr_err=175002)
> svn: PROPFIND of '/browser/djangoproject.com': 200 OK 
> (http://code.djangoproject.com
> )
>
> Thanks again,
> Ken McDonald
>
> On May 20, 2008, at 1:52 PM, kamil wrote:
>
>>
>> You can get www.djangoproject.com web itself by:
>> svn co http://code.djangoproject.com/browser/djangoproject.com
>>
>> or get http://jeffcroft.com/blog/2006/jun/06/lost-theories-with-source-code/
>>
>> sure there are many others
>> good luck
>>
>> On May 20, 2:39 pm, Kenneth McDonald
>> <[EMAIL PROTECTED]> wrote:
>>> Is there a downloadable example of a Django site that illustrates the
>>> various things one needs to do to get the various aspects of a Django
>>> site working? In my case, I still don't have ModelForms working,
>>> and a
>>> complete, simple example would be better than all the descriptive
>>> prose that could be written about this.
>>>
>>> Thanks,
>>> Ken
>> >
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Try Except Statement not working properly.

2008-05-20 Thread Greg

Since we know what the exception is.  The email address already exist
in the db (I have unique=True for the email field).  I thought that
having 'except: pass' would solve that problem.  However, do I need to
catch a certain exception in order for my loop to continue.  Because
as of now when the exception happens my loop stops.

Thanks


On May 19, 3:00 pm, Greg <[EMAIL PROTECTED]> wrote:
> Bruno,
> That is originally how I had my code.
>
> ///
>
> import csv
> from myproject.site.models import OrderEmail
>
> reader = csv.reader(open("myfile.csv", "rb"))
> for row in reader:
> try:
> b = OrderEmail(name=row[0], email=row[1], been_sent="0")
> b.save()
> except:
> pass
>
> 
>
> I think what is going on is that my email field has to be unique.
> When I try to save a record with an email address that is already in
> the db that is when I get directed to the except clause.  So that is
> why some records are have an error.  Now all I need to know if how to
> have my for loop keep going through the records...and just disregard
> the records that have an email address that is already in the db.
>
> On May 19, 2:38 pm, bruno desthuilliers
>
> <[EMAIL PROTECTED]> wrote:
> > On 19 mai, 20:48, Greg <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
> > > I have the following code:
>
> > > ///
>
> > > import csv
> > > from myproject.site.models import OrderEmail
>
> > > reader = csv.reader(open("myfile.csv", "rb"))
> > > for row in reader:
> > > try:
> > > b = OrderEmail(name=row[0], email=row[1], been_sent="0")
> > > b.save()
> > > except:
>
> > Advice from a long-time Python programmer : *never* use a bare except
> > clause, always specify explicitely what exception(s) you intend to
> > handle.
>
> > > pass
> > > assert False, "End"
>
> > > Whenever I run across the first problem record...my for loop stops and
> > > 'End' is printed.  I thought having 'except: pass' meant that the
> > > record would be skipped and it would proceed to read the next line.
>
> > Given your code, that's what should happen. But:
>
> > > However, now when it finds a exception and assert statement is
> > > printed.
>
> > Err... In the above code,  the assert statement will be executed
> > whether there's an exception or not. And "assert False" will always
> > raise. This has nothing to do with your error handling in the for
> > loop, and exceptions happening or not.
>
> > > Any suggestions on how I can read every record in the file and if an
> > > error is encountered then have it just skip that record...without
> > > stopping the loop?
>
> > Just remove the assert statement. And by all mean, do yourself (and
> > whoever will have to maintain this code) a favour and don't leave that
> > bare except clause.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



I need some help on this questions for helping me build my site

2008-05-20 Thread sebey

OK so as you may see I have a lot of questions in helping build my
django project so here they are

   1. with models do just create the fields that you need?
   2. how can I import rss feeds(i am running a podcast network) from
other sites/soures?(models,views,admin etc)
   3. I want to make an email newsletter and I want to know how to
make an email list in django?
 1. I want this to work that django grabs the latest entry in
the feed and grabs the  tags etc.
 2. also maybe have django make extra boxs for typing text
in
   4. also I need to make a calender I am planning to use google
calender cause of ical feeds and things like that can I print these
off (an other app maybe)?

thank you
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: downloadable django site example anywhere?

2008-05-20 Thread Kenneth McDonald

Thanks for the info. I got the jeffcroft.com dl, but an attempt to svn  
the django site
code gives me an error:

MBP:django-site Ken$ svn co 
http://code.djangoproject.com/browser/djangoproject.com
subversion/libsvn_ra_dav/util.c:826: (apr_err=175002)
svn: PROPFIND request failed on '/browser/djangoproject.com'
subversion/libsvn_ra_dav/util.c:296: (apr_err=175002)
svn: PROPFIND of '/browser/djangoproject.com': 200 OK 
(http://code.djangoproject.com 
)

Thanks again,
Ken McDonald

On May 20, 2008, at 1:52 PM, kamil wrote:

>
> You can get www.djangoproject.com web itself by:
> svn co http://code.djangoproject.com/browser/djangoproject.com
>
> or get http://jeffcroft.com/blog/2006/jun/06/lost-theories-with-source-code/
>
> sure there are many others
> good luck
>
> On May 20, 2:39 pm, Kenneth McDonald
> <[EMAIL PROTECTED]> wrote:
>> Is there a downloadable example of a Django site that illustrates the
>> various things one needs to do to get the various aspects of a Django
>> site working? In my case, I still don't have ModelForms working,  
>> and a
>> complete, simple example would be better than all the descriptive
>> prose that could be written about this.
>>
>> Thanks,
>> Ken
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using ModelForm...not populating my choices

2008-05-20 Thread AdamG

Thinko in my post - it's forms.ModelChoiceField, not
models.ModelChoiceField.

On May 20, 2:54 pm, "Adam Gomaa" <[EMAIL PROTECTED]> wrote:
> So your model is like:
>
>     class Folder(models.Model):
>         user = models.ForeignKey(User)
>         # yadda yadda
>
> And you want to give the user a form to sort an object into one of
> their own folders. So what you do is make a form like this:
>
>     class ObjectSortForm(forms.Form):
>         folder = models.ModelChoiceField(Folder.objects.all())
>
> But, if your view, you don't actually want Folder.objects.all() - you
> want user.folder_set.all(). So, you have to set the
> form.fields['folder'].queryset attribute like this in your view:
>
>     def my_view(request):
>         if request.method=="POST":
>             # yadda yadda form handling...
>         else:
>             form = ObjectSortForm()
>             form.fields['folder'].queryset = request.user.folder_set.all()
>
>         # etc etc...
>         return render_to_response("my_template.html", dict(form=form))
>
> Unfortunately, the docs are somewhat incomplete - they only explain
> how to set the initial queryset. I've been meaning to write up some
> documentation explaining the .queryset attribute, so thanks for
> spurring some action :)
>
> Adam
>
> On Tue, May 20, 2008 at 8:59 AM, chylld <[EMAIL PROTECTED]> wrote:
>
> > I have exactly the same problem; I just want to fill the ChoiceField
> > with a certain subset of choices based on the current user. Have you
> > found a way to do this??
>
> > Jonathan
>
> > On Apr 10, 7:21 am, ydjango <[EMAIL PROTECTED]> wrote:
> >> Yes, They are defined in model as
>
> >> owner = models.ForeignKey(Participant,null=True)
>
> >> all I want is to display only the Partcipants for a particular group
> >> in the choice field ( not all participants)
> >>  and I am so frustrated now.
>
> >> eg. Participant.objects.filter(group__exact=my_group)]
>
> >> thanks
> >> Ashish
>
> >> On Apr 9, 2:15 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
>
> >> > On Wed, Apr 9, 2008 at 3:30 PM, ydjango <[EMAIL PROTECTED]> wrote:
> >> > >  Miles and Owner are defined as foreign_key to respective tables.
>
> >> > Yes, but did you actually look at the docs for the field types that
> >> > make it easy to represent foreign keys?
>
> >> > --
> >> > "Bureaucrat Conrad, you are technically correct -- the best kind of 
> >> > correct.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Incrementing by 4 instead of 1?

2008-05-20 Thread ringemup

Hi folks,

I feel like I must be doing something stupid.  I've got the following
view:

def adopt_bunny(request, id):
try:
bunny = Bunny.objects.get(pk=int(id))
except:
raise Http404
adoptions = bunny.adoption_count
adoptions = adoptions + 1
bunny.adoption_count = adoptions
bunny.save()
return single_bunny(request, id, True)

Every time I make this request (after the first time for that
particular bunny), it increments by 3 or 4 instead of by 1.
single_bunny() just calls the object_detail() generic view with some
extra context.

How can I track down what's going on?  Or am I doing something
completely braindead?

Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using ModelForm...not populating my choices

2008-05-20 Thread Adam Gomaa

So your model is like:

class Folder(models.Model):
user = models.ForeignKey(User)
# yadda yadda

And you want to give the user a form to sort an object into one of
their own folders. So what you do is make a form like this:

class ObjectSortForm(forms.Form):
folder = models.ModelChoiceField(Folder.objects.all())

But, if your view, you don't actually want Folder.objects.all() - you
want user.folder_set.all(). So, you have to set the
form.fields['folder'].queryset attribute like this in your view:

def my_view(request):
if request.method=="POST":
# yadda yadda form handling...
else:
form = ObjectSortForm()
form.fields['folder'].queryset = request.user.folder_set.all()

# etc etc...
return render_to_response("my_template.html", dict(form=form))

Unfortunately, the docs are somewhat incomplete - they only explain
how to set the initial queryset. I've been meaning to write up some
documentation explaining the .queryset attribute, so thanks for
spurring some action :)

Adam


On Tue, May 20, 2008 at 8:59 AM, chylld <[EMAIL PROTECTED]> wrote:
>
> I have exactly the same problem; I just want to fill the ChoiceField
> with a certain subset of choices based on the current user. Have you
> found a way to do this??
>
> Jonathan
>
>
> On Apr 10, 7:21 am, ydjango <[EMAIL PROTECTED]> wrote:
>> Yes, They are defined in model as
>>
>> owner = models.ForeignKey(Participant,null=True)
>>
>> all I want is to display only the Partcipants for a particular group
>> in the choice field ( not all participants)
>>  and I am so frustrated now.
>>
>> eg. Participant.objects.filter(group__exact=my_group)]
>>
>> thanks
>> Ashish
>>
>> On Apr 9, 2:15 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
>>
>> > On Wed, Apr 9, 2008 at 3:30 PM, ydjango <[EMAIL PROTECTED]> wrote:
>> > >  Miles and Owner are defined as foreign_key to respective tables.
>>
>> > Yes, but did you actually look at the docs for the field types that
>> > make it easy to represent foreign keys?
>>
>> > --
>> > "Bureaucrat Conrad, you are technically correct -- the best kind of 
>> > correct.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: downloadable django site example anywhere?

2008-05-20 Thread kamil

You can get www.djangoproject.com web itself by:
svn co http://code.djangoproject.com/browser/djangoproject.com

or get http://jeffcroft.com/blog/2006/jun/06/lost-theories-with-source-code/

sure there are many others
good luck

On May 20, 2:39 pm, Kenneth McDonald
<[EMAIL PROTECTED]> wrote:
> Is there a downloadable example of a Django site that illustrates the
> various things one needs to do to get the various aspects of a Django
> site working? In my case, I still don't have ModelForms working, and a
> complete, simple example would be better than all the descriptive
> prose that could be written about this.
>
> Thanks,
> Ken
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ModelForm and MultiValueField

2008-05-20 Thread omat

Thanks for the reply. Here are the HistoricDateField and the
HistoricDateWidget classes:

http://dpaste.com/hold/51690/


--
omat



On May 20, 8:08 pm, fivaldi <[EMAIL PROTECTED]> wrote:
> Hi Omat,
>
> Does your HistoricDateField implement the compress(self, data_list)
> method and _not_ the clean(self, value) method? See the implementation
> comments in django.newforms.fields.MultiValueField. The compress
> method should also return the compressed value of the historic date
> (i.e. one value representing the historic date based on the multivalue
> input)  and that value should be available in the cleaned_data.
>
> -Robin
>
> On May 20, 6:24 pm, omat <[EMAIL PROTECTED]> wrote:
>
> > But I wish to use a MultiValueField instead of a DateField. So I
> > defined a custom date field derived from MultiValueField and used it
> > as follows:
>
> > class NoteForm(forms.ModelForm):
> > date = HistoricDateField()
> > ...
>
> > The form is displayed as I expect, but now clean_date() method of the
> > form is not called and cleaned_data does not have the data for 'date'.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



get_decoded in django shell results in SuspiciousOperation exception

2008-05-20 Thread msoulier

I'm trying to inspect the session data in the db.

>>> from django.contrib.sessions.models import Session
>>> q = Session.objects.all()
>>> for s in q:
...print s.get_decoded()
...
Traceback (most recent call last):
  File "", line 2, in ?
  File "/var/tmp/django-0.96.2-root/usr/lib/python2.3/site-packages/
django/contrib/sessions/models.py", line 82, in get_decoded
SuspiciousOperation: User tampered with session cookie.

And yet...

>>> pickle.loads(base64.decodestring(s.session_data))
{'orderby': 'clientid', 'spp': u'20'}

There's my data. Doesn't look corrupt.

I have no issues in the UI, just when using the Django shell.

Mike
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ModelForm and MultiValueField

2008-05-20 Thread fivaldi

Hi Omat,

Does your HistoricDateField implement the compress(self, data_list)
method and _not_ the clean(self, value) method? See the implementation
comments in django.newforms.fields.MultiValueField. The compress
method should also return the compressed value of the historic date
(i.e. one value representing the historic date based on the multivalue
input)  and that value should be available in the cleaned_data.

-Robin

On May 20, 6:24 pm, omat <[EMAIL PROTECTED]> wrote:
> But I wish to use a MultiValueField instead of a DateField. So I
> defined a custom date field derived from MultiValueField and used it
> as follows:
>
> class NoteForm(forms.ModelForm):
> date = HistoricDateField()
> ...
>
> The form is displayed as I expect, but now clean_date() method of the
> form is not called and cleaned_data does not have the data for 'date'.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



business online

2008-05-20 Thread nizam

Asslamualaikummaaf kerana menganggu masa anda.

Buat Kawan-kawan yang di hormati. Apa Khabar?

Saya telah menjumpai sesuatu yang sungguh luar biasa
dan andalah orang pertama yang saya ingat apabila
pertama kali melihatnya. Sahabat saya, Mohd Nizam akan
mendedahkan beberapa teknik dan strategi yang belum
pernah didedahkan, antaranya:

[X] Bagaimana beliau menjana RM35,956.40 dalam 30
hari!
[X] Rahsia beliau membina 65,000 list prospek dalam
   masa singkat!
[X] Bagaimana beliau menukarkan RM100 kepada RM500
   dengan teknik rahsia Ini!
[X] Strategi yang beliau gunakan untuk menjana
   RM435,200 dalam masa 7 bulan!
[X] Rahsia seorang surirumah menjana pendapatan
   RM30,000 sambil menjaga 3 orang anak dirumah!

Anda boleh membaca laporan rahsia ini secara percuma
dengan melawat ke sini:

-->
http://www.jutawanautomatik.com/recommends/jutawan_online

Kita jumpa disana nanti! Jika ader sebarang pertanyaan
sila hubungi saya di email di bawah:

[EMAIL PROTECTED]

saya akan bantu anda dari masa ke semasa.

Ikhlas,
Hasfazanizam Hasman
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ModelForm and MultiValueField

2008-05-20 Thread omat

Hi all,

I wish to have an extra date field in my ModelForm. When I do it as
follows, it works fine:

class NoteForm(forms.ModelForm):
date = DateField(required=False)

def clean_date(self):
# do the validation ...
return self.cleaned_data

class Meta:
model = Note


But I wish to use a MultiValueField instead of a DateField. So I
defined a custom date field derived from MultiValueField and used it
as follows:

class NoteForm(forms.ModelForm):
date = HistoricDateField()
...

The form is displayed as I expect, but now clean_date() method of the
form is not called and cleaned_data does not have the data for 'date'.

Am I missing something or is it a bug?


Thanks,
omat

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Memcached problem

2008-05-20 Thread [EMAIL PROTECTED]

Nevermind. I missed the part where webfaction requires you to set up
memcached as an app and start it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: business logic and good practices

2008-05-20 Thread Norman Harman

bcurtu wrote:
> Hi,
> 
> The reason you must place your templates out from your app code is
> because if you don't do that, anyone could access to the code via
> browser. Just writing the path of your files, and they have the code.
> It could be a security issue.

That is not the reason, and if you really wanted to you could mix your 
app code and templates, by setting TEMPLATE_DIRS.

None of your django code, templates, settings etc needs to be accessible 
via browser nor should it be.

-- 
Norman J. Harman Jr.  512 912-5939
Technology Solutions Group, Austin American-Statesman
___
Get out and about this spring with the Statesman! In print and online,
the Statesman has the area's Best Bets and recreation events.
Pick up your copy today or go to statesman.com 24/7.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: user.is_authenticated is always false using default login

2008-05-20 Thread James Bennett

On Tue, May 20, 2008 at 10:32 AM, Andrew English
<[EMAIL PROTECTED]> wrote:
> Do I need to explicitly call authenticate and login in my own view to
> populate the user data?  From what I read, it seems that the
> django.contrib.auth.views.login does that automatically.

There's a difference between authenticating the user, which you've
done, and making the user object available as a variable to the
template, which I'm guessing you haven't done. You probably want to
read this:

http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Memcached problem

2008-05-20 Thread [EMAIL PROTECTED]

I'm trying to use memcache for caching, but when I turn it on, the
site proxy errors out. Looking in my error log, I'm seeing tons of
errors like:
Invalid URI in request get views.decorators.cache.cache_header.grm./
some/url/

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



user.is_authenticated is always false using default login

2008-05-20 Thread Andrew English
My view function uses the login required decorator:

@login_required(redirect_field_name='next')
def index(request):
   lists = List.objects.filter(user=request.user)
   return render_to_response('base.html', {'lists': lists})

This directs them to the login page:
LOGIN_URL = '/todone/list/login/'
LOGIN_REDIRECT_URL = '/todone/list/'

Which is correctly handled by the django auth default:
(r'^todone/list/login/$', 'django.contrib.auth.views.login'),

I am using the default template from the authentication instructions:

{% extends "base.html" %}

{% block content %}

{% if form.has_errors %}
Your username and password didn't match. Please try again.
{% endif %}



Username:{{ form.username
}}
Password:{{ form.password
}}






{% endblock %}

When the user logins in with correct credentials, they are redirected to the
expected page.  However in the template, user.is_authenticated is false and
user.username is empty.  But in the views.py, lists =
List.objects.filter(user=request.user) will return the expected results.
Even though the user is not authenticated, the request.user object has the
expected values.

Do I need to explicitly call authenticate and login in my own view to
populate the user data?  From what I read, it seems that the
django.contrib.auth.views.login does that automatically.

Thanks.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



perlbal and django

2008-05-20 Thread [EMAIL PROTECTED]

here is my configuration
dyndns for round robin mode to two perlbal instances
two web server (lighttpd+fastcgi)
mysql-proxy
master-slave db configuration

the two perlbal are running on port 80, if I access my webapp through
the perlbal instance I got an "An unhandled exception was thrown by
the application"

if I access the lighttpd server directly (same machine as perlbal, but
different port), everything works fine

it seems that perlbal is not so transparent for the backend webserver
as it should

any experience with perlbal+lighttpd+fastcgi ???
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Values from a ForeignKey object?

2008-05-20 Thread mbdtsmh

Hi all,

I assume there a way of accessing associated values from a ForeignKey
object in the fieldset.html template that comes with the newforms-
admin branch? I cannot for the life of me figure it out - HELP!

example:


  {% if fieldset.name %}{{ fieldset.name }}{% endif %}
  {% if fieldset.description %}{{ fieldset.description }}{% endif %}
  {% for line in fieldset %}
  {% for field in line %}
  {% ifequal field.field.name "designset" %}
  {{ field.field.form.initial.designset }}   
  {% else %}
  {% if field.is_checkbox %}
  {{ field.field }}{{ field.label_tag }}
  {% else %}
  {{ field.label_tag }}{{ field.field }}
  {% endif %}
  {% endifequal %}
  {% endfor %}
  
  {% endfor %}


In the above example I can print out the designset id
{{ field.field.form.initial.designset }} but cannot figure out how to
get at any of the values associated with this foreignkey table
(DesignSet table contains priority, status & project fields)

Can anyone put me out of my misery?

Regards,

Martin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Authentication for whole app

2008-05-20 Thread Dougal

Say you have a hierarchy of apps, how can i easily require
authentication to a whole app? or basically a whole folder.

Cheers
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django newbie with an install problem - bad interpreter

2008-05-20 Thread lorax

FYI - (sorry about all the posts)

I edited the django-admin.py file and changed the first line where it
calls for env.

Original: /usr/bin/env
Edited: /bin/env

Now it works just fine. Thank you both!

On May 20, 9:41 am, lorax <[EMAIL PROTECTED]> wrote:
> Re: non-std host setup
>
> Ah.. got it. Thank you. So I can edit django-admin.py with PICO to
> point to where they've located "env" and that should take care of the
> issue too.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django newbie with an install problem - bad interpreter

2008-05-20 Thread lorax

Re: non-std host setup

Ah.. got it. Thank you. So I can edit django-admin.py with PICO to
point to where they've located "env" and that should take care of the
issue too.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



downloadable django site example anywhere?

2008-05-20 Thread Kenneth McDonald

Is there a downloadable example of a Django site that illustrates the  
various things one needs to do to get the various aspects of a Django  
site working? In my case, I still don't have ModelForms working, and a  
complete, simple example would be better than all the descriptive  
prose that could be written about this.

Thanks,
Ken

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django newbie with an install problem - bad interpreter

2008-05-20 Thread lorax

That worked!

So adding "python" to the front of the command seems to be the trick.
Perhaps I should add a symlink to point to where Python lives?



On May 20, 9:30 am, Marco Buttu <[EMAIL PROTECTED]> wrote:
> On Tue, 2008-05-20 at 05:23 -0700, lorax wrote:
> > I tried to execute the command django-admin.py startproject mysite.
> > That gave me an error:
>
> > -sh: /usr/local/Django-0.96.2/django/bin/django-admin.py: /usr/bin/
> > env: bad interpreter: No such file or directory
>
> > I thought my symlink might be bad so I tried executing the command
> > using the full path to django-admin.py which gave me the same message.
>
> You can try without use env:
>
> python /usr/local/Django-0.96.2/django/bin/django-admin.py startproject
> mysite
>
> --
> Marco Buttu
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django newbie with an install problem - bad interpreter

2008-05-20 Thread Karen Tracey
On Tue, May 20, 2008 at 9:29 AM, lorax <[EMAIL PROTECTED]> wrote:

>
> Re: break python scripts.
>
> This is my first foray into Python so other than Django, I'm not sure
> what I'd break. And I'm not sure what you mean by patch django-
> admin.py to point to where env is.
>
> Thanks for you help.
>

re: patching django-admin

You could change the first line of django-admin.py from:

#!/usr/bin/env python

to

#!/bin/env python

Or, as Marco says you could preface the script name with 'python' and avoid
the whole issue.  The first line is just trying to get the shell to find the
appropriate python command to run in order to execute the script, if you run
python directly the first line is ignored (since it's a python comment).

re: breaking python

I wasn't saying you would break anything, I was saying the hosting provider
has caused things to break by putting env in a non-standard place.  Lots of
python scripts use that first line, and apparently none of them will work on
your hosting provider's setup because they've placed env in a non-standard
location.

Karen


>
>
>
> On May 20, 9:27 am, lorax <[EMAIL PROTECTED]> wrote:
> > Seems it's in /bin/env
> >
> > On May 20, 9:22 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> >
> > > On Tue, May 20, 2008 at 9:17 AM, lorax <[EMAIL PROTECTED]> wrote:
> >
> > > > BUT!
> >
> > > > env --help DID work
> >
> > > Hmm.  So env is in some non-standard place?  What does "which env"
> show?
> >
> > > You could patch your django-admin.py to point to where your host has
> put
> > > env.  It's a bit odd for it not to be in /usr/bin, though -- this is
> going
> > > to break plenty of python scripts that assume /usr/bin/env will be
> there.
> >
> > > Karen
> >
> > > > On May 20, 9:01 am, "Gregg Banse" <[EMAIL PROTECTED]> wrote:
> > > > > Hi Karen,
> > > > > Thanks for the response.
> >
> > > > > The system didn't like that command. - No such file or directory.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: moving from MySQL to PostgreSQL on a "live" site ..

2008-05-20 Thread oliver

Thanks for all the advice! I think django could probably do with a
little tool like this when dumping or importing data.

Is the boolean field the only odd one out? or is there any thing else
that needs chanaging? Date fields? datetime?

Thanks again!

On May 20, 12:54 pm, George Vilches <[EMAIL PROTECTED]> wrote:
> Hanne Moa wrote:
> > I have a filter that makes django's json-dumps more human-readable, by
> > adding a newline after every occurence of "}},". Running such a filter
> > first would make for short and snappy lines for the rewriting filter:
>
> > python manage.py dumpdata | prettifyjson | fixbooleans > postgres_safe.json
>
> You could also prettify the JSON by just using:
>
> python manage.py dumpdata --indent=4
>
> gav
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: postgresql 8.3 and ILIKE

2008-05-20 Thread Gacha

Thanks, this helped. I already wrote another workaround, but this is
smoother.

On May 20, 3:43 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Tue, May 20, 2008 at 7:03 AM, Gacha <[EMAIL PROTECTED]> wrote:
>
> > I changed the line, but I got the same error :(
>
> Also see this ticket:
>
> http://code.djangoproject.com/ticket/6523
>
> which has an alternative patch and more discussion of what is going on.  I
> don't think it's been decided what to do about fixing this, though.
>
> Karen
>
>
>
> > Traceback (most recent call last):
>
> >  File "/usr/lib/python2.5/site-packages/django/core/handlers/
> > base.py", line 82, in get_response
> >response = callback(request, *callback_args, **callback_kwargs)
>
> >  File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/
> > decorators.py", line 62, in _checklogin
> >return view_func(request, *args, **kwargs)
>
> >  File "/usr/lib/python2.5/site-packages/django/views/decorators/
> > cache.py", line 44, in _wrapped_view_func
> >response = view_func(request, *args, **kwargs)
>
> >  File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/
> > main.py", line 334, in change_stage
> >errors = manipulator.get_validation_errors(new_data)
>
> >  File "/usr/lib/python2.5/site-packages/django/oldforms/__init__.py",
> > line 62, in get_validation_errors
> >errors.update(field.get_validation_errors(new_data))
>
> >  File "/usr/lib/python2.5/site-packages/django/oldforms/__init__.py",
> > line 379, in get_validation_errors
> >self.run_validator(new_data, validator)
>
> >  File "/usr/lib/python2.5/site-packages/django/oldforms/__init__.py",
> > line 369, in run_validator
> >validator(new_data.get(self.field_name, ''), new_data)
>
> >  File "/usr/lib/python2.5/site-packages/django/utils/functional.py",
> > line 55, in _curried
> >return _curried_func(*(args+moreargs), **dict(kwargs,
> > **morekwargs))
>
> >  File "/usr/lib/python2.5/site-packages/django/db/models/
> > manipulators.py", line 302, in manipulator_validator_unique_together
> >old_obj = self.manager.get(**kwargs)
>
> >  File "/usr/lib/python2.5/site-packages/django/db/models/manager.py",
> > line 82, in get
> >return self.get_query_set().get(*args, **kwargs)
>
> >  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
> > line 192, in get
> >num = len(clone)
>
> >  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
> > line 53, in __len__
> >self._result_cache = list(self.iterator())
>
> >  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
> > line 162, in iterator
> >for row in self.query.results_iter():
>
> >  File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> > query.py", line 200, in results_iter
> >for rows in self.execute_sql(MULTI):
>
> >  File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> > query.py", line 1466, in execute_sql
> >cursor.execute(sql, params)
>
> > ProgrammingError: operator does not exist: smallint ~~* unknown
> > LINE 1: ...js_id" = '6537'  AND "assort_apstlaiks"."a_diena" ILIKE
> > '4'
> >  ^
> > HINT:  No operator matches the given name and argument type(s). You
> > might need to add explicit type casts.
>
> > On May 20, 1:23 pm, "Scott Moonen" <[EMAIL PROTECTED]> wrote:
> > > Gacha, see my bug report and a possible fix (it is currently working for
> > me)
> > > at:
>
> > >http://code.djangoproject.com/ticket/7197
>
> > >   -- Scott
>
> > > On Tue, May 20, 2008 at 4:14 AM, Gacha <[EMAIL PROTECTED]> wrote:
>
> > > > I upgraded Postgresql to 8.3 version and got an error in admin:
>
> > > >ProgrammingError: operator does not exist: smallint ~~* unknown
> > > >LINE 1: ...js_id" = '6538'  AND "assort_apstlaiks"."a_diena" ILIKE
> > > > '2'
> > > > ^
> > > >HINT:  No operator matches the given name and argument type(s).
> > > > You might need to add explicit type casts.
>
> > > > The field "a_diena" is an integer and from 8.3 version as changelog
> > > > says "Non-character data types are no longer automatically cast to
> > > > TEXT", so this sounds like bug.
>
> > > --http://scott.andstuff.org/|http://truthadorned.org/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django newbie with an install problem - bad interpreter

2008-05-20 Thread Marco Buttu

On Tue, 2008-05-20 at 05:23 -0700, lorax wrote:

> I tried to execute the command django-admin.py startproject mysite.
> That gave me an error:
> 
> -sh: /usr/local/Django-0.96.2/django/bin/django-admin.py: /usr/bin/
> env: bad interpreter: No such file or directory
> 
> I thought my symlink might be bad so I tried executing the command
> using the full path to django-admin.py which gave me the same message.

You can try without use env:

python /usr/local/Django-0.96.2/django/bin/django-admin.py startproject
mysite

-- 
Marco Buttu


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django newbie with an install problem - bad interpreter

2008-05-20 Thread lorax

Re: break python scripts.

This is my first foray into Python so other than Django, I'm not sure
what I'd break. And I'm not sure what you mean by patch django-
admin.py to point to where env is.

Thanks for you help.



On May 20, 9:27 am, lorax <[EMAIL PROTECTED]> wrote:
> Seems it's in /bin/env
>
> On May 20, 9:22 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>
> > On Tue, May 20, 2008 at 9:17 AM, lorax <[EMAIL PROTECTED]> wrote:
>
> > > BUT!
>
> > > env --help DID work
>
> > Hmm.  So env is in some non-standard place?  What does "which env" show?
>
> > You could patch your django-admin.py to point to where your host has put
> > env.  It's a bit odd for it not to be in /usr/bin, though -- this is going
> > to break plenty of python scripts that assume /usr/bin/env will be there.
>
> > Karen
>
> > > On May 20, 9:01 am, "Gregg Banse" <[EMAIL PROTECTED]> wrote:
> > > > Hi Karen,
> > > > Thanks for the response.
>
> > > > The system didn't like that command. - No such file or directory.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django newbie with an install problem - bad interpreter

2008-05-20 Thread lorax

Seems it's in /bin/env

On May 20, 9:22 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Tue, May 20, 2008 at 9:17 AM, lorax <[EMAIL PROTECTED]> wrote:
>
> > BUT!
>
> > env --help DID work
>
> Hmm.  So env is in some non-standard place?  What does "which env" show?
>
> You could patch your django-admin.py to point to where your host has put
> env.  It's a bit odd for it not to be in /usr/bin, though -- this is going
> to break plenty of python scripts that assume /usr/bin/env will be there.
>
> Karen
>
> > On May 20, 9:01 am, "Gregg Banse" <[EMAIL PROTECTED]> wrote:
> > > Hi Karen,
> > > Thanks for the response.
>
> > > The system didn't like that command. - No such file or directory.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django newbie with an install problem - bad interpreter

2008-05-20 Thread Karen Tracey
On Tue, May 20, 2008 at 9:17 AM, lorax <[EMAIL PROTECTED]> wrote:

>
> BUT!
>
> env --help DID work
>

Hmm.  So env is in some non-standard place?  What does "which env" show?

You could patch your django-admin.py to point to where your host has put
env.  It's a bit odd for it not to be in /usr/bin, though -- this is going
to break plenty of python scripts that assume /usr/bin/env will be there.

Karen


> On May 20, 9:01 am, "Gregg Banse" <[EMAIL PROTECTED]> wrote:
> > Hi Karen,
> > Thanks for the response.
> >
> > The system didn't like that command. - No such file or directory.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django newbie with an install problem - bad interpreter

2008-05-20 Thread lorax

BUT!

env --help DID work

On May 20, 9:01 am, "Gregg Banse" <[EMAIL PROTECTED]> wrote:
> Hi Karen,
> Thanks for the response.
>
> The system didn't like that command. - No such file or directory.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



RE: django newbie with an install problem - bad interpreter

2008-05-20 Thread Gregg Banse
Hi Karen,
Thanks for the response.

The system didn't like that command. - No such file or directory.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using ModelForm...not populating my choices

2008-05-20 Thread chylld

I have exactly the same problem; I just want to fill the ChoiceField
with a certain subset of choices based on the current user. Have you
found a way to do this??

Jonathan


On Apr 10, 7:21 am, ydjango <[EMAIL PROTECTED]> wrote:
> Yes, They are defined in model as
>
> owner = models.ForeignKey(Participant,null=True)
>
> all I want is to display only the Partcipants for a particular group
> in the choice field ( not all participants)
>  and I am so frustrated now.
>
> eg. Participant.objects.filter(group__exact=my_group)]
>
> thanks
> Ashish
>
> On Apr 9, 2:15 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
>
> > On Wed, Apr 9, 2008 at 3:30 PM, ydjango <[EMAIL PROTECTED]> wrote:
> > >  Miles and Owner are defined as foreign_key to respective tables.
>
> > Yes, but did you actually look at the docs for the field types that
> > make it easy to represent foreign keys?
>
> > --
> > "Bureaucrat Conrad, you are technically correct -- the best kind of correct.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django newbie with an install problem - bad interpreter

2008-05-20 Thread Karen Tracey
On Tue, May 20, 2008 at 8:23 AM, lorax <[EMAIL PROTECTED]> wrote:

>
> I've just got the keys to Django 0.96.2 on a semi-dedicated server at
> WestHost. Largely spurred on by the receipt of the first of 4 Django
> books. I fetched a copy of the download using wget and untarred the
> file right from the command line on the server. I then attempted to
> add django-admin.py to the server path and restarted the server. Then
> I tried to execute the command django-admin.py startproject mysite.
> That gave me an error:
>
> -sh: /usr/local/Django-0.96.2/django/bin/django-admin.py: /usr/bin/
> env: bad interpreter: No such file or directory
>
> I thought my symlink might be bad so I tried executing the command
> using the full path to django-admin.py which gave me the same message.
> Since the files never touched a Windows machine could I still have a
> hidden character in there? If so, how do I get rid of it? Or what else
> might be the issue.
>
>
django-admin.py is trying to run /usr/bin/env to launch python.  It sounds
like your host does not have /usr/bin/env?  What happens if you try the
command:

/usr/bin/env --help

from a command prompt?

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Apache (and dev server) throws "connection reset" when accessing pages via IE 6

2008-05-20 Thread Rishabh Manocha

Hey Guys,

I have just deployed my code to my test server (from my laptop) and
setup apache/mod_python to serve the pages. Everything works just fine
when I work with Firefox, but whenever I access my pages using IE 6, I
keep getting the following errors in the apache error logs:

[Tue May 20 17:59:43 2008] [notice] mod_python: (Re)importing module
'django.core.handlers.modpython'
[Tue May 20 17:59:45 2008] [notice] mod_python: (Re)importing module
'django.core.handlers.modpython'
[Tue May 20 17:59:45 2008] [notice] mod_python: (Re)importing module
'django.core.handlers.modpython'
[Tue May 20 17:59:45 2008] [notice] mod_python: (Re)importing module
'django.core.handlers.modpython'
[Tue May 20 17:59:45 2008] [info] [client 146.208.137.89]
(104)Connection reset by peer: core_output_filter: writing data to the
network
[Tue May 20 17:59:45 2008] [info] [client 146.208.137.89] (32)Broken
pipe: core_output_filter: writing data to the network

This results in my forms being thrown off the tracks and I end up
getting weird form results (going by the data being saved to the DB).

I am using apache 2.0 and mod_python 3.2:
httpd-2.2.3-6.el5
mod_python-3.2.8-3.1

My apache configuration is:

SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE MyProject.settings
SetEnv PYTHON_EGG_CACHE /tmp/python-eggs
PythonDebug On
PythonPath "['/opt/proj'] + sys.path"



I get a similar error using the dev server:

Exception happened during processing of request from ('127.0.0.1', 2144)
Traceback (most recent call last):
  File "C:\Python25\lib\SocketServer.py", line 222, in handle_request
self.process_request(request, client_address)
  File "C:\Python25\lib\SocketServer.py", line 241, in process_request
self.finish_request(request, client_address)
  File "C:\Python25\lib\SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File "C:\Python25\Lib\site-packages\django\core\servers\basehttp.py",
line 554, in __init__
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
  File "C:\Python25\lib\SocketServer.py", line 522, in __init__
self.handle()
  File "C:\Python25\Lib\site-packages\django\core\servers\basehttp.py",
line 594, in handle
self.raw_requestline = self.rfile.readline()
  File "C:\Python25\lib\socket.py", line 346, in readline
data = self._sock.recv(self._rbufsize)
error: (10054, 'Connection reset by peer')

I read [1] where this guy had a similar problem but fixed it by
changing his proxy settings to make it such that going to localhost
does not take a route via the proxy. Trying the same thing did not
help in my case.

I was hoping someone else would have run into this problem and could
suggest a solution.

Many thanks,

Rishabh

[1] - 
http://groups.google.com/group/django-users/browse_thread/thread/bfb25d10aa51ed2/3272996e2ea13fd3

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: postgresql 8.3 and ILIKE

2008-05-20 Thread Karen Tracey
On Tue, May 20, 2008 at 7:03 AM, Gacha <[EMAIL PROTECTED]> wrote:

>
> I changed the line, but I got the same error :(
>

Also see this ticket:

http://code.djangoproject.com/ticket/6523

which has an alternative patch and more discussion of what is going on.  I
don't think it's been decided what to do about fixing this, though.

Karen



>
> Traceback (most recent call last):
>
>  File "/usr/lib/python2.5/site-packages/django/core/handlers/
> base.py", line 82, in get_response
>response = callback(request, *callback_args, **callback_kwargs)
>
>  File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/
> decorators.py", line 62, in _checklogin
>return view_func(request, *args, **kwargs)
>
>  File "/usr/lib/python2.5/site-packages/django/views/decorators/
> cache.py", line 44, in _wrapped_view_func
>response = view_func(request, *args, **kwargs)
>
>  File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/
> main.py", line 334, in change_stage
>errors = manipulator.get_validation_errors(new_data)
>
>  File "/usr/lib/python2.5/site-packages/django/oldforms/__init__.py",
> line 62, in get_validation_errors
>errors.update(field.get_validation_errors(new_data))
>
>  File "/usr/lib/python2.5/site-packages/django/oldforms/__init__.py",
> line 379, in get_validation_errors
>self.run_validator(new_data, validator)
>
>  File "/usr/lib/python2.5/site-packages/django/oldforms/__init__.py",
> line 369, in run_validator
>validator(new_data.get(self.field_name, ''), new_data)
>
>  File "/usr/lib/python2.5/site-packages/django/utils/functional.py",
> line 55, in _curried
>return _curried_func(*(args+moreargs), **dict(kwargs,
> **morekwargs))
>
>  File "/usr/lib/python2.5/site-packages/django/db/models/
> manipulators.py", line 302, in manipulator_validator_unique_together
>old_obj = self.manager.get(**kwargs)
>
>  File "/usr/lib/python2.5/site-packages/django/db/models/manager.py",
> line 82, in get
>return self.get_query_set().get(*args, **kwargs)
>
>  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
> line 192, in get
>num = len(clone)
>
>  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
> line 53, in __len__
>self._result_cache = list(self.iterator())
>
>  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
> line 162, in iterator
>for row in self.query.results_iter():
>
>  File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> query.py", line 200, in results_iter
>for rows in self.execute_sql(MULTI):
>
>  File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> query.py", line 1466, in execute_sql
>cursor.execute(sql, params)
>
> ProgrammingError: operator does not exist: smallint ~~* unknown
> LINE 1: ...js_id" = '6537'  AND "assort_apstlaiks"."a_diena" ILIKE
> '4'
>  ^
> HINT:  No operator matches the given name and argument type(s). You
> might need to add explicit type casts.
>
>
>
> On May 20, 1:23 pm, "Scott Moonen" <[EMAIL PROTECTED]> wrote:
> > Gacha, see my bug report and a possible fix (it is currently working for
> me)
> > at:
> >
> > http://code.djangoproject.com/ticket/7197
> >
> >   -- Scott
> >
> >
> >
> > On Tue, May 20, 2008 at 4:14 AM, Gacha <[EMAIL PROTECTED]> wrote:
> >
> > > I upgraded Postgresql to 8.3 version and got an error in admin:
> >
> > >ProgrammingError: operator does not exist: smallint ~~* unknown
> > >LINE 1: ...js_id" = '6538'  AND "assort_apstlaiks"."a_diena" ILIKE
> > > '2'
> > > ^
> > >HINT:  No operator matches the given name and argument type(s).
> > > You might need to add explicit type casts.
> >
> > > The field "a_diena" is an integer and from 8.3 version as changelog
> > > says "Non-character data types are no longer automatically cast to
> > > TEXT", so this sounds like bug.
> >
> > --http://scott.andstuff.org/|http://truthadorned.org/
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Help me build my site with answers to my questions from models to newsletters everybody view this at least once

2008-05-20 Thread sebey

OK so as you may see I have a lot of questions in helping build my
django project so here they are

   1. with models do just create the fields that you need?
   2. how can I import rss feeds(i am running a podcast network) from
other sites/soures?(models,views,admin etc)
   3. I want to make an email newsletter and I want to know how to
make an email list in django?
 1. I want this to work that django grabs the latest entry in
the feed and grabs the  tags etc.
 2. also maybe have django make extra boxs for typing text
in
   4. also I need to make a calender I am planning to use google
calender cause of ical feeds and things like that can I print these
off (an other app maybe)?


thank you
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Admin Site - How to view data in table, when insert/update/delete are removed for a user/group on a specified table

2008-05-20 Thread Karen Tracey
On Tue, May 20, 2008 at 6:30 AM, Lalit Kapoor <[EMAIL PROTECTED]> wrote:

>
> In the Django Admin Site is there anyway to enable a user/group to
> view the data in a table, when insert/update/delete have been disabled
> for the user/group? If so, how would I go about doing this? Thanks.
>

Admin's use of permissions is described here:

http://www.djangoproject.com/documentation/authentication/#permissions

You can disable insert/delete by giving a user/group only change permission,
but I don't see any way to allow a user to see table data without also being
able to update it.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django newbie with an install problem - bad interpreter

2008-05-20 Thread lorax

I've just got the keys to Django 0.96.2 on a semi-dedicated server at
WestHost. Largely spurred on by the receipt of the first of 4 Django
books. I fetched a copy of the download using wget and untarred the
file right from the command line on the server. I then attempted to
add django-admin.py to the server path and restarted the server. Then
I tried to execute the command django-admin.py startproject mysite.
That gave me an error:

-sh: /usr/local/Django-0.96.2/django/bin/django-admin.py: /usr/bin/
env: bad interpreter: No such file or directory

I thought my symlink might be bad so I tried executing the command
using the full path to django-admin.py which gave me the same message.
Since the files never touched a Windows machine could I still have a
hidden character in there? If so, how do I get rid of it? Or what else
might be the issue.

TIA Gregg
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: problems with python setup.py build

2008-05-20 Thread Karen Tracey
On Tue, May 20, 2008 at 5:58 AM, Wim <[EMAIL PROTECTED]> wrote:

>
> Hello,
>
> This is my first attempt to install Django on Ubuntu 8.04 with
> PostgreSQL. It's all quite new for me. I'm pretty new to Ubuntu, I
> have some programming experiences with Python and I'm totally new to
> Django. I have used databases (Informix, DB2) for a long time, but not
> PostgreSQL.
>
> I have installed Django and PostgreSQL without problems But i keep
> having trouble installing psycopg2.
> error: psycopg requires a datetime module:
> error: mx.DateTime module not found
> error: python datetime module not found
> error: Note that psycopg needs the module headers and not just the
> module
> error: itself. If you installed Python or mx.DateTime from a binary
> package
> error: you probably need to install its companion -dev or -devel
> package.


It sounds like you are trying to build psycopg2 from source instead of just
installing a pre-built binary.  Why not just install this:

http://packages.ubuntu.com/hardy/python/python-psycopg2

?

So i did
>
> sudo apt-get install libpq-dev
>

> But that didn't help.
>

libpq is the C client library for PostgreSQL so no, its dev package wouldn't
help here.  I believe the error message was telling you to install the
python-dev package (or the dev package for mx.DateTime, but I don't know
what that's called), so as to get the headers needed to build Python
extensions like psycopg2.  So, if you really want to build psycopg2 instead
of just installing a pre-built binary, try again after installing
python-dev.  But using the prebuilt binary is generally easier.

Karen


> I looked for any DateTime files, i found /proc/7882/cwd/psycopg/
> adapter_mxdatetime.h (right one ??)
> I wrote this in psycopg2-2.0.7/setup.cfg
> # If the build system does not find the mx.DateTime headers, try
> # uncommenting the following line and setting its value to the right
> path.
> mx_include_dir=/proc/7882/cwd/psycopg/
>
> The install stopped complaining about the mx.DateTime, but gave me
> some new ones, about 120 lines of (mostly) errors and warnings.
>
> $ python setup.py build
> running build
> running build_py
> running build_ext
> building 'psycopg2._psycopg' extension
> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -
> Wstrict-prototypes -fPIC -DPY_MAJOR_VERSION=2 -DPY_MINOR_VERSION=5 -
> DHAVE_PYBOOL=1 -DHAVE_DECIMAL=1 -DHAVE_MXDATETIME=1 -
> DPSYCOPG_DEFAULT_MXDATETIME=1 -DPSYCOPG_VERSION="2.0.7 (dec mx ext
> pq3)" -DPG_MAJOR_VERSION=8 -DPG_MINOR_VERSION=3 -DPG_PATCH_VERSION=1 -
> DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -
> DHAVE_PQPROTOCOL3=1 -I/proc/7882/cwd/psycopg/ -I/usr/include/python2.5
> -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.3/server -c
> psycopg/psycopgmodule.c -o build/temp.linux-i686-2.5/psycopg/
> psycopgmodule.o
> psycopg/psycopgmodule.c:23:20: fout: Python.h: File or directory does
> not exist
> In bestand ingevoegd vanuit psycopg/psycopgmodule.c:27:
> ./psycopg/python.h:27:26: fout: structmember.h: File or directory does
> not exist
> In file included from psycopg/psycopgmodule.c:28:
> ./psycopg/psycopg.h:84: internal error expected ')' before '*' token
> ./psycopg/psycopg.h:85: internal error expected ')' before '*' token
> ./psycopg/psycopg.h:88: internal error expected '=', ',', ';', 'asm'
> or '__attribute__' before '*' token
> ./psycopg/psycopg.h:92: internal error expected '=', ',', ';', 'asm'
> or '__attribute__' before '*' token
> ./psycopg/psycopg.h:131: internal error expected '=', ',', ';', 'asm'
> or '__attribute__' before '*' token
> ./psycopg/psycopg.h:139: internal error expected '=', ',', ';', 'asm'
> or '__attribute__' before '*' token
> ./psycopg/psycopg.h:142: internal error expected ')' before '*' token
> In file included from psycopg/psycopgmodule.c:29:
> 
>
> With kind regards
> Wim
>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: moving from MySQL to PostgreSQL on a "live" site ..

2008-05-20 Thread George Vilches

Hanne Moa wrote:
> I have a filter that makes django's json-dumps more human-readable, by
> adding a newline after every occurence of "}},". Running such a filter
> first would make for short and snappy lines for the rewriting filter:
> 
> python manage.py dumpdata | prettifyjson | fixbooleans > postgres_safe.json

You could also prettify the JSON by just using:

python manage.py dumpdata --indent=4

gav

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: can't compare datetime.datetime to datetime.date

2008-05-20 Thread Ben Firshman

The date() method of the datetime object is what you probably want.  
See the documentation:

http://docs.python.org/lib/datetime-datetime.html

Ben

On 20 May 2008, at 09:56, vance ma wrote:

> In django ;How to compare datetime.datetime and datetime.date
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with Querydict

2008-05-20 Thread Matthias Kestenholz

On Tue, 2008-05-20 at 03:31 -0700, mwebs wrote:
> Sorry, but this does not work. Maybe I am doing some mistakes.
> Could you please post me a snippet?
> 

http://www.djangoproject.com/documentation/request_response/#querydict-objects

request.POST.getlist('elems')



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: postgresql 8.3 and ILIKE

2008-05-20 Thread Gacha

I changed the line, but I got the same error :(

Traceback (most recent call last):

  File "/usr/lib/python2.5/site-packages/django/core/handlers/
base.py", line 82, in get_response
response = callback(request, *callback_args, **callback_kwargs)

  File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/
decorators.py", line 62, in _checklogin
return view_func(request, *args, **kwargs)

  File "/usr/lib/python2.5/site-packages/django/views/decorators/
cache.py", line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)

  File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/
main.py", line 334, in change_stage
errors = manipulator.get_validation_errors(new_data)

  File "/usr/lib/python2.5/site-packages/django/oldforms/__init__.py",
line 62, in get_validation_errors
errors.update(field.get_validation_errors(new_data))

  File "/usr/lib/python2.5/site-packages/django/oldforms/__init__.py",
line 379, in get_validation_errors
self.run_validator(new_data, validator)

  File "/usr/lib/python2.5/site-packages/django/oldforms/__init__.py",
line 369, in run_validator
validator(new_data.get(self.field_name, ''), new_data)

  File "/usr/lib/python2.5/site-packages/django/utils/functional.py",
line 55, in _curried
return _curried_func(*(args+moreargs), **dict(kwargs,
**morekwargs))

  File "/usr/lib/python2.5/site-packages/django/db/models/
manipulators.py", line 302, in manipulator_validator_unique_together
old_obj = self.manager.get(**kwargs)

  File "/usr/lib/python2.5/site-packages/django/db/models/manager.py",
line 82, in get
return self.get_query_set().get(*args, **kwargs)

  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
line 192, in get
num = len(clone)

  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
line 53, in __len__
self._result_cache = list(self.iterator())

  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
line 162, in iterator
for row in self.query.results_iter():

  File "/usr/lib/python2.5/site-packages/django/db/models/sql/
query.py", line 200, in results_iter
for rows in self.execute_sql(MULTI):

  File "/usr/lib/python2.5/site-packages/django/db/models/sql/
query.py", line 1466, in execute_sql
cursor.execute(sql, params)

ProgrammingError: operator does not exist: smallint ~~* unknown
LINE 1: ...js_id" = '6537'  AND "assort_apstlaiks"."a_diena" ILIKE
'4'
 ^
HINT:  No operator matches the given name and argument type(s). You
might need to add explicit type casts.



On May 20, 1:23 pm, "Scott Moonen" <[EMAIL PROTECTED]> wrote:
> Gacha, see my bug report and a possible fix (it is currently working for me)
> at:
>
> http://code.djangoproject.com/ticket/7197
>
>   -- Scott
>
>
>
> On Tue, May 20, 2008 at 4:14 AM, Gacha <[EMAIL PROTECTED]> wrote:
>
> > I upgraded Postgresql to 8.3 version and got an error in admin:
>
> >ProgrammingError: operator does not exist: smallint ~~* unknown
> >LINE 1: ...js_id" = '6538'  AND "assort_apstlaiks"."a_diena" ILIKE
> > '2'
> > ^
> >HINT:  No operator matches the given name and argument type(s).
> > You might need to add explicit type casts.
>
> > The field "a_diena" is an integer and from 8.3 version as changelog
> > says "Non-character data types are no longer automatically cast to
> > TEXT", so this sounds like bug.
>
> --http://scott.andstuff.org/|http://truthadorned.org/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: postgresql 8.3 and ILIKE

2008-05-20 Thread Gacha

Thanks, I hope this bug will be fixed.

On May 20, 1:23 pm, "Scott Moonen" <[EMAIL PROTECTED]> wrote:
> Gacha, see my bug report and a possible fix (it is currently working for me)
> at:
>
> http://code.djangoproject.com/ticket/7197
>
>   -- Scott
>
>
>
> On Tue, May 20, 2008 at 4:14 AM, Gacha <[EMAIL PROTECTED]> wrote:
>
> > I upgraded Postgresql to 8.3 version and got an error in admin:
>
> >ProgrammingError: operator does not exist: smallint ~~* unknown
> >LINE 1: ...js_id" = '6538'  AND "assort_apstlaiks"."a_diena" ILIKE
> > '2'
> > ^
> >HINT:  No operator matches the given name and argument type(s).
> > You might need to add explicit type casts.
>
> > The field "a_diena" is an integer and from 8.3 version as changelog
> > says "Non-character data types are no longer automatically cast to
> > TEXT", so this sounds like bug.
>
> --http://scott.andstuff.org/|http://truthadorned.org/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with Querydict

2008-05-20 Thread mwebs

Sorry, but this does not work. Maybe I am doing some mistakes.
Could you please post me a snippet?

On 20 Mai, 12:18, Tomás Garzón Hervás <[EMAIL PROTECTED]> wrote:
> Hi, you must use get_list function on QueryDict
>
> mwebs escribió:
>
>
>
> > Hello,
>
> > I am sending JSON to the serverbackend.
> > When I print reuqest.POST I get .
> > Thats exactly what I was expecting.
>
> > But now I want to access the 'elems'. When I do request.POST['elems']
> > I get'1'.
> > But I was expecting getting 2, 1.
>
> > Thanks for your help.
> > Toni
>
> --
> ---
> Tomás Garzón Hervás
> Director de Desarrollo y Calidad IACTIVE Intelligent Solutions, S.L.
> --
> Teléfono Móvil: 646760508
>
> --
>
> Bussines & Innovation Center (BIC)
> Parque tecnológico de ciencias de la salud
> Avd. de la innovación 1
> C.P. 18100 Armilla (Granada)
>
> ---
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django Admin Site - How to view data in table, when insert/update/delete are removed for a user/group on a specified table

2008-05-20 Thread Lalit Kapoor

In the Django Admin Site is there anyway to enable a user/group to
view the data in a table, when insert/update/delete have been disabled
for the user/group? If so, how would I go about doing this? Thanks.


Sincerely,
Lalit Kapoor
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: IOError: Client read error (Timeout?)

2008-05-20 Thread Graham Dumpleton

Aljosa Mohorovic wrote:
> IOError: Client read error (Timeout?)
>
> sometimes i get this error, any tips on how to handle this kind of
> errors?
> any comment related to this is welcomed.

Generally you can ignore it, it usually indicates that the user
pressed reload on a page or navigated off it before the browser could
send through the whole request.

BTW, it is good idea to mention what hosting mechanism you are using
when you get errors like this. I know this is generated by mod_python,
but the majority wouldn't.

Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: postgresql 8.3 and ILIKE

2008-05-20 Thread Scott Moonen
Gacha, see my bug report and a possible fix (it is currently working for me)
at:

http://code.djangoproject.com/ticket/7197

  -- Scott

On Tue, May 20, 2008 at 4:14 AM, Gacha <[EMAIL PROTECTED]> wrote:

>
> I upgraded Postgresql to 8.3 version and got an error in admin:
>
>ProgrammingError: operator does not exist: smallint ~~* unknown
>LINE 1: ...js_id" = '6538'  AND "assort_apstlaiks"."a_diena" ILIKE
> '2'
> ^
>HINT:  No operator matches the given name and argument type(s).
> You might need to add explicit type casts.
>
> The field "a_diena" is an integer and from 8.3 version as changelog
> says "Non-character data types are no longer automatically cast to
> TEXT", so this sounds like bug.
> >
>


-- 
http://scott.andstuff.org/ | http://truthadorned.org/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with Querydict

2008-05-20 Thread Tomás Garzón Hervás

Hi, you must use get_list function on QueryDict

mwebs escribió:
> Hello,
>
> I am sending JSON to the serverbackend.
> When I print reuqest.POST I get .
> Thats exactly what I was expecting.
>
> But now I want to access the 'elems'. When I do request.POST['elems']
> I get'1'.
> But I was expecting getting 2, 1.
>
> Thanks for your help.
> Toni
>
>
> >
>
>   


-- 
---
Tomás Garzón Hervás
Director de Desarrollo y Calidad IACTIVE Intelligent Solutions, S.L.
--
Teléfono Móvil: 646760508

--

Bussines & Innovation Center (BIC)
Parque tecnológico de ciencias de la salud
Avd. de la innovación 1
C.P. 18100 Armilla (Granada)

---


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problem with Querydict

2008-05-20 Thread mwebs

Hello,

I am sending JSON to the serverbackend.
When I print reuqest.POST I get .
Thats exactly what I was expecting.

But now I want to access the 'elems'. When I do request.POST['elems']
I get'1'.
But I was expecting getting 2, 1.

Thanks for your help.
Toni


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



problems with python setup.py build

2008-05-20 Thread Wim

Hello,

This is my first attempt to install Django on Ubuntu 8.04 with
PostgreSQL. It's all quite new for me. I'm pretty new to Ubuntu, I
have some programming experiences with Python and I'm totally new to
Django. I have used databases (Informix, DB2) for a long time, but not
PostgreSQL.

I have installed Django and PostgreSQL without problems But i keep
having trouble installing psycopg2.
error: psycopg requires a datetime module:
error: mx.DateTime module not found
error: python datetime module not found
error: Note that psycopg needs the module headers and not just the
module
error: itself. If you installed Python or mx.DateTime from a binary
package
error: you probably need to install its companion -dev or -devel
package.

So i did

sudo apt-get install libpq-dev

But that didn't help.

I looked for any DateTime files, i found /proc/7882/cwd/psycopg/
adapter_mxdatetime.h (right one ??)
I wrote this in psycopg2-2.0.7/setup.cfg
# If the build system does not find the mx.DateTime headers, try
# uncommenting the following line and setting its value to the right
path.
mx_include_dir=/proc/7882/cwd/psycopg/

The install stopped complaining about the mx.DateTime, but gave me
some new ones, about 120 lines of (mostly) errors and warnings.

$ python setup.py build
running build
running build_py
running build_ext
building 'psycopg2._psycopg' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -
Wstrict-prototypes -fPIC -DPY_MAJOR_VERSION=2 -DPY_MINOR_VERSION=5 -
DHAVE_PYBOOL=1 -DHAVE_DECIMAL=1 -DHAVE_MXDATETIME=1 -
DPSYCOPG_DEFAULT_MXDATETIME=1 -DPSYCOPG_VERSION="2.0.7 (dec mx ext
pq3)" -DPG_MAJOR_VERSION=8 -DPG_MINOR_VERSION=3 -DPG_PATCH_VERSION=1 -
DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -
DHAVE_PQPROTOCOL3=1 -I/proc/7882/cwd/psycopg/ -I/usr/include/python2.5
-I. -I/usr/include/postgresql -I/usr/include/postgresql/8.3/server -c
psycopg/psycopgmodule.c -o build/temp.linux-i686-2.5/psycopg/
psycopgmodule.o
psycopg/psycopgmodule.c:23:20: fout: Python.h: File or directory does
not exist
In bestand ingevoegd vanuit psycopg/psycopgmodule.c:27:
./psycopg/python.h:27:26: fout: structmember.h: File or directory does
not exist
In file included from psycopg/psycopgmodule.c:28:
./psycopg/psycopg.h:84: internal error expected ‘)’ before ‘*’ token
./psycopg/psycopg.h:85: internal error expected ‘)’ before ‘*’ token
./psycopg/psycopg.h:88: internal error expected ‘=’, ‘,’, ‘;’, ‘asm’
or ‘__attribute__’ before ‘*’ token
./psycopg/psycopg.h:92: internal error expected ‘=’, ‘,’, ‘;’, ‘asm’
or ‘__attribute__’ before ‘*’ token
./psycopg/psycopg.h:131: internal error expected ‘=’, ‘,’, ‘;’, ‘asm’
or ‘__attribute__’ before ‘*’ token
./psycopg/psycopg.h:139: internal error expected ‘=’, ‘,’, ‘;’, ‘asm’
or ‘__attribute__’ before ‘*’ token
./psycopg/psycopg.h:142: internal error expected ‘)’ before ‘*’ token
In file included from psycopg/psycopgmodule.c:29:


With kind regards
Wim



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



IOError: Client read error (Timeout?)

2008-05-20 Thread Aljosa Mohorovic

IOError: Client read error (Timeout?)

sometimes i get this error, any tips on how to handle this kind of
errors?
any comment related to this is welcomed.

Aljosa
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



TreeMenus / Extension - selected item

2008-05-20 Thread martyn

Hi,

I'm trying TreeMenus : http://code.google.com/p/django-treemenus/
It's a realy good job. Thanks to its author.

There is just a little bemol, I don't find the documentation really
excplicit, especially concerning the "Class Extension".


In the doc :

First, define your extension class (or create it if you don't already
have one)
like the following::
class MenuItemExtension(models.Model):
menu_item = models.ForeignKey(MenuItem, unique=True,
editable=False)
selected_patterns = models.TextField(blank=True)


Where to put his code ?
Create a new app in my project ?
Add this new app to my INSTALLED_APPS setting ?
Is this new app can be called "treemenus" ? (no)
The admin views has to be changed ?


This point is not very well documented, it's a shame.
Examples in the package should be great.
Why not integrate selected_patterns in the app ? I think it's a need
for every website.

Thank you.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin : Select category -> show subcategory

2008-05-20 Thread martyn

In fact, at the creation, you select a category, the the
subcategories
are shown. It's OK

/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-
===Create_Object===

Category
[--select_category--]

SubCategory
[--select_subcategory--]

/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-

But, at the modification / edition of an object, I have to set the
right category and the right subcategory.

/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-
===Edit_Object===

Category
[--shoes--]

SubCategory
[--pretty_shoes--]

/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-

All I want is not to right the same javascript code twice
(on_selectlist_change == on_document_ready)
I don't know the better way to do this in django FW.
The only thing I did is to right the same code twice... It's not the
DRY philosophy of Django.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



can't compare datetime.datetime to datetime.date

2008-05-20 Thread vance ma
In django ;How to compare datetime.datetime and datetime.date

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin : Select category -> show subcategory

2008-05-20 Thread martyn

In fact, at the creation, you select a category, the the subcategories
are shown. It's OK
But, a



On 18 mai, 01:22, Diego Ucha <[EMAIL PROTECTED]> wrote:
> You need to set a Subcategory as default when this field is loaded by
> the field Category?
> Sorry Martyn, i didn't get your doubt, could you elaborate more?
>
> On May 13, 2:23 am, martyn <[EMAIL PROTECTED]> wrote:
>
> > It's true, I don't know for what reason I changed this before posting,
> > but I've seen the error to, correct it and, no way.
> > But I made a error on my urls,
> > this /admin/boutique/produit/getsubcategory/ was not the same as
> > urls.py, so I had no response.
>
> > Now I've got another question. I've never used jQuery and I'm also new
> > to django.
> > I can't find the way to don't repeat my self on loading my object and
> > show the subcategory with jQuery.
>
> > On load
> > 1- Load the results for the current category
> > 2- Select the current subcategory
>
> > 
> > $(function(){
> >   $("select#id_categorie").change(function(){
> >     $.getJSON("/admin/boutique/produit/getsubcategory/",{id: $
> > (this).val()}, function(j){
> >      var options = '';
> >       for (var i = 0; i < j.length; i++) {
> >         options += '';
> >       for (var i = 0; i < j.length; i++) {
> >         options += '

Re: moving from MySQL to PostgreSQL on a "live" site ..

2008-05-20 Thread Hanne Moa

On Tue, May 20, 2008 at 10:32 AM, oliver <[EMAIL PROTECTED]> wrote:
> I take it doing via JSON you still need to convert the Boolean fields?
>
> would you know of any kind of scrip that would do it? as my editor
> doenst cope to well with 7mb of xml files :(.
> I guess its not to hard to write if needed.

If you're on linux, there's sed and awk, or you could go ridiculously
old school and build something out of cut, paste, tr, grep, sort, uniq
etc., or you could write a little python filter to do it all for you:

import sys

for line in sys.stdin:
# change the line somehow
print line

or you could write something in perl, or you could...

I have a filter that makes django's json-dumps more human-readable, by
adding a newline after every occurence of "}},". Running such a filter
first would make for short and snappy lines for the rewriting filter:

python manage.py dumpdata | prettifyjson | fixbooleans > postgres_safe.json


HM

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: moving from MySQL to PostgreSQL on a "live" site ..

2008-05-20 Thread oliver

Hi,

I take it doing via JSON you still need to convert the Boolean fields?

would you know of any kind of scrip that would do it? as my editor
doenst cope to well with 7mb of xml files :(.
I guess its not to hard to write if needed.

I do a syncdb than run loaddata, I didnt empty the tables, will do
that thou, makes sence (I thought loaddata overwrite the "tables").

thanks for the info!

On May 19, 7:20 pm, AndrewK <[EMAIL PROTECTED]> wrote:
> AFAIK, you will probably need to do conversion between boolean types
> (in MySQL BooleanField uses 0 and 1, and in PostgreSQL it uses True
> and False).
> I was doing it with JSON. And then you will need to empty all tables
> like django_content_type and auth_permission in the target db or
> exclude them from your dump.
> First method (transfer this tables) is better especially if you were
> doing some tweaking with your db (like adding, removing models)
>
> On May 19, 1:41 am, oliver <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> > I am planning to move from Mysql to PostgreSQL (mainly for transaction
> > support). I just wanted to know if I can take my active django
> > projects (all with lots of data in mysql, with more or less every
> > model field type possible) and do a XML data dump and than just load
> > this into the Postgresql db?
>
> > I have been reading about differences in how Mysql stores boolean
> > fields against Postgresql? Would I need to change any thing in the
> > xml? or does django take care of all this?
>
> > Or is there some "smarter" way of doing this db change over?
>
> > Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



postgresql 8.3 and ILIKE

2008-05-20 Thread Gacha

I upgraded Postgresql to 8.3 version and got an error in admin:

ProgrammingError: operator does not exist: smallint ~~* unknown
LINE 1: ...js_id" = '6538'  AND "assort_apstlaiks"."a_diena" ILIKE
'2'
 ^
HINT:  No operator matches the given name and argument type(s).
You might need to add explicit type casts.

The field "a_diena" is an integer and from 8.3 version as changelog
says "Non-character data types are no longer automatically cast to
TEXT", so this sounds like bug.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: business logic and good practices

2008-05-20 Thread Gene Campbell

Hi,  Thanks the for the reply.

> The reason you must place your templates out from your app code is
> because if you don't do that, anyone could access to the code via
> browser. Just writing the path of your files, and they have the code.
> It could be a security issue.

Umm,  if it doesn't match a url.py re, I don't see how.  Is this an
issue when running under Apache?
I'm currently just using the dev server while learning.

> Finally, not sure about unit testing...

My past experience says test each layer.  But, I suppose I could
probably just test the urls.py, view.py and templates with unit tests
using. the Client object.  This would indirectly test the business
objects and model objects get tested.



> Greets,
>
> On 20 mayo, 03:39, ristretto <[EMAIL PROTECTED]> wrote:
>> Hello, I'm going down the same adoption path.  Coming over from Java
>> skipping and happy.
>>
>> I'm fighting (and loosing) the urge to create a manager.py that will
>> basically hold business logic and interface with the models.
>> Additionally, I have read the unit testing documentation, and I want
>> to make sure I'm following a good practice to get complete test
>> coverage.
>> Finally, I don't see any reason why I shouldn't put the templates in
>> the app directory.  But, I also don't see that recommendations to do
>> so.
>> So, I'm a bit unsure.
>>
>> I'm considering this setup.  Would anyone care to correct me, if I
>> have something not quite right?
>>
>> myproject/
>>   __init__
>>   urls.py
>>   settings.py
>>   manage.py
>>   myapp/
>> models.py
>> model_tests.py - test directly, simulating code that would go in
>> managers.py
>> managers.py  -  in here are classes methods that the view defs
>> call
>> managers_test.py - test directly, simulating code that would go in
>> views.py.
>> views.py
>> view_test.py - tests in here use Client and therefore test urls.py
>> and templates too.  Considering having 1 default tests per def in
>> views.py that would be a sanity/integration test.  Then, any other
>> specific tests that doesn't test functionallity already tested in
>> managers_test.py
>>templates/
>>
>> I like this because the managers.py code organizes the business logic
>> away from the web controller layer, let's me doing specific testing on
>> it, and also decoupling it easily for hook up with GTK or QT or
>> something.  But, it doesn't add another layer of complexity that might
>> not really be necessary.
>>
>> I'm truly sorry if I have asked stupid questions.  I will not be
>> offended if you ignore me.  I'm going to keep reading, and I have
>> lot's of books on order.  I'll sort it all out at some point.
>>
>> cheers!!!
>>
>> On Apr 5, 1:51 am, Doug Van Horn <[EMAIL PROTECTED]> wrote:
>>
>> > I haven't found any 'bestpractices' for Python other than PEP-8 or
>> > the olderhttp://www.python.org/doc/essays/styleguide.html.
>>
>> > Django kind of pre-defines a generalbestpractice of project layout,
>> > but anything outside of models, tests & fixtures, templatetags, et.
>> > al. is up to you (views and settings are not 'required' to be where
>> > they are).
>>
>> > Anyway, it's kind of discomforting at first, coming from J2EE-land
>> > where everything is laid out for you in the core J2EE Patterns book.
>> > "Here are you DAOs, there are your Business Delegates, and over
>> > there's where you keep your transformers and your DTOs"...
>>
>> > In Python/Django, you have to think a little bit more about how you
>> > want to lay things out and where they belong /in your project/.  So
>> > there's not that uniform inter-corporate architecture consistency you
>> > find (or at least I found) when bouncing around in contract gigs for
>> > larger corps.
>>
>> > If it helps, my progression went first from breaking everything up
>> > into small chunks in lots of files and apps (a la one class per file
>> > Java), to now having much bigger modules holding lots of related
>> > concerns (classes and functions).  I think that it's more common in
>> > Python to do this, and it's a lot easier to remember where stuff is.
>>
>> > for what that's worth...
>>
>> > On Apr 3, 11:52 am, bcurtu <[EMAIL PROTECTED]> wrote:
>>
>> > > Thanks Doug,
>>
>> > > Well, yes, I think it's pretty easy to switch to this philosophy, even
>> > > it's hard to come back to java again!
>>
>> > > I will follow my model 1, because it's generic code and it could be
>> > > reusable.
>>
>> > > What about a goodpracticesreference guide... Any suggestion?
>>
>> > > On Apr 3, 4:54 pm, Doug Van Horn <[EMAIL PROTECTED]> wrote:
>>
>> > > > On Apr 3, 9:19 am, bcurtu <[EMAIL PROTECTED]> wrote:
>>
>> > > > > Hi again,
>>
>> > > > > I come form j2ee world, this is my first project in Django and 
>> > > > > usually
>> > > > > I feel a bit lost about general concepts.
>>
>> > > > > My project has bit too much business code, it's a kind of datamining
>> > > > > tool. I have created a set of functions but I'm not sure where  the
>> > > > > 

Re: business logic and good practices

2008-05-20 Thread bcurtu

Hi,

The reason you must place your templates out from your app code is
because if you don't do that, anyone could access to the code via
browser. Just writing the path of your files, and they have the code.
It could be a security issue.

About your managers.py file, it's OK to decouple logic from view and
model. But be careful with the name conventions. A Manager is an
interface to access to DDBB: 
http://www.djangoproject.com/documentation/model-api/#managers

Finally, not sure about unit testing...

Greets,

On 20 mayo, 03:39, ristretto <[EMAIL PROTECTED]> wrote:
> Hello, I'm going down the same adoption path.  Coming over from Java
> skipping and happy.
>
> I'm fighting (and loosing) the urge to create a manager.py that will
> basically hold business logic and interface with the models.
> Additionally, I have read the unit testing documentation, and I want
> to make sure I'm following a good practice to get complete test
> coverage.
> Finally, I don't see any reason why I shouldn't put the templates in
> the app directory.  But, I also don't see that recommendations to do
> so.
> So, I'm a bit unsure.
>
> I'm considering this setup.  Would anyone care to correct me, if I
> have something not quite right?
>
> myproject/
>   __init__
>   urls.py
>   settings.py
>   manage.py
>   myapp/
> models.py
> model_tests.py - test directly, simulating code that would go in
> managers.py
> managers.py  -  in here are classes methods that the view defs
> call
> managers_test.py - test directly, simulating code that would go in
> views.py.
> views.py
> view_test.py - tests in here use Client and therefore test urls.py
> and templates too.  Considering having 1 default tests per def in
> views.py that would be a sanity/integration test.  Then, any other
> specific tests that doesn't test functionallity already tested in
> managers_test.py
>templates/
>
> I like this because the managers.py code organizes the business logic
> away from the web controller layer, let's me doing specific testing on
> it, and also decoupling it easily for hook up with GTK or QT or
> something.  But, it doesn't add another layer of complexity that might
> not really be necessary.
>
> I'm truly sorry if I have asked stupid questions.  I will not be
> offended if you ignore me.  I'm going to keep reading, and I have
> lot's of books on order.  I'll sort it all out at some point.
>
> cheers!!!
>
> On Apr 5, 1:51 am, Doug Van Horn <[EMAIL PROTECTED]> wrote:
>
> > I haven't found any 'bestpractices' for Python other than PEP-8 or
> > the olderhttp://www.python.org/doc/essays/styleguide.html.
>
> > Django kind of pre-defines a generalbestpractice of project layout,
> > but anything outside of models, tests & fixtures, templatetags, et.
> > al. is up to you (views and settings are not 'required' to be where
> > they are).
>
> > Anyway, it's kind of discomforting at first, coming from J2EE-land
> > where everything is laid out for you in the core J2EE Patterns book.
> > "Here are you DAOs, there are your Business Delegates, and over
> > there's where you keep your transformers and your DTOs"...
>
> > In Python/Django, you have to think a little bit more about how you
> > want to lay things out and where they belong /in your project/.  So
> > there's not that uniform inter-corporate architecture consistency you
> > find (or at least I found) when bouncing around in contract gigs for
> > larger corps.
>
> > If it helps, my progression went first from breaking everything up
> > into small chunks in lots of files and apps (a la one class per file
> > Java), to now having much bigger modules holding lots of related
> > concerns (classes and functions).  I think that it's more common in
> > Python to do this, and it's a lot easier to remember where stuff is.
>
> > for what that's worth...
>
> > On Apr 3, 11:52 am, bcurtu <[EMAIL PROTECTED]> wrote:
>
> > > Thanks Doug,
>
> > > Well, yes, I think it's pretty easy to switch to this philosophy, even
> > > it's hard to come back to java again!
>
> > > I will follow my model 1, because it's generic code and it could be
> > > reusable.
>
> > > What about a goodpracticesreference guide... Any suggestion?
>
> > > On Apr 3, 4:54 pm, Doug Van Horn <[EMAIL PROTECTED]> wrote:
>
> > > > On Apr 3, 9:19 am, bcurtu <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi again,
>
> > > > > I come form j2ee world, this is my first project in Django and usually
> > > > > I feel a bit lost about general concepts.
>
> > > > > My project has bit too much business code, it's a kind of datamining
> > > > > tool. I have created a set of functions but I'm not sure where  the
> > > > > "bestpractices" say I should place them...
>
> > > > > 1.- In the same folder as my app (package) is, in a different file:
> > > > > app1/
> > > > > __init__.py
> > > > > models.py
> > > > > views.py
> > > > > datamining.py
>
> > > > > 2.- In the same models.py or views.py file?:
> > > > > app1/
> > > > > 

Re: Trouble installing PIL

2008-05-20 Thread Graham Dumpleton

On May 20, 3:42 pm, Austin Govella <[EMAIL PROTECTED]> wrote:
> It was a PYTHONPATH problem. I fixed it using this tutorial:
> *http://emmby.blogspot.com/2008/05/installing-python-pil-on-mac-os-x-1...
>
> (I'm using python 2.4, so I adjusted the path accordingly.)
>
> Everything validates. Server runs with no ImageField errors, but now
> we get a new ImportError: "No module named ImageFile".
>
> That error corresponds to the closed ticket, #7019:
>  http://code.djangoproject.com/ticket/7019
>
> Mr. Treddinick writes MacPorts doesn't correctly install PIL on os x
> 10.4:
>
> "This isn't a problem with Django. It's a problem with the way PIL is
> installed and should be reported to the packager for fixing. PIL
> should be installed so that the PIL directory is part of the Python
> module search path (normally done via a PIL.pth file) and thus import
> ImageFile must work; otherwise it's installed incorrectly."
>
> Does anyone know how to fix this? What path should I add/edit where?
>
> (And as an aside, I read somewhere that the proper way to import Image
> and ImageFile is to say "from PIL import ImageFile". This works, but
> "import ImageFile" doesn't. Is Django importing incorrectly?)
>
> Many thanks for any tips,

I could be wrong, but the way I have understood things is that initial
PIL people put stuff at global module level. After a while they
possibly realised their evil ways and pushed things into a PIL
package. To maintain compatibility with older way they did things they
add a PIL.pth file containing 'PIL'.

In other words both:

  import Image

and:

  from PIL import Image

work.

I personally would suggest that any code which doesn't import it out
of PIL package should be changed as it is propagating bad practice.

Thus, if Django is saying just:

  import Image

then it probably should be changed.

Anyway, my 2 cents worth.

Graham



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---