Re: PostgreSQL backend - Ident authentication failed?

2010-06-21 Thread Kenneth Gonsalves
On Monday 21 June 2010 12:24:58 Torsten Bronger wrote:
> > Also, is this recommended practice, to use "www-data" as the
> > backend database username?
> 
> No, not recommended, but not forbidden either.
> 

should be forbidden - one does not want apache to have direct access to the 
database
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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



Re: PostgreSQL backend - Ident authentication failed?

2010-06-21 Thread Victor Hooi
heya,

Using "www-data" as the backend database username in settings.py
doesn't quite work. If you try to run a ./manage.py syncdb, it spits
out:

Traceback (most recent call last):
  File "./manage.py", line 11, in 
execute_manager(settings)
  File "/usr/local/lib/python2.6/dist-packages/django/core/
management/__init__.py", line 438, in execute_manager
utility.execute()
  File "/usr/local/lib/python2.6/dist-packages/django/core/
management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.6/dist-packages/django/core/
management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.6/dist-packages/django/core/
management/base.py", line 220, in execute
output = self.handle(*args, **options)
  File "/usr/local/lib/python2.6/dist-packages/django/core/
management/base.py", line 351, in handle
return self.handle_noargs(**options)
  File "/usr/local/lib/python2.6/dist-packages/django/core/
management/commands/syncdb.py", line 52, in handle_noargs
cursor = connection.cursor()
  File "/usr/local/lib/python2.6/dist-packages/django/db/backends/
__init__.py", line 75, in cursor
cursor = self._cursor()
  File "/usr/local/lib/python2.6/dist-packages/django/db/backends/
postgresql_psycopg2/base.py", line 136, in _cursor
self.connection = Database.connect(**conn_params)
psycopg2.OperationalError: FATAL:  Ident authentication failed for
user "www-data"

I've changed the authentication in my pg_hba.conf from "ident" to
"password", and it now works with "victorhooi" as the backend database
username =). So there's no need to use a PostgreSQL www-data account.

I'm still curious what changed? Perhaps Ubuntu's default pg_hba.conf
file changed from 9.04 to 10.04? AFAIK, there wasn't any such change,
although I don't have a 9.04 system around to verify.

Anyhow, is this the recommended configuration, what I have now? Just
want to know the right way of doing things?

Cheers,
Victor

On Jun 21, 4:54 pm, Torsten Bronger 
wrote:
> Hall chen!
>
> Victor Hooi writes:
> > [...]
>
> > However, I'm still curious as to what changed, as I'm fairly sure
> > this setup worked on the old Ubuntu 9.04 server? And I'm
> > definitely sure that the database username was set to "victorhooi"
> > on that old system - I copied the settings.py file over using
> > verbatim (rsync).
>
> Maybe pg_hba.conf has changed.
>
> > Also, is this recommended practice, to use "www-data" as the
> > backend database username?
>
> No, not recommended, but not forbidden either.  We didn't use
> "ident" but "password" in pg_hba.conf.  This way, you are not bound
> to user accounts of the underlying operating system.
>
> But possibly we switch to "ident" for local connections
> (i.e. command line) and "password" for TCP/IP connections.  The
> reason is that passwords make command line scripting harder.
>
> Tsch ,
> Torsten.
>
> --
> Torsten Bronger, aquisgrana, europa vetus
>                    Jabber ID: torsten.bron...@jabber.rwth-aachen.de
>                                   orhttp://bronger-jmp.appspot.com

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



Apache + Gunicorn + Django? Sample Configs?

2010-06-21 Thread Victor Hooi
Hi,

I'm currently deploying Django on Apache with WSGI.

Anyhow, I've heard really good things about the Gunicorn (http://
gunicorn.org/) WSGI server, so I was hoping to try it out.

I'm running Ubuntu 10.04, so I've installed the packages from the
official PPA (https://launchpad.net/~bchesneau/+archive/gunicorn)

However, I'm having trouble finding detailed instructions for Gunicorn
+ Django in English. E.g.:

http://blog.exirel.me/technique/apache-proxy-gunicorn-runit-django
http://blog.sietch-tabr.com/index.php/post/2010/04/04/Heberger-des-projets-Django-avec-Nginx-et-Gunicorn

Nor can I seem to find anything on how to deploy Apache + Django +
Gunicorn in English either.

Has anybody had success with getting it properly setup in production
with Django, and if so, would it be possible to post up your sample
config scripts?

Many of the guides refer to using Nginx - however, I need Apache
running on this server (other sites), and I only have a single IP
address on this system. And I'm not aware of any way of passing only
specific virtual-hosts through to Nginx, to then pass onto Gunicorn.
But if there's an easy way of doing that, I'm open to using Nginx +
Django + Gunicorn as an alternative.

Cheers,
Victor

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



Re: PostgreSQL backend - Ident authentication failed?

2010-06-21 Thread Kenneth Gonsalves
On Monday 21 June 2010 12:45:11 Victor Hooi wrote:
> I'm still curious what changed? Perhaps Ubuntu's default pg_hba.conf
> 

default always has ident in all distros that I am aware of
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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



Re: Django templates and libraries

2010-06-21 Thread shofty
i think i'd be right in saying that template tags are different to the
eggs issue.
i found a post on b-list which explained templatetags and where to put
them.
http://www.b-list.org/weblog/2007/dec/04/magic-tags/

so pretty much always drop the tags inside a folder named templatetags
in your app folder.
have you done that?

Matt

On Jun 20, 11:34 pm, tanman  wrote:
> Hello, I'm trying to setup an existing Django site up on WebFaction.
> I've uploaded the code and installed the libraries, but I'm having
> trouble getting the site to use my libraries. I've figured out that
> when I installed libraries with easy_install, they were installed to /
> home/jhumunc/lib/python2.5 instead of /home/jhumunc/webapps/jhumunc/
> lib/python2.5 and I found a recommendation to copy all the eggs from
> to the latter directory but I don't know if this actually helped at
> all. I've also added some of the template directories from within the
> eggs to my settings.py file. I'm trying to get the page 
> athttp://www.jhumunc.webfactional.com/accounts/register/to work
> properly. The pages uses the forms library and I've made sure that the
> library is on the template_dirs list in the settings.py file (/home/
> jhumunc/webapps/jhumunc/lib/python2.5/django_forms-0.5-py2.5.egg/forms/
> templates). However, when I load the page, it's saying that it can't
> find the templatetags that correspond to that template. I know the
> correct directory to look in is /home/jhumunc/webapps/jhumunc/lib/
> python2.5/django_forms-0.5-py2.5.egg/forms/templatetags but I can't
> figure out where to specify this.
>
> Any help would be appreciated. Thanks!

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



Re: PostgreSQL backend - Ident authentication failed?

2010-06-21 Thread Sam Lai
On 21 June 2010 17:04, Kenneth Gonsalves  wrote:
> On Monday 21 June 2010 12:24:58 Torsten Bronger wrote:
>> > Also, is this recommended practice, to use "www-data" as the
>> > backend database username?
>>
>> No, not recommended, but not forbidden either.
>>
>
> should be forbidden - one does not want apache to have direct access to the
> database

Storing a password in plaintext file makes me uneasy, even though it
is locked away through file-system permissions.

Having spent some time recently in the Windows world, I take
integrated auth for granted, and it works fine, making sysadmin much
easier.

You do bring up a interesting point though, and I don't know much
about the architecture of Apache and how holes are exploited when they
exist, but if the trespasser can execute arbitary code as www-data,
wouldn't they have access to settings.py anyway?

> --
> Regards
> Kenneth Gonsalves
> Senior Associate
> NRC-FOSS at AU-KBC
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Actions after HttpResponse rendered?

2010-06-21 Thread Daniel Roseman
On Jun 21, 6:46 am, DaNmarner  wrote:
> There's a similar question as mine on stackoverflow.com:
>
> http://stackoverflow.com/questions/1081340/how-do-you-do-something-af...
>
> and there isn't a satisfactory answer there.
>
> Basically, how do I do some thing after a view returns the response?
> Does request_finished enables that kind of operations?

Why do you think none of those answers is satisfactory? There are a
few useful recommendations on that page. What exactly do you need that
isn't covered?
--
DR.

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



How much would you charge for this? £5k? £15k? £5 0k?

2010-06-21 Thread ALJ
I'm just starting out with Django so using an hourly rate isn't really
applicable because I'm going to be much slower that a 'real'
developer. So far I've spent about 6 months part time.

What kind of ballpark amounts would people suggest this is worth?

I'm not going to tell you how much they think it was ... well maybe
I'll tell you later. I'm trying to help them out so it's considerably
cheaper than I think it should be.

What is it?
The application is helps the sales staff organize product
demonstrations around the country. They can book demonstrators to do
an event. The demonstrators do the events and then enter the details
of how it went. The system provides invoice generation, event tracking
and custom reporting.

Features
- Dynamic questionnaire and report form generation into pdf.
- Dynamic invoice generation into pdf.
- Work-flow with page locking, rollback and automatic email generation
on status change.
- Daily (and horribly complex) automatic summary excel reports
- Sales and questionnaire summary reports

- Designing and building the site
-- Models (about 32)
-- Setting up the admin interface
-- 12 key views plus goodness knows how many auxiliary views.
-- Look and feel

Other activities
- Weekly automatic importing of data from another accounting database
- Importing of existing event data.
- Importing of product prices and rates, existing staff details,
demonstrator details,
- Finding and setting up a VPS host
- Installing and configuring the site
- Support for a year (occasional changes, bug fixes and helping them
settle in)
- Training materials

... and this doesn't even take into account the changes they made
halfway though. I should have been more formal with the spec but I
know them and didn't think it would be necessary. Once bitten 

Appreciate this is a bit finger in the air, but like I said ...
ballparking.

ALJ

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



Re: PostgreSQL backend - Ident authentication failed?

2010-06-21 Thread Kenneth Gonsalves
On Monday 21 June 2010 13:39:42 Sam Lai wrote:
> > should be forbidden - one does not want apache to have direct access to
> > the database
> 
> Storing a password in plaintext file makes me uneasy, even though it
> is locked away through file-system permissions.
> 
> Having spent some time recently in the Windows world, I take
> integrated auth for granted, and it works fine, making sysadmin much
> easier.

and a single point of entry to all systems for a cracker
> 
> You do bring up a interesting point though, and I don't know much
> about the architecture of Apache and how holes are exploited when they
> exist, but if the trespasser can execute arbitary code as www-data,
> wouldn't they have access to settings.py anyway?
> 

and just to add to your worries, assuming that you have debug on in your 
production system, somewhere deep down in the traceback, you may see your 
database username and password! As for the apache question there are experts 
in this list who can anwer them. 
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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



RE: Problem trying to configure Django with FastCGI and Lighttpd

2010-06-21 Thread JoeManFoo
I know this thread is rather old but for those who come across this
trying to identify their issues here's how I got things working for me
on Ubuntu 10.04.

The major issue to the above poster's issue was with permissions.  The
www-data user that's running the lighttpd process needs to be able to
execute the .fcgi script.  Once that is fixed then running is easy.
Your user that's running your server process maybe named something
else.  I use 'htop' to see running processes (or you can use 'top'
since it's likely to already be installed on your distro) and who owns
those processes.

Here's my .fcgi script:

#!/usr/bin/python
import sys, os

# Add a custom Python path.
sys.path.insert(0, "/var/www/sites/example/mysite")

# Switch to the directory of your project. (Optional.)
# os.chdir("/home/user/myproject")

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "mysite.settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="prefork", daemonize="false")

And my relevant lighttpd.conf setup:
==
 fastcgi.server = (
"/example.fcgi" => (
"main" => (
# Use host / port instead of socket for TCP fastcgi
"bin-path" => "/var/www/sites/example/mysite.fcgi",
"host" => "127.0.0.1",
"port" => 2001,
#"socket" => "/var/www/sites/example/example.sock",
"check-local" => "disable",
"max-procs" => 2,
"idle-timeout" => 20,
)
),
)


I was running with a .sock file setup where I ran ./manage.py
runfcgi ... but I didn't want to have a process that had to trigger on
server startup and would rather just let the server own the starting
so that's why I went the route of using a .fcgi script and setting up
the .conf to start the processes.

I do have one issue though and maybe someone can help answer why this
is.  Even though I have "max-procs" => 2, I count 12 processes that
are running ... is this because I'm not specifying a child process
count or something?  Also, on my rackspace cloud server I'm only
getting about 30 requests/sec on static or dynamic content using AB
from my local desktop and hitting my server...is there something I
should be looking into to find out why this is the case?  I'm very new
to the who sysadmin thing and having to wear this hat for now.

Thanks in advance for any pointers/help - I was able to get about 350+
requests/sec using Apache2 and mod_wsgi on a VM player Ubuntu
appliance (using Ubuntu 10.04 just like on the cloud)...so unless my
cable connection to the outside world is slowing things up for me I
don't see why lighttpd and/or my server environment is running so
slow.



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



Mysql-Python error

2010-06-21 Thread Eduan
When installing Mysql-Python I get this error.

Traceback (most recent call last):
  File "setup.py", line 5, in 
from setuptools import setup, Extension
ImportError: No module named setuptools

Can anyone please help me.

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



Re: Mysql-Python error

2010-06-21 Thread Kenneth Gonsalves
On Monday 21 June 2010 13:04:19 Eduan wrote:
> When installing Mysql-Python I get this error.
> 
> Traceback (most recent call last):
>   File "setup.py", line 5, in 
> from setuptools import setup, Extension
> ImportError: No module named setuptools
> 

install setuptools
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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



Re: PostgreSQL backend - Ident authentication failed?

2010-06-21 Thread Sam Lai
On 21 June 2010 19:47, Kenneth Gonsalves  wrote:
> On Monday 21 June 2010 13:39:42 Sam Lai wrote:
>> > should be forbidden - one does not want apache to have direct access to
>> > the database
>>
>> Storing a password in plaintext file makes me uneasy, even though it
>> is locked away through file-system permissions.
>>
>> Having spent some time recently in the Windows world, I take
>> integrated auth for granted, and it works fine, making sysadmin much
>> easier.
>
> and a single point of entry to all systems for a cracker

I'm not running them all as admin (aka. root) obviously. Integrated
auth doesn't mean every user account can access every resource. It's
really just delegating an application's authentication system to the
operating system (note authentication, not authorization).

I fail to see how it is a single-point of entry to all systems. Yes,
it means there's one less layer of security, but that extra layer
provided by the DBMS isn't security anyway if as that OS user, you can
access the password to get past that extra layer of security anyway. I
don't believe this is an implementation of defense in depth.

>> You do bring up a interesting point though, and I don't know much
>> about the architecture of Apache and how holes are exploited when they
>> exist, but if the trespasser can execute arbitary code as www-data,
>> wouldn't they have access to settings.py anyway?
>>
>
> and just to add to your worries, assuming that you have debug on in your
> production system, somewhere deep down in the traceback, you may see your
> database username and password! As for the apache question there are experts
> in this list who can anwer them.

Thanks for mocking what was and still is a serious point.

> --
> Regards
> Kenneth Gonsalves
> Senior Associate
> NRC-FOSS at AU-KBC
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: PostgreSQL backend - Ident authentication failed?

2010-06-21 Thread Kenneth Gonsalves
On Monday 21 June 2010 15:37:50 Sam Lai wrote:
> > and a single point of entry to all systems for a cracker
> 
> I'm not running them all as admin (aka. root) obviously. Integrated
> auth doesn't mean every user account can access every resource. It's
> really just delegating an application's authentication system to the
> operating system (note authentication, not authorization).
> 
> I fail to see how it is a single-point of entry to all systems. Yes,
> it means there's one less layer of security, but that extra layer
> provided by the DBMS isn't security anyway if as that OS user, you can
> access the password to get past that extra layer of security anyway. I
> don't believe this is an implementation of defense in depth.

I am no expert on windows, so cannot comment.
> 
> >> You do bring up a interesting point though, and I don't know much
> >> about the architecture of Apache and how holes are exploited when they
> >> exist, but if the trespasser can execute arbitary code as www-data,
> >> wouldn't they have access to settings.py anyway?
> >
> > and just to add to your worries, assuming that you have debug on in your
> > production system, somewhere deep down in the traceback, you may see your
> > database username and password! As for the apache question there are
> > experts in this list who can anwer them.
> 
> Thanks for mocking what was and still is a serious point.
> 

I am sorry if you feel I was mocking - it was not my intention. And the point 
you were bringing up about Apache is a vast subject and I am not competent to 
answer it. As for the debug thing, it is just a warning not to run debug in 
production.

-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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



Re: Actions after HttpResponse rendered?

2010-06-21 Thread David De La Harpe Golden

On 21/06/10 06:46, DaNmarner wrote:

There's a similar question as mine on stackoverflow.com:

http://stackoverflow.com/questions/1081340/how-do-you-do-something-after-you-render-the-view-django

and there isn't a satisfactory answer there.

Basically, how do I do some thing after a view returns the response?


Short answer: save yourself hassle and set up celery.  The answers on 
that page do talk in general terms about using message queues and 
background processes, which is exactly what celery helps you do 
concretely in a django context:


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



Re: UnicodeDecodeError (ordinal not in range) when deleting an inline item - 1.2.1

2010-06-21 Thread Matt Hoskins
Federico,

When trying out what Karen suggests then in the unlikely event that
Red Hat doesn't load the environment variables from /etc/apache2/
envvars, one way to find it without consulting documents is to look at
the apache start-up script (e.g. /usr/sbin/apache2ctl) so find that on
your server and look at what that loads - for example the copy I've
got has the following:

# the path to the environment variable file
test -z "$APACHE_ENVVARS" && APACHE_ENVVARS='/etc/apache2/envvars'
# pick up any necessary environment variables
if test -f $APACHE_ENVVARS; then
  . $APACHE_ENVVARS
fi

Of course as you can see from that it's possible to set an environment
variable before running apache2ctl to change the location of envvars,
but it's unlikely they'd do that.

Matt

>
> I am not familiar with Red Hat so I can't give you any more specific advice
> than that. If it does not use /etc/apache2/envvars (or if you are using some
> server other than Apache), then you need to consult the Red Hat doc or
> forums to find out how to configure your web server to run with a LANG other
> than C or whatever it is currently using.
>

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



Re: PostgreSQL backend - Ident authentication failed?

2010-06-21 Thread Sam Lai
On 21 June 2010 20:16, Kenneth Gonsalves  wrote:
> On Monday 21 June 2010 15:37:50 Sam Lai wrote:
>> >> You do bring up a interesting point though, and I don't know much
>> >> about the architecture of Apache and how holes are exploited when they
>> >> exist, but if the trespasser can execute arbitary code as www-data,
>> >> wouldn't they have access to settings.py anyway?
>> >
>> > and just to add to your worries, assuming that you have debug on in your
>> > production system, somewhere deep down in the traceback, you may see your
>> > database username and password! As for the apache question there are
>> > experts in this list who can anwer them.
>>
>> Thanks for mocking what was and still is a serious point.
>>
>
> I am sorry if you feel I was mocking - it was not my intention. And the point
> you were bringing up about Apache is a vast subject and I am not competent to
> answer it. As for the debug thing, it is just a warning not to run debug in
> production.

Ah I must've interpreted it incorrectly, I apologise. I'm definitely
no expert on *nix and Apache security, so I'd appreciate it if anyone
could clarify as well.

>From the PGSQL docs [1],
"On systems supporting SO_PEERCRED requests for Unix-domain sockets
(currently Linux, FreeBSD, NetBSD, OpenBSD, BSD/OS, and Solaris),
ident authentication can also be applied to local connections. In this
case, no security risk is added by using ident authentication; indeed
it is a preferable choice for local connections on such systems."

http://www.postgresql.org/docs/current/static/auth-methods.html

So it seems the postgresql people think it is ok, but I'm not sure
once you add in Apache and things like Django on top of it.

> --
> Regards
> Kenneth Gonsalves
> Senior Associate
> NRC-FOSS at AU-KBC
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: fieldsets django

2010-06-21 Thread Waleria
I don't know  I'm wondering how to use the fieldsets.can you
help me...how to use the fieldsets...?

On 20 jun, 15:01, Francis Gulotta  wrote:
> You might want to look into a css solution.
>
> -Francis
>
> ---
> Francis Gulotta
> wiz...@roborooter.com
>
> On Fri, Jun 18, 2010 at 3:40 PM, Waléria Antunes David <
>
>
>
> waleriantu...@gmail.com> wrote:
> > I have a form with various fields and I need to split these fields so that
> > it looks like the image attached. I was reading about FIELDSETS but do not
> > know how to use.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Re: PostgreSQL backend - Ident authentication failed?

2010-06-21 Thread Kenneth Gonsalves
On Monday 21 June 2010 16:21:10 Sam Lai wrote:
> >From the PGSQL docs [1],
> 
> "On systems supporting SO_PEERCRED requests for Unix-domain sockets
> (currently Linux, FreeBSD, NetBSD, OpenBSD, BSD/OS, and Solaris),
> ident authentication can also be applied to local connections. In this
> case, no security risk is added by using ident authentication; indeed
> it is a preferable choice for local connections on such systems."
> 
> http://www.postgresql.org/docs/current/static/auth-methods.html
> 
> So it seems the postgresql people think it is ok, but I'm not sure
> once you add in Apache and things like Django on top of it.
> 

I am not too sure whether connection over   tcp/ip comes under 'local'
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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



Re: How much would you charge for this? £5k? £15k? £50k?

2010-06-21 Thread ALJ
... I've just noticed the title and hope this doesn't look too much
like spam!!

On Jun 21, 11:12 am, ALJ  wrote:
> I'm just starting out with Django so using an hourly rate isn't really
> applicable because I'm going to be much slower that a 'real'
> developer. So far I've spent about 6 months part time.
>
> What kind of ballpark amounts would people suggest this is worth?
>
> I'm not going to tell you how much they think it was ... well maybe
> I'll tell you later. I'm trying to help them out so it's considerably
> cheaper than I think it should be.
>
> What is it?
> The application is helps the sales staff organize product
> demonstrations around the country. They can book demonstrators to do
> an event. The demonstrators do the events and then enter the details
> of how it went. The system provides invoice generation, event tracking
> and custom reporting.
>
> Features
> - Dynamic questionnaire and report form generation into pdf.
> - Dynamic invoice generation into pdf.
> - Work-flow with page locking, rollback and automatic email generation
> on status change.
> - Daily (and horribly complex) automatic summary excel reports
> - Sales and questionnaire summary reports
>
> - Designing and building the site
> -- Models (about 32)
> -- Setting up the admin interface
> -- 12 key views plus goodness knows how many auxiliary views.
> -- Look and feel
>
> Other activities
> - Weekly automatic importing of data from another accounting database
> - Importing of existing event data.
> - Importing of product prices and rates, existing staff details,
> demonstrator details,
> - Finding and setting up a VPS host
> - Installing and configuring the site
> - Support for a year (occasional changes, bug fixes and helping them
> settle in)
> - Training materials
>
> ... and this doesn't even take into account the changes they made
> halfway though. I should have been more formal with the spec but I
> know them and didn't think it would be necessary. Once bitten 
>
> Appreciate this is a bit finger in the air, but like I said ...
> ballparking.
>
> ALJ

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



Re: fieldsets django

2010-06-21 Thread Tom Evans
On Mon, Jun 21, 2010 at 12:12 PM, Waleria  wrote:
> I don't know  I'm wondering how to use the fieldsets.can you
> help me...how to use the fieldsets...?
>

Be a bit clearer please.

Fieldset is a HTML tag, it has nothing to do with django. It is used
to group similar fields and surround them with a nice border.

Formsets are in django arrays of forms. If you have one form, and want
to repeat it 20 times on one page, then you want a formset.

If you do want a formset, documentation is here:
http://docs.djangoproject.com/en/1.2/topics/forms/formsets/#topics-forms-formsets

Cheers

Tom

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



outer join in orm

2010-06-21 Thread JeffH
I have some models that (simplified) look like the following.

class Answer(models.Model):
id = models.CharField(max_length=32, primary_key=True)
text = models.TextField(blank=False)
question = models.ForeignKey(Question)
candidate = models.ForeignKey(Candidate)

class Question(models.Model):
id = models.CharField(max_length=32, primary_key=True)
text = models.TextField(blank=False)

class Candidate(models.Model):
id = models.CharField(max_length=32, primary_key=True)
name = models.CharField(max_length=32, blank=False)

class Race(models.Model):
id = models.CharField(max_length=32, primary_key=True)
name = models.CharField(max_length=128, blank=False)
questions = models.ManyToManyField(Question)
candidates = models.ManyToManyField(Candidate)

So, a Race has Candidates and Questions, and a Candidate has Answers.
Each answer is associated with a Question and a Candidate. Displaying
the question associated with an answer is easy:

# context variable in view
answers = Answer.objects.filter(candidate=candidate)

# template code

{% for answer in answers %}

{{answer.question.text}}
{{answer.text}}

{% endfor %}


>From the point of view of the Candidate, I need to display all the
questions, including the ones without Answers. I know how to to do
this using raw sql and an outer join. How to do it in the orm?

Thanks in advance for any ideas.

--Jeff

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



FW: google search

2010-06-21 Thread Henrik Genssen
Hi,

I am trying to optimize the search of users, as google does. 
So I thought having a 2. column in DB with a "normalized" version of the string.
By normalize I mean convert ä to ae etc.

Someone done this before?

On my way searching for a solution, I found this lib for a "did you mean" 
search:
http://norvig.com/spell-correct.html
Can we integrate this into ORM? and build the "big.txt" from the DB in the DB 
instead of disk?
Or is it too much overhead?

I know, haystack can do this for you, but  brings in a lot of overhead (like 
the searchengines) to you,
along with a lot of features not all people may need.

Any one there with an other idea?

regards

Henrik


>forward of message:
>date: 18.06.2010 20:22:29
>from: "Henrik Genssen" 
>to: "Django users" 
>subject: google search
>
>Hi,
>
>does someone know a simple way or app for a better search like google does it?
>Not in the meaning of: did you mean, but ignore chars like ",.-#+? and convert
>special chars like ä to ae, ü to ue and so on...
>
>
>regards
>
>Henrik

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



Re: outer join in orm

2010-06-21 Thread Daniel Roseman
On Jun 21, 12:51 pm, JeffH  wrote:
> I have some models that (simplified) look like the following.
>
> class Answer(models.Model):
>     id = models.CharField(max_length=32, primary_key=True)
>     text = models.TextField(blank=False)
>     question = models.ForeignKey(Question)
>     candidate = models.ForeignKey(Candidate)
>
> class Question(models.Model):
>     id = models.CharField(max_length=32, primary_key=True)
>     text = models.TextField(blank=False)
>
> class Candidate(models.Model):
>     id = models.CharField(max_length=32, primary_key=True)
>     name = models.CharField(max_length=32, blank=False)
>
> class Race(models.Model):
>     id = models.CharField(max_length=32, primary_key=True)
>     name = models.CharField(max_length=128, blank=False)
>     questions = models.ManyToManyField(Question)
>     candidates = models.ManyToManyField(Candidate)
>
> So, a Race has Candidates and Questions, and a Candidate has Answers.
> Each answer is associated with a Question and a Candidate. Displaying
> the question associated with an answer is easy:
>
> # context variable in view
>     answers = Answer.objects.filter(candidate=candidate)
>
> # template code
>     
>     {% for answer in answers %}
>     
>         {{answer.question.text}}
>         {{answer.text}}
>     
>     {% endfor %}
>     
>
> From the point of view of the Candidate, I need to display all the
> questions, including the ones without Answers. I know how to to do
> this using raw sql and an outer join. How to do it in the orm?
>
> Thanks in advance for any ideas.
>
> --Jeff

Not quite enough information here to answer. What are you wanting to
join? If you just want to display all the questions, why do you need a
join at all?
--
DR.

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



Re: FW: google search

2010-06-21 Thread Tom Evans
On Mon, Jun 21, 2010 at 1:37 PM, Henrik Genssen
 wrote:
> Hi,
>
> I am trying to optimize the search of users, as google does.
> So I thought having a 2. column in DB with a "normalized" version of the 
> string.
> By normalize I mean convert ä to ae etc.
>
> Someone done this before?
>
> On my way searching for a solution, I found this lib for a "did you mean" 
> search:
> http://norvig.com/spell-correct.html
> Can we integrate this into ORM? and build the "big.txt" from the DB in the DB 
> instead of disk?
> Or is it too much overhead?
>
> I know, haystack can do this for you, but  brings in a lot of overhead (like 
> the searchengines) to you,
> along with a lot of features not all people may need.
>
> Any one there with an other idea?
>
> regards
>
> Henrik
>
>

This normalization is called stubbing or tokenization in search
terminology, and is quite an in-depth topic. If you take a look at the
number of tokenizers available in the stock version of solr[1], you'll
see why.

You rule this out as an option, but you should be looking at the
overhead of haystack/solr. The interface to google is simple, and this
makes people think that the backend is easy too; it's not. Either plan
on spending a lot of time researching search technologies and
developing your own solution, or settle for the overhead.

Cheers

Tom

[1] http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters

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



Force ContentType id

2010-06-21 Thread donato.gr
I had to clean my application database from old models without losing
data.
So, I copied my tables to another db, dropped them, run syncdb and
copied data back.
But the app stopped working, because some tables used GenericRelations
and still pointed to the old ContentType; so, I had to change that id
manually.

Is there a way to force the id of a model in django_content_type
table?
Or, is there a way to run a syncdb to apply changes without losing
data?

Thanks.

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



escapejs inside {% trans %}

2010-06-21 Thread donato.gr
Hi,
I had this code in a template file:
alert('{% trans "a string" %}')

It gave error when translated bacause the translated string had a '
inside. So, I replaced " with ' in the template line and all worked
fine.

To avoid any problem with 'escape chars', is there a way to escape
translated strings, like the 'escapejs' filter tag does?
Something like "{% trans "a string" | escapejs %}"

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



Re: escapejs inside {% trans %}

2010-06-21 Thread Tom Evans
On Mon, Jun 21, 2010 at 2:17 PM, donato.gr  wrote:
> Hi,
> I had this code in a template file:
> alert('{% trans "a string" %}')
>
> It gave error when translated bacause the translated string had a '
> inside. So, I replaced " with ' in the template line and all worked
> fine.
>
> To avoid any problem with 'escape chars', is there a way to escape
> translated strings, like the 'escapejs' filter tag does?
> Something like "{% trans "a string" | escapejs %}"
>
> Thank you
>

Yes, instead of using {% trans "foo" %}, you can use this alternative
form, for use inside an output tag:

{{ _("foo")|escapejs }}

Cheers

Tom

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



Re: Mysql-Python error

2010-06-21 Thread Eduan
Ok thanks. I've installed the setuptools but now i get another error.

setup_windows.py", line 7, in get_config
serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
options['registry_key'])
WindowsError: [Error 2] The system cannot find the file specified

Thanks for all your effort.

Regards
Eduan Bekker

--
On Jun 21, 12:04 pm, Kenneth Gonsalves  wrote:
> On Monday 21 June 2010 13:04:19 Eduan wrote:
>
> > When installing Mysql-Python I get this error.
>
> > Traceback (most recent call last):
> >   File "setup.py", line 5, in 
> >     from setuptools import setup, Extension
> > ImportError: No module named setuptools
>
> install setuptools
> --
> Regards
> Kenneth Gonsalves
> Senior Associate
> NRC-FOSS at AU-KBC

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



Re: outer join in orm

2010-06-21 Thread JeffH
To clarify: Each race has a set of questions. The candidate may have
responded to none, some, or all. The answers are linked to the
candidate (and to the question). For each candidate, I want to display
all the questions, with or without answer. The way it works currently,
only the questions with answers get displayed.

On Jun 21, 8:41 am, Daniel Roseman  wrote:
> On Jun 21, 12:51 pm, JeffH  wrote:
>
>
>
> > I have some models that (simplified) look like the following.
>
> > class Answer(models.Model):
> >     id = models.CharField(max_length=32, primary_key=True)
> >     text = models.TextField(blank=False)
> >     question = models.ForeignKey(Question)
> >     candidate = models.ForeignKey(Candidate)
>
> > class Question(models.Model):
> >     id = models.CharField(max_length=32, primary_key=True)
> >     text = models.TextField(blank=False)
>
> > class Candidate(models.Model):
> >     id = models.CharField(max_length=32, primary_key=True)
> >     name = models.CharField(max_length=32, blank=False)
>
> > class Race(models.Model):
> >     id = models.CharField(max_length=32, primary_key=True)
> >     name = models.CharField(max_length=128, blank=False)
> >     questions = models.ManyToManyField(Question)
> >     candidates = models.ManyToManyField(Candidate)
>
> > So, a Race has Candidates and Questions, and a Candidate has Answers.
> > Each answer is associated with a Question and a Candidate. Displaying
> > the question associated with an answer is easy:
>
> > # context variable in view
> >     answers = Answer.objects.filter(candidate=candidate)
>
> > # template code
> >     
> >     {% for answer in answers %}
> >     
> >         {{answer.question.text}}
> >         {{answer.text}}
> >     
> >     {% endfor %}
> >     
>
> > From the point of view of the Candidate, I need to display all the
> > questions, including the ones without Answers. I know how to to do
> > this using raw sql and an outer join. How to do it in the orm?
>
> > Thanks in advance for any ideas.
>
> > --Jeff
>
> Not quite enough information here to answer. What are you wanting to
> join? If you just want to display all the questions, why do you need a
> join at all?
> --
> DR.

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



djapian not working with apach2

2010-06-21 Thread watad
hi all,

im using djapian for my search , it seems to work fine when i run it
in django development server
but when i configure my sites to use apach2 im always getting this
error when i try to search :

"Caught OSError while rendering: [Errno 13] Permission denied: '/
index'"
i am sure it is not a folder permission issue because when i run my
sites using ./manage.py runserver   i get the results of my search.

im using mod_wsgi

my locasites.conf :


# ---


ServerName mysite.name
ServerAlias mysitealias

WSGIScriptAlias / "/path/to/my/apache/file.wsgi"

Allow from all


Alias /site_media/ "/path/to/mysite/media/"

Order allow,deny
Options Indexes FollowSymLinks
Allow from all
IndexOptions FancyIndexing


Alias /media/ "/usr/local/lib/python2.6/dist-packages/django/
contrib/admin/media/"

Order allow,deny
Options Indexes FollowSymLinks
Allow from all
IndexOptions FancyIndexing




 this is repeated for all the sites.

can anyone help with issue
regards

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



Re: How much would you charge for this? £5k? £15k? £50k?

2010-06-21 Thread euan.godd...@googlemail.com
It sounds like your project is pretty fully featured and if you claim
to be "inexperienced" in Django development this much work is pretty
impressive on a part-time basis over 6 months!

Currently the Django project I am working on has taken over 2.5 years
(and is ongoing). Although we don't just do Django, it's what we do
most of the time. Our application has 213 models with 78742 lines of
python code. I would estimate (although this is a bit of a guess) that
the developer cost for this has been approximately £350k.

You might be able to scale that to your workload.

Hope that helps, Euan

On Jun 21, 10:12 am, ALJ  wrote:
> I'm just starting out with Django so using an hourly rate isn't really
> applicable because I'm going to be much slower that a 'real'
> developer. So far I've spent about 6 months part time.
>
> What kind of ballpark amounts would people suggest this is worth?
>
> I'm not going to tell you how much they think it was ... well maybe
> I'll tell you later. I'm trying to help them out so it's considerably
> cheaper than I think it should be.
>
> What is it?
> The application is helps the sales staff organize product
> demonstrations around the country. They can book demonstrators to do
> an event. The demonstrators do the events and then enter the details
> of how it went. The system provides invoice generation, event tracking
> and custom reporting.
>
> Features
> - Dynamic questionnaire and report form generation into pdf.
> - Dynamic invoice generation into pdf.
> - Work-flow with page locking, rollback and automatic email generation
> on status change.
> - Daily (and horribly complex) automatic summary excel reports
> - Sales and questionnaire summary reports
>
> - Designing and building the site
> -- Models (about 32)
> -- Setting up the admin interface
> -- 12 key views plus goodness knows how many auxiliary views.
> -- Look and feel
>
> Other activities
> - Weekly automatic importing of data from another accounting database
> - Importing of existing event data.
> - Importing of product prices and rates, existing staff details,
> demonstrator details,
> - Finding and setting up a VPS host
> - Installing and configuring the site
> - Support for a year (occasional changes, bug fixes and helping them
> settle in)
> - Training materials
>
> ... and this doesn't even take into account the changes they made
> halfway though. I should have been more formal with the spec but I
> know them and didn't think it would be necessary. Once bitten 
>
> Appreciate this is a bit finger in the air, but like I said ...
> ballparking.
>
> ALJ

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



Re: outer join in orm

2010-06-21 Thread Scott Gould
There may well be a better way to do this, especially since it's been
a good year since I was struggling with this myself. (Very similar
case to yours, different subject matter of course.)

The way I ended up doing it was to use a template tag and some list
comprehensions to whittle things down. E.g.:

questions = Questions.objects.all()
answers = Answers.objects.filter(candidate=my_candidate)

questions_and_answers = [(q, [a for a in answers if a.question = q])
for q in questions]

...which should give you a list of (question, )
tuples.


On Jun 21, 10:00 am, JeffH  wrote:
> To clarify: Each race has a set of questions. The candidate may have
> responded to none, some, or all. The answers are linked to the
> candidate (and to the question). For each candidate, I want to display
> all the questions, with or without answer. The way it works currently,
> only the questions with answers get displayed.
>
> On Jun 21, 8:41 am, Daniel Roseman  wrote:
>
>
>
> > On Jun 21, 12:51 pm, JeffH  wrote:
>
> > > I have some models that (simplified) look like the following.
>
> > > class Answer(models.Model):
> > >     id = models.CharField(max_length=32, primary_key=True)
> > >     text = models.TextField(blank=False)
> > >     question = models.ForeignKey(Question)
> > >     candidate = models.ForeignKey(Candidate)
>
> > > class Question(models.Model):
> > >     id = models.CharField(max_length=32, primary_key=True)
> > >     text = models.TextField(blank=False)
>
> > > class Candidate(models.Model):
> > >     id = models.CharField(max_length=32, primary_key=True)
> > >     name = models.CharField(max_length=32, blank=False)
>
> > > class Race(models.Model):
> > >     id = models.CharField(max_length=32, primary_key=True)
> > >     name = models.CharField(max_length=128, blank=False)
> > >     questions = models.ManyToManyField(Question)
> > >     candidates = models.ManyToManyField(Candidate)
>
> > > So, a Race has Candidates and Questions, and a Candidate has Answers.
> > > Each answer is associated with a Question and a Candidate. Displaying
> > > the question associated with an answer is easy:
>
> > > # context variable in view
> > >     answers = Answer.objects.filter(candidate=candidate)
>
> > > # template code
> > >     
> > >     {% for answer in answers %}
> > >     
> > >         {{answer.question.text}}
> > >         {{answer.text}}
> > >     
> > >     {% endfor %}
> > >     
>
> > > From the point of view of the Candidate, I need to display all the
> > > questions, including the ones without Answers. I know how to to do
> > > this using raw sql and an outer join. How to do it in the orm?
>
> > > Thanks in advance for any ideas.
>
> > > --Jeff
>
> > Not quite enough information here to answer. What are you wanting to
> > join? If you just want to display all the questions, why do you need a
> > join at all?
> > --
> > DR.

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



Price fixing (was Re: How much would you charge for this? £5k? £15k? £50k?)

2010-06-21 Thread Nick Arnett
On Mon, Jun 21, 2010 at 2:12 AM, ALJ  wrote:

> I'm just starting out with Django so using an hourly rate isn't really
> applicable because I'm going to be much slower that a 'real'
> developer. So far I've spent about 6 months part time.
>
> What kind of ballpark amounts would people suggest this is worth?


I don't know about the law elsewhere, but in the United States, having a
discussion with other vendors on what to charge clients opens you up to
prosecution for price fixing.  It almost certainly should be a banned topic
here.

For a fairly good description of the issue, look at the HTML Writer's Guild
guidelines:

http://www.hwg.org/resources/faqs/priceFAQ.html

Nick

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



Re: outer join in orm

2010-06-21 Thread JeffH
That looks reasonable... but I wonder if the ORM can do it directly
somehow. Anyone?

On Jun 21, 10:14 am, Scott Gould  wrote:
> There may well be a better way to do this, especially since it's been
> a good year since I was struggling with this myself. (Very similar
> case to yours, different subject matter of course.)
>
> The way I ended up doing it was to use a template tag and some list
> comprehensions to whittle things down. E.g.:
>
> questions = Questions.objects.all()
> answers = Answers.objects.filter(candidate=my_candidate)
>
> questions_and_answers = [(q, [a for a in answers if a.question = q])
> for q in questions]
>
> ...which should give you a list of (question, )
> tuples.
>
> On Jun 21, 10:00 am, JeffH  wrote:
>
> > To clarify: Each race has a set of questions. The candidate may have
> > responded to none, some, or all. The answers are linked to the
> > candidate (and to the question). For each candidate, I want to display
> > all the questions, with or without answer. The way it works currently,
> > only the questions with answers get displayed.
>
> > On Jun 21, 8:41 am, Daniel Roseman  wrote:
>
> > > On Jun 21, 12:51 pm, JeffH  wrote:
>
> > > > I have some models that (simplified) look like the following.
>
> > > > class Answer(models.Model):
> > > >     id = models.CharField(max_length=32, primary_key=True)
> > > >     text = models.TextField(blank=False)
> > > >     question = models.ForeignKey(Question)
> > > >     candidate = models.ForeignKey(Candidate)
>
> > > > class Question(models.Model):
> > > >     id = models.CharField(max_length=32, primary_key=True)
> > > >     text = models.TextField(blank=False)
>
> > > > class Candidate(models.Model):
> > > >     id = models.CharField(max_length=32, primary_key=True)
> > > >     name = models.CharField(max_length=32, blank=False)
>
> > > > class Race(models.Model):
> > > >     id = models.CharField(max_length=32, primary_key=True)
> > > >     name = models.CharField(max_length=128, blank=False)
> > > >     questions = models.ManyToManyField(Question)
> > > >     candidates = models.ManyToManyField(Candidate)
>
> > > > So, a Race has Candidates and Questions, and a Candidate has Answers.
> > > > Each answer is associated with a Question and a Candidate. Displaying
> > > > the question associated with an answer is easy:
>
> > > > # context variable in view
> > > >     answers = Answer.objects.filter(candidate=candidate)
>
> > > > # template code
> > > >     
> > > >     {% for answer in answers %}
> > > >     
> > > >         {{answer.question.text}}
> > > >         {{answer.text}}
> > > >     
> > > >     {% endfor %}
> > > >     
>
> > > > From the point of view of the Candidate, I need to display all the
> > > > questions, including the ones without Answers. I know how to to do
> > > > this using raw sql and an outer join. How to do it in the orm?
>
> > > > Thanks in advance for any ideas.
>
> > > > --Jeff
>
> > > Not quite enough information here to answer. What are you wanting to
> > > join? If you just want to display all the questions, why do you need a
> > > join at all?
> > > --
> > > DR.
>
>

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



optional ForeignKey

2010-06-21 Thread Magnus Valle
Hi,
I'm trying to make model that has itself as a foreign key, in an
attempt to store a reverse tree in Django.
However, I can't find a way to set a default value to
models.ForeignKey or make it optional.

My model is like this:
class Node(models.Model):
name = models.CharField(max_length=100)
parent = models.ForeignKey('self')

runserver doesn't complain, but whenever I try to enter data to the
model with Django's admin interface I get a "This field is required."
message, and it want's me to select a entry, but there are none.

-- 
Magnus

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



Re: optional ForeignKey

2010-06-21 Thread euan.godd...@googlemail.com
You want:

parent = models.ForeignKey('self', null=True, blank=True)

On Jun 21, 3:37 pm, Magnus Valle  wrote:
> Hi,
> I'm trying to make model that has itself as a foreign key, in an
> attempt to store a reverse tree in Django.
> However, I can't find a way to set a default value to
> models.ForeignKey or make it optional.
>
> My model is like this:
> class Node(models.Model):
>     name = models.CharField(max_length=100)
>     parent = models.ForeignKey('self')
>
> runserver doesn't complain, but whenever I try to enter data to the
> model with Django's admin interface I get a "This field is required."
> message, and it want's me to select a entry, but there are none.
>
> --
> Magnus

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



Re: optional ForeignKey

2010-06-21 Thread Karen Tracey
On Mon, Jun 21, 2010 at 10:37 AM, Magnus Valle  wrote:

> Hi,
> I'm trying to make model that has itself as a foreign key, in an
> attempt to store a reverse tree in Django.
> However, I can't find a way to set a default value to
> models.ForeignKey or make it optional.
>
> My model is like this:
> class Node(models.Model):
>name = models.CharField(max_length=100)
>parent = models.ForeignKey('self')
>
> runserver doesn't complain, but whenever I try to enter data to the
> model with Django's admin interface I get a "This field is required."
> message, and it want's me to select a entry, but there are none.
>


You make a ForeignKey field optional by specifying blank=True, null=True:

http://docs.djangoproject.com/en/1.2/ref/models/fields/#null

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

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



File upload from python client to Django app

2010-06-21 Thread srn
Hello to all,

I'm trying to do a POST from a python client to a Django webapp using
urllib2 but I'm getting http 403  error.
On the Django side I'm using a Form so I suspect the problem is {%
csrf_token %} (csrf middleware enabled) which I can't provide from the
client side.

Is there other way to do this?

Your advice is much appreciated,
Regards,
Sorin


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



Re: File upload from python client to Django app

2010-06-21 Thread euan.godd...@googlemail.com
urllib2 can handle cookies and therefore you should be able to handle
the login. It will probably be a fair bit of work to get the client to
submit the various parts, but I'm sure I've seen some examples around
on how to do such a thing.

Euan

On Jun 21, 3:52 pm, srn  wrote:
> Hello to all,
>
> I'm trying to do a POST from a python client to a Django webapp using
> urllib2 but I'm getting http 403  error.
> On the Django side I'm using a Form so I suspect the problem is {%
> csrf_token %} (csrf middleware enabled) which I can't provide from the
> client side.
>
> Is there other way to do this?
>
> Your advice is much appreciated,
> Regards,
> Sorin

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



Re: Price fixing (was Re: How much would you charge for this? £5k? £15k? £50k?)

2010-06-21 Thread Michael Schade
I'm no master of the law, I have a lawyer for that, but a quick read about
price fixing seems to suggest that this is not that at all. Rather, price
fixing is an agreement made so that competition in a market is lost by
vendors agreeing upon a rate to sell a product or service for current and
future clients, making it impossible for them (the clients) to seek better
deals elsewhere (or for the market to be fairly regulated by supply, demand,
and so forth). This is not a case of that, because ALJ is not trying to fix
the market at a particular price (i.e., he is not saying "Calling all Django
Developers; cap your rates at <$x>/hour so we are all equal.")

To the Frequently Asked Question entry that you point to, it mentions that
"several brokers in DC were successfully prosecuted for simply discussing an
increase of fees at a dinner meeting." That appears to be specific to
multiple competitors seeking to agree upon a rate so that they are all equal
in their pricing (and therefore do not compete based upon that), rather than
a case in which an up-and-coming broker is simply trying to learn how prices
are determined.

Regardless, it does not seem like ALJ is trying to formulate a charge for
this current project, which is already underway (as indicated by there being
such a plethora of changes only halfway through). Instead, it seems to me as
if ALJ is merely trying to educate himself on how experienced developers
determine pricing, so that he may understand what sort of expenses to take
into account to accurately judge the worth of a project.

Just my two cents. If this is on the border of being illegal (or otherwise
off-topic for this group), then the topic should by all means be dropped,
but I do not think that any activity as indicated by my reading about price
fixing is taking place.

To ALJ, it is difficult to determine a price for these specific requirements
(especially when changes are being made after). I would recommend that you
consider how this project will add to your reputation and education,
especially since you are inexperienced with this framework (and perhaps the
language). Newer developers will often have to 'sacrifice' a higher pay so
that they may build their portfolio and learn more about what common jobs
require they know. As they do this and continue to prove themselves worthy,
they can raise their rates--not to something that necessarily matches what
everyone else is charging, but to what they feel is representative of their
time spent, and knowledge used, on the project.

Sincerely,
Michael A. Schade

On Jun 21, 2010, at 9:19 AM, Nick Arnett  wrote:



On Mon, Jun 21, 2010 at 2:12 AM, ALJ  wrote:

> I'm just starting out with Django so using an hourly rate isn't really
> applicable because I'm going to be much slower that a 'real'
> developer. So far I've spent about 6 months part time.
>
> What kind of ballpark amounts would people suggest this is worth?


I don't know about the law elsewhere, but in the United States, having a
discussion with other vendors on what to charge clients opens you up to
prosecution for price fixing.  It almost certainly should be a banned topic
here.

For a fairly good description of the issue, look at the HTML Writer's Guild
guidelines:

http://www.hwg.org/resources/faqs/priceFAQ.html

Nick

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

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



Re: optional ForeignKey

2010-06-21 Thread Magnus Valle
Ah, OK, Thanks!
I didn't know that blank and null are available for all field-types, I
should have known.

Thanks!!

On Mon, Jun 21, 2010 at 15:41, Karen Tracey  wrote:
> On Mon, Jun 21, 2010 at 10:37 AM, Magnus Valle  wrote:
>>
>> Hi,
>> I'm trying to make model that has itself as a foreign key, in an
>> attempt to store a reverse tree in Django.
>> However, I can't find a way to set a default value to
>> models.ForeignKey or make it optional.
>>
>> My model is like this:
>> class Node(models.Model):
>>    name = models.CharField(max_length=100)
>>    parent = models.ForeignKey('self')
>>
>> runserver doesn't complain, but whenever I try to enter data to the
>> model with Django's admin interface I get a "This field is required."
>> message, and it want's me to select a entry, but there are none.
>
>
> You make a ForeignKey field optional by specifying blank=True, null=True:
>
> http://docs.djangoproject.com/en/1.2/ref/models/fields/#null
>
> Karen
> --
> http://tracey.org/kmt/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Magnus

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



Re: outer join in orm

2010-06-21 Thread backdoc
I hope you get an ORM answer, too.  I'm a newbie following this thread and
this sounds like the type of problem I have run into a couple of times
already.



On Mon, Jun 21, 2010 at 9:37 AM, JeffH  wrote:

> That looks reasonable... but I wonder if the ORM can do it directly
> somehow. Anyone?
>
> On Jun 21, 10:14 am, Scott Gould  wrote:
> > There may well be a better way to do this, especially since it's been
> > a good year since I was struggling with this myself. (Very similar
> > case to yours, different subject matter of course.)
> >
> > The way I ended up doing it was to use a template tag and some list
> > comprehensions to whittle things down. E.g.:
> >
> > questions = Questions.objects.all()
> > answers = Answers.objects.filter(candidate=my_candidate)
> >
> > questions_and_answers = [(q, [a for a in answers if a.question = q])
> > for q in questions]
> >
> > ...which should give you a list of (question, )
> > tuples.
> >
> > On Jun 21, 10:00 am, JeffH  wrote:
> >
> > > To clarify: Each race has a set of questions. The candidate may have
> > > responded to none, some, or all. The answers are linked to the
> > > candidate (and to the question). For each candidate, I want to display
> > > all the questions, with or without answer. The way it works currently,
> > > only the questions with answers get displayed.
> >
> > > On Jun 21, 8:41 am, Daniel Roseman  wrote:
> >
> > > > On Jun 21, 12:51 pm, JeffH  wrote:
> >
> > > > > I have some models that (simplified) look like the following.
> >
> > > > > class Answer(models.Model):
> > > > > id = models.CharField(max_length=32, primary_key=True)
> > > > > text = models.TextField(blank=False)
> > > > > question = models.ForeignKey(Question)
> > > > > candidate = models.ForeignKey(Candidate)
> >
> > > > > class Question(models.Model):
> > > > > id = models.CharField(max_length=32, primary_key=True)
> > > > > text = models.TextField(blank=False)
> >
> > > > > class Candidate(models.Model):
> > > > > id = models.CharField(max_length=32, primary_key=True)
> > > > > name = models.CharField(max_length=32, blank=False)
> >
> > > > > class Race(models.Model):
> > > > > id = models.CharField(max_length=32, primary_key=True)
> > > > > name = models.CharField(max_length=128, blank=False)
> > > > > questions = models.ManyToManyField(Question)
> > > > > candidates = models.ManyToManyField(Candidate)
> >
> > > > > So, a Race has Candidates and Questions, and a Candidate has
> Answers.
> > > > > Each answer is associated with a Question and a Candidate.
> Displaying
> > > > > the question associated with an answer is easy:
> >
> > > > > # context variable in view
> > > > > answers = Answer.objects.filter(candidate=candidate)
> >
> > > > > # template code
> > > > > 
> > > > > {% for answer in answers %}
> > > > > 
> > > > > {{answer.question.text}}
> > > > > {{answer.text}}
> > > > > 
> > > > > {% endfor %}
> > > > > 
> >
> > > > > From the point of view of the Candidate, I need to display all the
> > > > > questions, including the ones without Answers. I know how to to do
> > > > > this using raw sql and an outer join. How to do it in the orm?
> >
> > > > > Thanks in advance for any ideas.
> >
> > > > > --Jeff
> >
> > > > Not quite enough information here to answer. What are you wanting to
> > > > join? If you just want to display all the questions, why do you need
> a
> > > > join at all?
> > > > --
> > > > DR.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: outer join in orm

2010-06-21 Thread euan.godd...@googlemail.com
AFAIK there is no direct way to do this sort of thing in a single
query. select_related will only get foreign key relations into the
query so the ORM will always do an SQL query for each row in your many
to many. In these types of situations I tend to select everything I
need and then run some sort of pre-processing to put the two sets
together, thus ensuring only 2 queries rather than n+1 (where n is the
number of items in your original queryset).

Scott Gould's answer is about as good as you'll get I reckon.

On Jun 21, 3:37 pm, JeffH  wrote:
> That looks reasonable... but I wonder if the ORM can do it directly
> somehow. Anyone?
>
> On Jun 21, 10:14 am, Scott Gould  wrote:
>
> > There may well be a better way to do this, especially since it's been
> > a good year since I was struggling with this myself. (Very similar
> > case to yours, different subject matter of course.)
>
> > The way I ended up doing it was to use a template tag and some list
> > comprehensions to whittle things down. E.g.:
>
> > questions = Questions.objects.all()
> > answers = Answers.objects.filter(candidate=my_candidate)
>
> > questions_and_answers = [(q, [a for a in answers if a.question = q])
> > for q in questions]
>
> > ...which should give you a list of (question, )
> > tuples.
>
> > On Jun 21, 10:00 am, JeffH  wrote:
>
> > > To clarify: Each race has a set of questions. The candidate may have
> > > responded to none, some, or all. The answers are linked to the
> > > candidate (and to the question). For each candidate, I want to display
> > > all the questions, with or without answer. The way it works currently,
> > > only the questions with answers get displayed.
>
> > > On Jun 21, 8:41 am, Daniel Roseman  wrote:
>
> > > > On Jun 21, 12:51 pm, JeffH  wrote:
>
> > > > > I have some models that (simplified) look like the following.
>
> > > > > class Answer(models.Model):
> > > > >     id = models.CharField(max_length=32, primary_key=True)
> > > > >     text = models.TextField(blank=False)
> > > > >     question = models.ForeignKey(Question)
> > > > >     candidate = models.ForeignKey(Candidate)
>
> > > > > class Question(models.Model):
> > > > >     id = models.CharField(max_length=32, primary_key=True)
> > > > >     text = models.TextField(blank=False)
>
> > > > > class Candidate(models.Model):
> > > > >     id = models.CharField(max_length=32, primary_key=True)
> > > > >     name = models.CharField(max_length=32, blank=False)
>
> > > > > class Race(models.Model):
> > > > >     id = models.CharField(max_length=32, primary_key=True)
> > > > >     name = models.CharField(max_length=128, blank=False)
> > > > >     questions = models.ManyToManyField(Question)
> > > > >     candidates = models.ManyToManyField(Candidate)
>
> > > > > So, a Race has Candidates and Questions, and a Candidate has Answers.
> > > > > Each answer is associated with a Question and a Candidate. Displaying
> > > > > the question associated with an answer is easy:
>
> > > > > # context variable in view
> > > > >     answers = Answer.objects.filter(candidate=candidate)
>
> > > > > # template code
> > > > >     
> > > > >     {% for answer in answers %}
> > > > >     
> > > > >         {{answer.question.text}}
> > > > >         {{answer.text}}
> > > > >     
> > > > >     {% endfor %}
> > > > >     
>
> > > > > From the point of view of the Candidate, I need to display all the
> > > > > questions, including the ones without Answers. I know how to to do
> > > > > this using raw sql and an outer join. How to do it in the orm?
>
> > > > > Thanks in advance for any ideas.
>
> > > > > --Jeff
>
> > > > Not quite enough information here to answer. What are you wanting to
> > > > join? If you just want to display all the questions, why do you need a
> > > > join at all?
> > > > --
> > > > DR.

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



Re: How much would you charge for this? £5k? £15k? £50k?

2010-06-21 Thread ALJ
Hi Euan,

Cheers for that. It's my first Django project and I think in hindsight
I should have started on something a little easier. Nevermind. It's
been a good learning experience.

Before they told me the spec, they said they thought it would cost
about £3k!

Cheers

ALJ

On Jun 21, 4:12 pm, "euan.godd...@googlemail.com"
 wrote:
> It sounds like your project is pretty fully featured and if you claim
> to be "inexperienced" in Django development this much work is pretty
> impressive on a part-time basis over 6 months!
>
> Currently the Django project I am working on has taken over 2.5 years
> (and is ongoing). Although we don't just do Django, it's what we do
> most of the time. Our application has 213 models with 78742 lines of
> python code. I would estimate (although this is a bit of a guess) that
> the developer cost for this has been approximately £350k.
>
> You might be able to scale that to your workload.
>
> Hope that helps, Euan
>
> On Jun 21, 10:12 am, ALJ  wrote:
>
> > I'm just starting out with Django so using an hourly rate isn't really
> > applicable because I'm going to be much slower that a 'real'
> > developer. So far I've spent about 6 months part time.
>
> > What kind of ballpark amounts would people suggest this is worth?
>
> > I'm not going to tell you how much they think it was ... well maybe
> > I'll tell you later. I'm trying to help them out so it's considerably
> > cheaper than I think it should be.
>
> > What is it?
> > The application is helps the sales staff organize product
> > demonstrations around the country. They can book demonstrators to do
> > an event. The demonstrators do the events and then enter the details
> > of how it went. The system provides invoice generation, event tracking
> > and custom reporting.
>
> > Features
> > - Dynamic questionnaire and report form generation into pdf.
> > - Dynamic invoice generation into pdf.
> > - Work-flow with page locking, rollback and automatic email generation
> > on status change.
> > - Daily (and horribly complex) automatic summary excel reports
> > - Sales and questionnaire summary reports
>
> > - Designing and building the site
> > -- Models (about 32)
> > -- Setting up the admin interface
> > -- 12 key views plus goodness knows how many auxiliary views.
> > -- Look and feel
>
> > Other activities
> > - Weekly automatic importing of data from another accounting database
> > - Importing of existing event data.
> > - Importing of product prices and rates, existing staff details,
> > demonstrator details,
> > - Finding and setting up a VPS host
> > - Installing and configuring the site
> > - Support for a year (occasional changes, bug fixes and helping them
> > settle in)
> > - Training materials
>
> > ... and this doesn't even take into account the changes they made
> > halfway though. I should have been more formal with the spec but I
> > know them and didn't think it would be necessary. Once bitten 
>
> > Appreciate this is a bit finger in the air, but like I said ...
> > ballparking.
>
> > ALJ

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



Re: Actions after HttpResponse rendered?

2010-06-21 Thread DaNmarner
For one, I want to know if request_finished works here.

On Jun 21, 3:39 am, Daniel Roseman  wrote:
> On Jun 21, 6:46 am, DaNmarner  wrote:
>
> > There's a similar question as mine on stackoverflow.com:
>
> >http://stackoverflow.com/questions/1081340/how-do-you-do-something-af...
>
> > and there isn't a satisfactory answer there.
>
> > Basically, how do I do some thing after a view returns the response?
> > Does request_finished enables that kind of operations?
>
> Why do you think none of those answers is satisfactory? There are a
> few useful recommendations on that page. What exactly do you need that
> isn't covered?
> --
> DR.

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



HOW TO? multiple sites, one virtual host, routing settings.py?

2010-06-21 Thread ringemup
I'll soon be deploying a project that will need to be able to
dynamically add domains.

Each domain will have different users, separate data, and a different
SITE_ID, but will all run off a single Django instance.  The data will
all be housed in a single database, since all domains' data will need
to be accessible together via a global admin panel.

I'm thinking that the simplest way to accomplish this on the hosting
level would be a wildcard VirtualHost, and a separate settings.py for
each site that simply specifies the SITE_ID and pulls in the global
settings.

Is there an easy way to route each domain to a separate settings file
using a single virtual host?

(I'm open to different server models -- leaning towards mod_wsgi but
happy to use FCGI or mod_python if they'll make this more
straightforward.)

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



ModelForm with ManyToManyField on the other side

2010-06-21 Thread Skylar Saveland
class Material(models.Model):

products = ManyToManyField('Product', related_name='materials')

class Products(models.Model):

...

class ProductForm(forms.ModelForm):

class Meta:
model = Product
fields = ('materials', )

I want to do this.

I saw this discussion:

http://groups.google.com/group/django-users/browse_thread/thread/49213bf57a6a3033/cceb6912ad43fca0?show_docid=cceb6912ad43fca0&pli=1

And, I tried this snippet:
http://djangosnippets.org/snippets/1295/

The related names of this snippet make no sense.  If they are made to
make sense, then there would be an accessor clash.  Without the class,
the accessors are redundant at best...

Has any progress been made on this convenience or is the recommended
course just to create a non-Model form and make a save method?

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



Re: djapian not working with apach2

2010-06-21 Thread Skylar Saveland
I would guess that you are trying to access /index with the webserver
user but that is owned by another user and the user that owns the web
process has not the sufficient permissions to do the attempted
operation.  Set the permissions on the directory accordingly, perhaps
ownership as well.  You could just nuke the permissions with a chmod
777 /index (or so) if security is not crucial.  Otherwise you need to
give permissions to the dir to your webserver user in a less nukular
way.

You could also run the wsgi process(es) as the user of your choice
using perhaps 
http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDaemonProcess
hope that helps.

On Jun 21, 10:03 am, watad  wrote:
> hi all,
>
> im using djapian for my search , it seems to work fine when i run it
> in django development server
> but when i configure my sites to use apach2 im always getting this
> error when i try to search :
>
> "Caught OSError while rendering: [Errno 13] Permission denied: '/
> index'"
> i am sure it is not a folder permission issue because when i run my
> sites using ./manage.py runserver   i get the results of my search.
>
> im using mod_wsgi
>
> my locasites.conf :
>
> # ---
>
> 
>     ServerName mysite.name
>     ServerAlias mysitealias
>
>     WSGIScriptAlias / "/path/to/my/apache/file.wsgi"
>     
>         Allow from all
>     
>
>     Alias /site_media/ "/path/to/mysite/media/"
>     
>         Order allow,deny
>         Options Indexes FollowSymLinks
>         Allow from all
>         IndexOptions FancyIndexing
>     
>
>     Alias /media/ "/usr/local/lib/python2.6/dist-packages/django/
> contrib/admin/media/"
>      admin/media/">
>         Order allow,deny
>         Options Indexes FollowSymLinks
>         Allow from all
>         IndexOptions FancyIndexing
>     
>
> 
>
>  this is repeated for all the sites.
>
> can anyone help with issue
> regards

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



Running django-admin.py Commands without a Shell

2010-06-21 Thread maxweld
I am working with my virtual hosting provider to enable him support
Django. I have used him for ages, and having converted myself to
Django would like to help establish another hosting provider with
support for Django.

I have a configuration for his servers and virtual hosting environment
that works well, enabling the application to be developed on a
development server using Django's 'runserver', and then transferred to
the virtual hosting environment where the production service would
run.

I now need to work out how best to execute the various commands
provided by django-admin.py. The hosted environment provides no shell
access, only FTP to copy files to the site and phpMyAdmin to manage
the database tables. This is basically a security feature.

I would like to be able to execute django-admin.py through a web
interface, ideally capturing the output and displaying it back to the
user. Has this ever been tried before? Does anybody know of a package
doing this? Am I crazy?

Some insight from the community would be useful. Thanks in advance.

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



How to map url **kwargs

2010-06-21 Thread Sells, Fred
First I'm new 2 django and have made rapid progress building my app
based on the tutorial.  As soon as I get it a little better, I'll clean
it up and remove the "mysite/polls" references.

I have a series of url's like this

/mysite/myapp/datagrid/clients?letter=A
/mysite/myapp/datagrid/reports
/mysite/myapp/datagrid/reports?client=LA12345
/mysite/myapp/datagrid/stores/userid=mary

I would like to map these to the same view.py method

def datagrid(request, gridtype, **options):
#where gridtype is one of clients, reports, stores
#And options contains any parameters in the URL


I would like to NOT define the legal options in the URL, because that
gives me two places to define them (3 if you count the client) and
frankly I'm not that skilled at regex.  I've gotten this far, which maps
the gridtype, but cannot get the parameters, even if I explicitly name
them.  Can someone explain what I'm doing wrong?

Mysite/polls/urls.py contains
urlpatterns = patterns('mysite.polls.views',
(r'^datagrid/([a-z]*)/', 'datagrid'),
...
)

And mysite/urls.py contains

urlpatterns = patterns('',
(r'^myapp/', include('mysite.polls.urls')  ),
)

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



Re: djapian not working with apach2

2010-06-21 Thread Graham Dumpleton


On Jun 22, 12:03 am, watad  wrote:
> hi all,
>
> im using djapian for my search , it seems to work fine when i run it
> in django development server
> but when i configure my sites to use apach2 im always getting this
> error when i try to search :
>
> "Caught OSError while rendering: [Errno 13] Permission denied: '/
> index'"
> i am sure it is not a folder permission issue because when i run my
> sites using ./manage.py runserver   i get the results of my search.
>
> im using mod_wsgi
>
> my locasites.conf :
>
> # ---
>
> 
>     ServerName mysite.name
>     ServerAlias mysitealias
>
>     WSGIScriptAlias / "/path/to/my/apache/file.wsgi"
>     
>         Allow from all
>     
>
>     Alias /site_media/ "/path/to/mysite/media/"
>     
>         Order allow,deny
>         Options Indexes FollowSymLinks
>         Allow from all
>         IndexOptions FancyIndexing
>     
>
>     Alias /media/ "/usr/local/lib/python2.6/dist-packages/django/
> contrib/admin/media/"
>      admin/media/">
>         Order allow,deny
>         Options Indexes FollowSymLinks
>         Allow from all
>         IndexOptions FancyIndexing
>     
>
> 
>
>  this is repeated for all the sites.
>
> can anyone help with issue

Don't use relative path names in your code, you must use absolute path
names.

As the current working directory under Apache is usually '/', relative
path names will resolve relative to that and not your site directory
as with runserver. Thus, if you have simple 'index' in your code as
relative path name, that will resolve to '/index' and because Apache
user cannot write to '/' directory you will get an OSError like you
are seeing.

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



Re: Force ContentType id

2010-06-21 Thread Russell Keith-Magee
On Mon, Jun 21, 2010 at 8:49 PM, donato.gr  wrote:
> I had to clean my application database from old models without losing
> data.
> So, I copied my tables to another db, dropped them, run syncdb and
> copied data back.
> But the app stopped working, because some tables used GenericRelations
> and still pointed to the old ContentType; so, I had to change that id
> manually.
>
> Is there a way to force the id of a model in django_content_type
> table?

No - the content type handling is completely automated and
non-optional. There's also no way to force a given model to have a
specific content type id.

However, you may be able to correct the problem using fixtures. Either
dump the contenttypes from your old database; if you don't have the
old database anymore, then dump the contenttypes of the new database
into a fixture, and manually modify the primary keys.

If you're using a database without referential integrity, you may be
able to simply dump the current contents of the contenttypes table and
load your corrected fixture. If you're using Postgres, this approach
will cacade delete any foreign keys on ContentType, so you'll need to
dump the entire database *except* for the contenttype table, load your
fixture, then run sycndb to get the remaining tables. syncdb won't
create new contenttypes if a record already exists, so it will use the
contenttypes from your fixture.

> Or, is there a way to run a syncdb to apply changes without losing
> data?

I'm not sure what you're asking here -- syncdb is *never* destructive.
Running syncdb should never result in data loss.

Yours,
Russ Magee %-)

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



Weekly rss feed

2010-06-21 Thread TheIvIaxx
Hello all, i tried searching for a solution to this but didn't find
it.  If it's answered somewhere, please point me in the right
direction :)

I was wondering how to create a weekly feed for django.  Lets say i
have a table of objects that gets added to all week long.  I'd like to
allow people to subscribe to a feed that would give a single update
with all items that were added that week.  Since the client doesn't
send anything about when it last checked for updates, it's hard to
determine if the requesting client needs to be given an update or not.

With a podcast or blog, you just post the new item each week and it
works fine, but for something that needs to pool updates for a given
time range is not working out.

Is there a common way to do this?

Thanks

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



Re: Running django-admin.py Commands without a Shell

2010-06-21 Thread Russell Keith-Magee
On Tue, Jun 22, 2010 at 4:08 AM, maxweld  wrote:
> I am working with my virtual hosting provider to enable him support
> Django. I have used him for ages, and having converted myself to
> Django would like to help establish another hosting provider with
> support for Django.
>
> I have a configuration for his servers and virtual hosting environment
> that works well, enabling the application to be developed on a
> development server using Django's 'runserver', and then transferred to
> the virtual hosting environment where the production service would
> run.
>
> I now need to work out how best to execute the various commands
> provided by django-admin.py. The hosted environment provides no shell
> access, only FTP to copy files to the site and phpMyAdmin to manage
> the database tables. This is basically a security feature.

There is a way to do this, but for some reason it doesn't appear to be
documented (which is itself a bug that should be logged).

However, the technique is mentioned in passing in the 1.0 porting guide:

http://docs.djangoproject.com/en/dev/releases/1.0-porting-guide/#running-management-commands-from-your-code

Ignore the old-style syntax, and just look at new-style
management.call_command syntax. That allows you to call any management
command you want, with whatever command-line arguments you want.

> I would like to be able to execute django-admin.py through a web
> interface, ideally capturing the output and displaying it back to the
> user. Has this ever been tried before? Does anybody know of a package
> doing this? Am I crazy?

The output capture is the only difficult part; historically, admin
commands have directly written out stdout.

You can work around this with some monkeypatching of sys.stdout/stderr
-- it's not pretty, but it does work.

The good news is that in trunk, we've started to rectify this. We've
added self.stdout and self.stderr to management commands; these act as
mirrors of sys.stdout and sys.stderr by default, but you can
programatically set them to be any other stream you want. See

http://docs.djangoproject.com/en/dev/howto/custom-management-commands/

for usage, and the fixtures modeltest for an example of usage (and,
for that matter, of an example of usage of call_command).

Yours,
Russ Magee %-)

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



Re: outer join in orm

2010-06-21 Thread JeffH
Doing a nested list comp has to be less efficient than an outer join
done at the db level. For my issue, it's a relatively small data set,
so I'd rather be more pythonic than eg running raw sql. Nonetheless, I
view this as a weakness in Django's ORM, and would plead with TPTB to
provide a solution, not that it would affect my current problem.

On Jun 21, 11:46 am, "euan.godd...@googlemail.com"
 wrote:
> AFAIK there is no direct way to do this sort of thing in a single
> query. select_related will only get foreign key relations into the
> query so the ORM will always do an SQL query for each row in your many
> to many. In these types of situations I tend to select everything I
> need and then run some sort of pre-processing to put the two sets
> together, thus ensuring only 2 queries rather than n+1 (where n is the
> number of items in your original queryset).
>
> Scott Gould's answer is about as good as you'll get I reckon.
>
> On Jun 21, 3:37 pm, JeffH  wrote:
>
> > That looks reasonable... but I wonder if the ORM can do it directly
> > somehow. Anyone?
>
> > On Jun 21, 10:14 am, Scott Gould  wrote:
>
> > > There may well be a better way to do this, especially since it's been
> > > a good year since I was struggling with this myself. (Very similar
> > > case to yours, different subject matter of course.)
>
> > > The way I ended up doing it was to use a template tag and some list
> > > comprehensions to whittle things down. E.g.:
>
> > > questions = Questions.objects.all()
> > > answers = Answers.objects.filter(candidate=my_candidate)
>
> > > questions_and_answers = [(q, [a for a in answers if a.question = q])
> > > for q in questions]
>
> > > ...which should give you a list of (question, )
> > > tuples.
>
> > > On Jun 21, 10:00 am, JeffH  wrote:
>
> > > > To clarify: Each race has a set of questions. The candidate may have
> > > > responded to none, some, or all. The answers are linked to the
> > > > candidate (and to the question). For each candidate, I want to display
> > > > all the questions, with or without answer. The way it works currently,
> > > > only the questions with answers get displayed.
>
> > > > On Jun 21, 8:41 am, Daniel Roseman  wrote:
>
> > > > > On Jun 21, 12:51 pm, JeffH  wrote:
>
> > > > > > I have some models that (simplified) look like the following.
>
> > > > > > class Answer(models.Model):
> > > > > >     id = models.CharField(max_length=32, primary_key=True)
> > > > > >     text = models.TextField(blank=False)
> > > > > >     question = models.ForeignKey(Question)
> > > > > >     candidate = models.ForeignKey(Candidate)
>
> > > > > > class Question(models.Model):
> > > > > >     id = models.CharField(max_length=32, primary_key=True)
> > > > > >     text = models.TextField(blank=False)
>
> > > > > > class Candidate(models.Model):
> > > > > >     id = models.CharField(max_length=32, primary_key=True)
> > > > > >     name = models.CharField(max_length=32, blank=False)
>
> > > > > > class Race(models.Model):
> > > > > >     id = models.CharField(max_length=32, primary_key=True)
> > > > > >     name = models.CharField(max_length=128, blank=False)
> > > > > >     questions = models.ManyToManyField(Question)
> > > > > >     candidates = models.ManyToManyField(Candidate)
>
> > > > > > So, a Race has Candidates and Questions, and a Candidate has 
> > > > > > Answers.
> > > > > > Each answer is associated with a Question and a Candidate. 
> > > > > > Displaying
> > > > > > the question associated with an answer is easy:
>
> > > > > > # context variable in view
> > > > > >     answers = Answer.objects.filter(candidate=candidate)
>
> > > > > > # template code
> > > > > >     
> > > > > >     {% for answer in answers %}
> > > > > >     
> > > > > >         {{answer.question.text}}
> > > > > >         {{answer.text}}
> > > > > >     
> > > > > >     {% endfor %}
> > > > > >     
>
> > > > > > From the point of view of the Candidate, I need to display all the
> > > > > > questions, including the ones without Answers. I know how to to do
> > > > > > this using raw sql and an outer join. How to do it in the orm?
>
> > > > > > Thanks in advance for any ideas.
>
> > > > > > --Jeff
>
> > > > > Not quite enough information here to answer. What are you wanting to
> > > > > join? If you just want to display all the questions, why do you need a
> > > > > join at all?
> > > > > --
> > > > > DR.
>
>

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



Re: Weekly rss feed

2010-06-21 Thread Andy McKay

On 2010-06-21, at 5:48 PM, TheIvIaxx wrote:
> I was wondering how to create a weekly feed for django.  Lets say i
> have a table of objects that gets added to all week long.  I'd like to
> allow people to subscribe to a feed that would give a single update
> with all items that were added that week.  Since the client doesn't
> send anything about when it last checked for updates, it's hard to
> determine if the requesting client needs to be given an update or not.

A few points:

- RSS readers keep track of all the things that have been read and don't 
display duplicates, so I don't really see a need for doing this anyway

- You maybe want a script that runs once a week and produces a summary post of 
all the things entered that week, but that just gives you one item.

- Or you just do a query that specifies the time range, eg: filter and only 
show posts in the last seven days.
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

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



One to many django pagination

2010-06-21 Thread Jx
Hi,

i recently encountered a problem due to inefficient performance of
django pagination. After researching, i realized that there is a need
to use django database queries when dealing with django-pagination as
"LIMIT" will automatically be added. This is useful especially when
dealing with huge chunk of data.

However, i came across a problem where i could not figure out how to
use django database query to extract the data.

Lets say i have 3 tables, "Teachers", "Students", and
"Teachers_profile" with a one-many relationship.

The Teacher table contains teacher_id,.(teacher info)
The Student table contains student_id,name,...(student info)
The Teacher_profile table is the link between the 2 tables. It
contains teacher_id,student_id

How can i use django database query with filters to extract the
teachers who is managing a student named "Jonny" for example?

i'm not sure if this is an easy question, but i'm having some trouble
in solving 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Weekly rss feed

2010-06-21 Thread TheIvIaxx
The problem with the first is that users would get a bunch of single
items whenever they were added to the DB.  I need to give them a
digest of what happened that week.  I had thought of the range idea,
but then you're hitting the DB every hour all week for a single update
which doesn't sound correct.  So i think i'll have a cron task just
update a field in a table each week that the actual Feed view will
pull from.  It's still a db hit, but a very simple one.

On Jun 21, 6:15 pm, Andy McKay  wrote:
> On 2010-06-21, at 5:48 PM, TheIvIaxx wrote:
>
> > I was wondering how to create a weekly feed for django.  Lets say i
> > have a table of objects that gets added to all week long.  I'd like to
> > allow people to subscribe to a feed that would give a single update
> > with all items that were added that week.  Since the client doesn't
> > send anything about when it last checked for updates, it's hard to
> > determine if the requesting client needs to be given an update or not.
>
> A few points:
>
> - RSS readers keep track of all the things that have been read and don't 
> display duplicates, so I don't really see a need for doing this anyway
>
> - You maybe want a script that runs once a week and produces a summary post 
> of all the things entered that week, but that just gives you one item.
>
> - Or you just do a query that specifies the time range, eg: filter and only 
> show posts in the last seven days.
> --
>   Andy McKay, @andymckay
>   Django Consulting, Training and Support

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



Re: automatic documentation (docutils) does not pull in class methods?

2010-06-21 Thread pk
Answering my own question -- it is django.contrib.admindocs.view that
limits the admindocs view to only list methods on a model that has a
single argument. The lines:

  for func_name, func in model.__dict__.items():
  if (inspect.isfunction(func) and len(inspect.getargspec(func)
[0]) == 1):

There is currently an open ticket http://code.djangoproject.com/ticket/12974
that patches it to handle
the case where methods have decorator on them, hence reducing the
number of args to zero.

My question is why are we limiting the list of methods to single
argument (self) methods?
I put business logic in the model and usually the models will have
many more methods
that take additional arguments.

P.K.

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