Setting Up Django on Vista and Creating a Database

2008-11-10 Thread John Antony

I am currently using Vista OS
I have installed Python in the path
D:\Python26\
and extracted the tarred file downloaded from www.djangoprojects.com
ie "Django-1.0.tar.gz" in the path
D:\Python26\Django-1.0\Django-1.0
I am however unable to intall Django
on typing the following command in command prompt I get this error:

D:\Python26\Django-1.0\Django-1.0>python setup.py install
'python' is not recognized as an internal or external command,
operable program or batch file.

If I use the Python (command line) found in Start>All Programs>Python
2.6

>>> D:\Python26\Django-1.0\Django-1.0>python setup.py install
File "", line 1

How do i install Django on my system..??

Also post intallation I wish to create a Database with username and
password all with the same name ie "myforum"

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



Re: Using Django

2008-11-10 Thread Wayne Dyck

It looks to me like your line 21 is outside the patterns set so it's
just a line of code hanging out there on its own.

Try this,

urlpatterns = patterns('',
(r'^$', 'SITENAME.polls.views.current_datetime'),
(r'^polls/$', 'SITENAME.polls.views.index'),
(r'^polls/(?P\d+)/$', 'SITENAME.polls.views.detail'),
(r'^polls/(?P\d+)/results/$', 'SITENAME.polls.views.results'),
(r'^polls/(?P\d+)/vote/$', 'SITENAME.polls.views.vote'),
(r'^admin/(.*)', admin.site.root),
)

Wayne

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



Re: Using Django

2008-11-10 Thread Daniel Roseman

On Nov 11, 6:52 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> It appears that the 500 error was a result of Dreamhost's process
> watcher killing scripts. I'm still not sure where the problem is
> originating from but coincidently I am now getting syntax errors from
> django i.e., no 500 errors - at current time. Does anyone know why I
> am getting a syntax error form this:
>
> Exception Value:        invalid syntax (urls.py, line 21)
>
> from django.conf.urls.defaults import *
>
> # Uncomment the next two lines to enable the admin:
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>     (r'^$', 'SITENAME.polls.views.current_datetime'),
>     (r'^polls/$', 'SITENAME.polls.views.index'),
>     (r'^polls/(?P\d+)/$', 'SITENAME.polls.views.detail'),
>     (r'^polls/(?P\d+)/results/$',
> 'SITENAME.polls.views.results'),
>     (r'^polls/(?P\d+)/vote/$', 'SITENAME.polls.views.vote'),
> )
>
>     # Uncomment the admin/doc line below and add
> 'django.contrib.admindocs'
>     # to INSTALLED_APPS to enable admin documentation:
>     # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
>
>     # Uncomment the next line to enable the admin:
>     (r'^admin/(.*)', admin.site.root), # LINE 21
> )
>
> Thanks for all the help,
>
> Jason

You have a close bracket on the line after polls, and then another one
(at the same level) on the final line. I think you want to remove the
first one.
--
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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Sync Database failed, using "python manage.py syncdb"

2008-11-10 Thread Daniel Roseman

On Nov 11, 1:18 am, Sean <[EMAIL PROTECTED]> wrote:
> When I run the command "python manage.py syncdb" to sync database, but
> failed
>
> I got the following error messages:
>
> File "C:\Python25\Lib\site-packages\django\contrib\auth\management
> \_init_.py". line 47 , in 
> signals.post_syncdb.connect object has no attribute 'connect''>
>
> I got django1.0, Python2.52, Apache2.2.9, MySQL5.0.67,
> PHPMyAdmin2.11.9.2
>
> Can anyone please help!

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



Re: Using Django

2008-11-10 Thread [EMAIL PROTECTED]

It appears that the 500 error was a result of Dreamhost's process
watcher killing scripts. I'm still not sure where the problem is
originating from but coincidently I am now getting syntax errors from
django i.e., no 500 errors - at current time. Does anyone know why I
am getting a syntax error form this:

Exception Value:invalid syntax (urls.py, line 21)

from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^$', 'SITENAME.polls.views.current_datetime'),
(r'^polls/$', 'SITENAME.polls.views.index'),
(r'^polls/(?P\d+)/$', 'SITENAME.polls.views.detail'),
(r'^polls/(?P\d+)/results/$',
'SITENAME.polls.views.results'),
(r'^polls/(?P\d+)/vote/$', 'SITENAME.polls.views.vote'),
)


# Uncomment the admin/doc line below and add
'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
(r'^admin/(.*)', admin.site.root), # LINE 21
)


Thanks for all the help,

Jason
On Nov 7, 7:32 am, Blu3ness <[EMAIL PROTECTED]> wrote:
> 500 error will generate a error log in your ~/logs/ directory, do a
> little research on it, or maybe post it here :)
>
> On Nov 6, 1:58 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > I think I had the .htaccess and dispatch.fcgi  files in the wrong
> > place. I had them in the django generated mysite directory rather the
> > than the domain, but now when I go to mysite.com I get the 500
> > internal server error. This happened when I tried the Jeff Croft
> > setup:http://jeffcroft.com/blog/2006/may/11/django-dreamhost/which
> > is where I heard about the Gordon Tillman fix. Thanks for the help
> > thus far and any related to my new problem.
>
> > Jason
>
> > On Nov 6, 9:56 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > I used the Gordon Tillman 
> > > setup:http://www.gordontillman.info/Development/DjangoDreamhost
> > > here are the dispatch.fcgi and .htaccess files:
>
> > > // dispatch.fcgi
>
> > > #!/usr/bin/env python2.4
> > > import sys, os
>
> > > # Add a custom Python path.
> > > sys.path.insert(0, "/home/USERNAME/projects/django/trunk")
> > > sys.path.insert(0, "/home/USERNAME/projects/flup/trunk")
> > > sys.path.insert(0, "/home/USERNAME/projects")
>
> > > //.htaccess
>
> > > # Set the DJANGO_SETTINGS_MODULE environment variable.
> > > os.environ['DJANGO_SETTINGS_MODULE'] = "mysite.settings"
>
> > > from django.core.servers.fastcgi import runfastcgi
> > > runfastcgi(method="threaded", daemonize="false")
>
> > > AddHandler fastcgi-script .fcgi
> > > RewriteEngine On
> > > RewriteBase /
> > > RewriteRule ^(media/.*)$ - [L]
> > > RewriteRule ^(admin_media/.*)$ - [L]
> > > RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
> > > RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>
> > > Here is my directory structure:
>
> > > home/USERNAME/
> > >    www.mysite.com/
> > >    www.anothersite.com/
> > >    www.yetanothersite.com/
> > >    projects/
> > >       django/
> > >       flup/
> > >       django_templates/
> > >       media/
> > >       mysite/
>
> > > On Nov 5, 5:56 pm, AndyB <[EMAIL PROTECTED]> wrote:
>
> > > >http://wiki.dreamhost.com/index.php/Django
>
> > > > Have you got the .htaccess, dispatch.fcgi etc all set up?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Sending mass, yet personalised email newsletters using Django

2008-11-10 Thread Doug B

I can't claim best way, but the way we do it is to have a few django
models for storing the messages, and some help from the email, and
smptlib libraries.

Models:
Mailserver: model for storing connection information for connecting to
a standard smtp server, with mixin class using smtplib to provide smtp
connection.
BulkMail: Unrendered Template, and M2M relationship to users. Fk to
Mailserver.  This model generates Queued messages, in batches until
all recipients have a message queued (we trickle messages out).
QueuedMessage: Rendered message (pickled email.MimeMultipart object),
Fkeys to user, Bulkmail (if message was generated by the BulkMailer)
and Mailserver.

Every 15min a Bulk Mail cron to generate messages into the queue.
Depending on options one bulk mail object may trickle out the messages
until all are sent.
Every minute a cron runs to check for pending QueuedMessage objects,
and sends them to a real smtp server in batches [something like
mailserver_object.process_queue(priority=N,limit=100)]
Another cron using poplib to check the sending POP3 account for
unsubscribe requests, and for bounces using GNU Mailman (it's python,
and pretty simple to throw on your path and use the BouncerAPI for
bounce detection). Anything that isn't an unsub or bounce gets cloned/
forwarded to a human read pop account.
The crons do some checking using memcache okeys to make sure only one
process is doing mail at any one time, and no messages get stuck in a
loop.

All in all, it's been working great.  It takes very little time to
generate the messages and lets a real mail server handle the heavy
lifting/retries.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: apache and django

2008-11-10 Thread Graham Dumpleton

Are you setting up Apache to serve your Django static media as
instructions indicate you to do?

If you have, have you put in the direct URL to where the static media
should hosted into your browser to see if it works? Have you then
compared that URL to what HTML pages are trying to access for the
same?

Graham

On Nov 11, 3:17 pm, prem1er <[EMAIL PROTECTED]> wrote:
> Hey everyone, thanks for all your help.
>
> I'm currently able to get django running now on apache.  But the style
> sheets aren't working so I'm guessing I have the paths wrong somewhere
> in my apache config.  Anyone see a problem?  I feel like it has to do
> with
>
> PythonOption django.root /
>
> When I have this line in the config the admin site doesn't work.  When
> I don't the admin works, but with no style sheet.
>
> On Nov 10, 7:19 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > On Nov 10, 5:50 pm, "DULMANDAKH Sukhbaatar" <[EMAIL PROTECTED]>
> > wrote:
>
> > > > Ok.  But are the configuration lines any different or will they
> > > > change.  If anyone has a good tutorial written could you please post
> > > > it.  Also, What does this line mean ?
> > > > SetEnv DJANGO_SETTINGS_MODULE mysite.settings
>
> > > Seehttp://httpd.apache.org/docs/2.2/mod/mod_env.html. I suggest you
> > > to do some research by yourself.
>
> > Note that SetEnv in Apache is traditionally used for CGI scripts and
> > would dictate what operating system environment variables are set in
> > the separate process created to run the CGI script. It does not in
> > itself change operating system environment variables for the Apache
> > child worker processes where Django runs itself.
>
> > When Django is run with mod_python however, Django is taking the
> > variables set by SetEnv and forcibly updating os.environ and as a side
> > affect also updating the operating system environment variables as
> > well. This is actually somewhat bad practice for anything running
> > directly under an Apache module as it will affect code running under
> > other Apache modules as well, eg, PHP. Things can get even worse if
> > running multiple Django instances in a multithreaded server
> > configuration and setting overlapping sets of variables to different
> > values as you can end up with race conditions on values of operating
> > system environment variables as seen by C code or other Apache
> > modules.
>
> > In other words, it isn't that simple and Django in the long term
> > should target getting rid of reliance on variables in os.environ.
>
> > FWIW, with mod_wsgi anything defined using SetEnv only populates the
> > per request WSGI environment dictionary and not the process level
> > operating system environment variables. At this stage though, Django
> > cannot use per request environment that WSGI provides and so manual
> > step of setting os.environ still required. At least updating
> > os.environ is only done once when WSGI script loaded and not on every
> > request like mod_python.
>
> > So, it isn't as simple as you may think. :-)
>
> > Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Switching my website to Django

2008-11-10 Thread Douglass Clem
Hello fellow geeks. I'm quite new to Django (just finished the tutorials),
and have decided that when I switch my website host early next year, I'll be
building the new site on Django. I am looking for advice, and have posted my
hopes/plans on my current blog (link below). If some of you could check it
out, and give me advice / constructive criticism, I would be greatly
appreciative.

http://crashsystems.net/2008/11/great-gobs-of-code/

Douglass Clem
crashsystems.net
Public Key: http://crashsystems.net/pubkey.asc

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



Re: ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.

2008-11-10 Thread ayayalar

Thank you for the reply Karen. your suggestion worked just fine.

On Nov 10, 9:29 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Mon, Nov 10, 2008 at 6:10 PM, ayayalar <[EMAIL PROTECTED]> wrote:
>
> > Hello I am new to Django.
>
> > I am trying to exercise "templates" through the interactive shell,
> > however I end up getting this error. Can anyone help?
>
> > here is the exact steps I follow:
>
> > 1) cd C:\Django\mysite
>
> >    manage.py
> >    settings.py
> >    settings.pyc
> >    urls.py
> >    urls.pyc
> >    views.py
> >    views.pyc
> >    __init__.py
> >    __init__.pyc
>
> > 2) set DJANGO_SETTINGS_MODULE=mysite.settings I've also tried set
> > DJANGO_SETTINGS_MODULE=settings.py
>
> Setting it to mysite.settings will work if c:\django is on your PYTHONPATH.
>
> Setting it to settings.py won't work at all because of the .py.  Assuming
> you are running the python from c:\django\mysite, setting
> DJANGO_SETTINGS_MODULE to just 'settings' will work.  Or, use 'python
> manage.py shell', which assumes settings.py is in the current directory and
> sets the environment up for you.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: apache and django

2008-11-10 Thread prem1er

Hey everyone, thanks for all your help.

I'm currently able to get django running now on apache.  But the style
sheets aren't working so I'm guessing I have the paths wrong somewhere
in my apache config.  Anyone see a problem?  I feel like it has to do
with

PythonOption django.root /

When I have this line in the config the admin site doesn't work.  When
I don't the admin works, but with no style sheet.


On Nov 10, 7:19 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Nov 10, 5:50 pm, "DULMANDAKH Sukhbaatar" <[EMAIL PROTECTED]>
> wrote:
>
> > > Ok.  But are the configuration lines any different or will they
> > > change.  If anyone has a good tutorial written could you please post
> > > it.  Also, What does this line mean ?
> > > SetEnv DJANGO_SETTINGS_MODULE mysite.settings
>
> > Seehttp://httpd.apache.org/docs/2.2/mod/mod_env.html. I suggest you
> > to do some research by yourself.
>
> Note that SetEnv in Apache is traditionally used for CGI scripts and
> would dictate what operating system environment variables are set in
> the separate process created to run the CGI script. It does not in
> itself change operating system environment variables for the Apache
> child worker processes where Django runs itself.
>
> When Django is run with mod_python however, Django is taking the
> variables set by SetEnv and forcibly updating os.environ and as a side
> affect also updating the operating system environment variables as
> well. This is actually somewhat bad practice for anything running
> directly under an Apache module as it will affect code running under
> other Apache modules as well, eg, PHP. Things can get even worse if
> running multiple Django instances in a multithreaded server
> configuration and setting overlapping sets of variables to different
> values as you can end up with race conditions on values of operating
> system environment variables as seen by C code or other Apache
> modules.
>
> In other words, it isn't that simple and Django in the long term
> should target getting rid of reliance on variables in os.environ.
>
> FWIW, with mod_wsgi anything defined using SetEnv only populates the
> per request WSGI environment dictionary and not the process level
> operating system environment variables. At this stage though, Django
> cannot use per request environment that WSGI provides and so manual
> step of setting os.environ still required. At least updating
> os.environ is only done once when WSGI script loaded and not on every
> request like mod_python.
>
> So, it isn't as simple as you may think. :-)
>
> Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error in: python manage.py syncdb

2008-11-10 Thread Karen Tracey
On Mon, Nov 10, 2008 at 8:16 PM, Sean <[EMAIL PROTECTED]> wrote:

>
> When I run the command python manage.py syncdb to sync database, but
> failed
>
> I got the following error messages:
>
> File "C:\Python25\Lib\site-packages\django\contrib\auth\management
> \_init_.py". line 47 , in 
> signals.post_syncdb.connect object has no attribute 'connect''>
>
> I got django1.0, Python2.52, Apache2.2.9, MySQL5.0.67,
> PHPMyAdmin2.11.9.2
>
>
Are you sure you have a clean install of Django 1.0? That's a somewhat
mangled (there should be a paren, not an angle bracket, before
create_permissions, AttributeError should start a new line, the first object
should have an end quote, etc.) version of the error you would get if you
had 1.0 code in django\contrib\auth\management but 0.96 level code in
django\db\models\signals.py.  You might want to delete the whole
c:\Python25\Lib\site-packages\django tree and re-install Django 1.0.

Karen

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



Re: ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.

2008-11-10 Thread Karen Tracey
On Mon, Nov 10, 2008 at 6:10 PM, ayayalar <[EMAIL PROTECTED]> wrote:

>
> Hello I am new to Django.
>
> I am trying to exercise "templates" through the interactive shell,
> however I end up getting this error. Can anyone help?
>
> here is the exact steps I follow:
>
> 1) cd C:\Django\mysite
>
>manage.py
>settings.py
>settings.pyc
>urls.py
>urls.pyc
>views.py
>views.pyc
>__init__.py
>__init__.pyc
>
> 2) set DJANGO_SETTINGS_MODULE=mysite.settings I've also tried set
> DJANGO_SETTINGS_MODULE=settings.py
>

Setting it to mysite.settings will work if c:\django is on your PYTHONPATH.

Setting it to settings.py won't work at all because of the .py.  Assuming
you are running the python from c:\django\mysite, setting
DJANGO_SETTINGS_MODULE to just 'settings' will work.  Or, use 'python
manage.py shell', which assumes settings.py is in the current directory and
sets the environment up for you.

Karen

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



Aborting streaming uploads using UploadFileExceptions

2008-11-10 Thread Carmelly

The idea is, I would like to detect and abort an upload where the file
size is over a certain limit, or if it's not a video file. Now with
streaming uploads, this should be possible. I've written an upload
handler:

class UploadValidationHandler(FileUploadHandler):

def handle_raw_input(self, input_data, META, content_length,
boundary, encoding):
self.content_length = content_length

def new_file(self, field_name, file_name, content_type,
content_length, charset):

 # check that the file size is within the limit
from django.conf import settings
max_bytes = settings.MAX_FILM_MB * 1024 * 1024
if self.content_length > max_bytes:
# UploadValidationError is a subclass of
django.core.files.uploadhandler.StopUpload
raise UploadValidationError("The file is larger than %d
MB" % settings.MAX_FILM_MB)

 # check that it is a video file
import re
print content_type
if not re.search("video", content_type):
raise UploadValidationError("The file is not a video
file.")

def receive_data_chunk(self, raw_data, start):
return raw_data

def file_complete(self, file_size):
pass


In my view I wrap
request.upload_handlers.append(UploadValidationHandler(request)) with
a try-except, and if I catch a StopUpload exception, I add a message
to the form's validation errors and render the form page to show the
user.

At first when I was testing this, I was sure it was working, because
there seemed to be no significant time lapse between sending the file
and getting the page back with the error message. Unfortunately, this
isn't what happened once I tested from another machine (silly me,
trying to upload to my own machine). Now it takes a very long time for
the request to finish and to get back the form with the error... long
enough so that I think the file is actually completely uploaded first,
and THEN the StopUpload exception gets raised. But I need it to be
instantaneous... what's going on?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Recommendation system problem

2008-11-10 Thread Mr. Z

Jonathan,

Thank you! I've tried the code you posted and it works like a charm.
It really has helped me to understand how to do it. I have modified it
to include also a calculation for how many teas have in common Peter
and the people with at least one of the same teas as Peter. This way I
can then apply some "weight" to the recommendations, so depending on
how "similar" peter's and person X's tastes are (more/less teas in
common), the concrete recommendation of person X is more or less
important and I can add a higher or lower value to that person's
recommendations.


This is the code right now:


peter = Person.objects.get(name='Peter')
peter_likes_ids = peter.likes.values_list('id', flat=True)

# People who like at least one of the same teas as Peter, and how
much of teas in common do they have (like_same_count)
similarities =
Person.objects.filter(likes__in=peter_likes_ids).exclude(id=peter.id).extra(
select={
'like_same_count': 'COUNT(%s.kindoftea_id)' %
Person._meta.get_field('likes').m2m_db_table(),
},
order_by=['id', 'name']
)
people_table = Person._meta.db_table
similarities.query.group_by.extend(['%s.id' % people_table,
'%s.name' % people_table])
similarities.values_list('id','name','like_same_count')

# just the ids of the people who like at least one tea of the same
teas as Peter
people = similarities.values_list('id', flat=True)

# Teas liked by the above people, excluding the teas Peter likes
recommendations = KindOfTea.objects.filter(
  liked_by__in=people).exclude(id__in=peter_likes_ids).extra(
  select={
  'like_count': 'COUNT(%s.kindoftea_id)' %
Person._meta.get_field('likes').m2m_db_table(),
  },
  order_by=['-like_count', 'name']
  )
tea_table = KindOfTea._meta.db_table
recommendations.query.group_by.extend(['%s.id' % tea_table,
'%s.name' % tea_table])
# 3-tuples of (tea id, tea name, relevant people who like it
count)
recommendations.values_list('id', 'name', 'like_count')


I have tried to order similarities by '-like_same_count' but it always
gives an error: "Cannot resolve keyword 'like_same_count' into field.
Choices are: id, likes, name" . I don't know why this is happening
because I have set like_same_count as an extra parameter in the select
statement for similarities.


I'll try to add the weight calculation and post the solution here.


Regards.


On 10 nov, 02:43, Jonathan Buchanan <[EMAIL PROTECTED]>
wrote:
> Mr.Zwrote:
> > I have these models:
>
> > KindOfTea(models.Model):
> >     name = models.CharField(max_length=100, unique=True)
> >     description = models.TextField()
>
> > Person(models.Model):
> >     name = models.CharField(max_length=100, unique=True)
> >     likes = models.ManyToManyField(KindOfTea, related_name='liked_by')
>
> > I have 1 Person object and some related KindOfTea objects he likes.
> > With this information I want to know which other new kinds of tea he
> > would like. What I want to do is to get the other Person objects that
> > like the same kinds of tea as this person and obtain all the other
> > kinds of tea they like ordered by how many of them like the same one.
>
> > For example:
> > =
> > Peter likes black tea and white tea
> > Laura likes black tea, green tea and red tea
> > Paul likes black tea, green tea and red tea
> > John likes black tea, green tea and yellow tea
>
> > To recommend Peter a new kind of tea I get the other persons that like
> > "black tea" and/or "white tea": Laura, Paul and John. Then I get
> > somehow the kinds of tea they like that are different than 'black tea'
> > and 'white tea' (the kinds of tea Peter likes) and for them I store
> > how many of those persons like them. So somehow I get a dictionary
> > that looks like this:
> > other_people_like = { 'green tea' : 3, 'red tea' : 2, 'yellow tea':
> > 1 } And I can recommend Peter those kinds of tea in that order.
>
> > I have started with this:
> > =
> > from sets import Set
> > p = Person.objects.get(name='Peter')
>
> > other_people = Set([])
>
> > for tea in p.likes.all():
> >     for person in tea.liked_by.exclude(name='Peter')
> >         other_people.add(person)
>
> > # now I have a Set with the people that like some or at least one kind
> > of tea Peter likes too. now how should I do the rest?
>
> > Thank you.
>
> Here's one approach which seems to work for the sample data and expected
> output you provided (tried it in SQLite, MySQL 4.1 and PostgreSQL 8.1):
>
>    peter = Person.objects.get(name='Peter')
>    peter_likes_ids = peter.likes.values_list('id', flat=True)
>
>    # People who like at least one of the same teas as Peter
>    people = Person.objects.filter(
>        likes__in=peter_likes_ids).exclude(id=peter.id).values('id')
>
>    # Teas liked by the above people, excluding the teas Peter likes
>    recommendations = 

Sync Database failed, using "python manage.py syncdb"

2008-11-10 Thread Sean

When I run the command "python manage.py syncdb" to sync database, but
failed

I got the following error messages:

File "C:\Python25\Lib\site-packages\django\contrib\auth\management
\_init_.py". line 47 , in 
signals.post_syncdb.connect

I got django1.0, Python2.52, Apache2.2.9, MySQL5.0.67,
PHPMyAdmin2.11.9.2

Can anyone please help!

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



Error in: python manage.py syncdb

2008-11-10 Thread Sean

When I run the command python manage.py syncdb to sync database, but
failed

I got the following error messages:

File "C:\Python25\Lib\site-packages\django\contrib\auth\management
\_init_.py". line 47 , in 
signals.post_syncdb.connect

I got django1.0, Python2.52, Apache2.2.9, MySQL5.0.67,
PHPMyAdmin2.11.9.2

Can anyone please help!

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



Re: has more than 1 ForeignKey to

2008-11-10 Thread jd.strickler

Klaas,

When you create a Foreign Key to another model, Django also sets up
the "reverse relation".  If you specify more than one foreign key to
the same model, you must give different names for this reverse
relationship.

http://docs.djangoproject.com/en/dev/topics/db/queries/#backwards-related-objects

js

On Nov 10, 3:50 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a UserProfile connected to auth.models.User using
>
>     user = models.ForeignKey(User, unique=True)
>
> Additionally, I'd like to connect users to each other with manager/
> managed hierarchical relationships, whereby everyone has one manager
> (except the big boss who has none):
>
>     manager = models.ForeignKey(User, blank=True,
> related_name='employees_userprofile_manager')
>
> My models fail to load with the exception:
>  has more than 1
> ForeignKey to 
>
> This doesn't seem logical to me at all: the above is a perfectly fine
> example of two foreign keys being meaningful. Why is this not possible
> and what is the workaround, or rather, the proper way to do this?
>
> I'm using Django 1.0.
>
> Any help is much appreciated.
>
> regards,
> Klaas van Schelven
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Apache Segmentation Fault on succesful authentication

2008-11-10 Thread Graham Dumpleton



On Nov 10, 8:53 pm, huw_at1 <[EMAIL PROTECTED]> wrote:
> Hi Graham and thanks for the response again.
>
> I seem to remember when I originally built this 64-bit mod_python
> module I had a lot of difficulty. I was getting error messages which I
> solved by following the solution in this article:
>
> http://agiletesting.blogspot.com/2007_10_01_archive.html
>
> Although I didn't fully understand what I was doing, the instructions
> fixed the issue I was having. I'm hoping that as a result this is a 64-
> bit issue which I can get around when I move to a 32-bit production
> server.

Solve the static vs shared library issue for mod_python first and then
we can see.

> I have never tried nor heard of mod_wsgi. Is this just a new
> replacement for mod_python which I can run Django and other python web
> apps through? Are there any changes I need to make to them if I
> implement this module?

No changes required to Django user application code. Just how you
configure Apache and how you need to use a WSGI script file as bridge
to Django application is different.

The mod_wsgi module isn't a replacement for mod_python as mod_wsgi
only supports Python web application supporting WSGI interface, as
nearly all do these days. The mod_python module provides its own
framework for developing web applications as well.

Graham

> Many thanks
>
> Huw
>
> On Nov 8, 10:05 am, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > On Nov 7, 10:29 pm, huw_at1 <[EMAIL PROTECTED]> wrote:
>
> > > Graham thanks,
>
> > > First of all here is my httpd.conf file modules:
>
> > > # Example:
> > > # LoadModule foo_module modules/mod_foo.so
> > > #
>
> > > LoadModule python_module modules/mod_python.so
> > > #LoadModule dav_svn_module     modules/mod_dav_svn.so
> > > #LoadModule authz_svn_module   modules/mod_authz_svn.so
>
> > > 
> > > 
> > > #
>
> > > So as you can see the only module I am actually using is the
> > > mod_python one. 'httpd -l' reveals:
>
> > >   core.c
> > >   mod_authn_file.c
> > >   mod_authn_default.c
> > >   mod_authz_host.c
> > >   mod_authz_groupfile.c
> > >   mod_authz_user.c
> > >   mod_authz_default.c
> > >   mod_auth_basic.c
> > >   mod_include.c
> > >   mod_filter.c
> > >   mod_log_config.c
> > >   mod_env.c
> > >   mod_setenvif.c
> > >   prefork.c
> > >   http_core.c
> > >   mod_mime.c
> > >   mod_status.c
> > >   mod_autoindex.c
> > >   mod_asis.c
> > >   mod_cgi.c
> > >   mod_negotiation.c
> > >   mod_dir.c
> > >   mod_actions.c
> > >   mod_userdir.c
> > >   mod_alias.c
> > >   mod_so.c
>
> > > Running ldd on mod_python reveals:
>
> > > /usr/local/apache2/modules/mod_python.so:
> > >         libpthread.so.0 => /lib64/libpthread.so.0 (0x2af216d13000)
> > >         libdl.so.2 => /lib64/libdl.so.2 (0x2af216f2d000)
> > >         libutil.so.1 => /lib64/libutil.so.1 (0x2af217131000)
> > >         libm.so.6 => /lib64/libm.so.6 (0x2af217335000)
> > >         libc.so.6 => /lib64/libc.so.6 (0x2af2175b8000)
> > >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> > The mod_python module isn't linking to shared Python library but has
> > linked it statically. This can cause problems, see below.
>
> > > and on the python ldap module:
>
> > > /usr/local/lib/python2.5/site-packages/python_ldap-2.3.5-py2.5-linux-
> > > x86_64.egg/_ldap.so
> > >         libldap_r-2.3.so.0 => /usr/lib64/libldap_r-2.3.so.0
> > > (0x2aad1567e000)
> > >         liblber-2.3.so.0 => /usr/lib64/liblber-2.3.so.0
> > > (0x2aad158c7000)
> > >         libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x2aad15ad5000)
> > >         libssl.so.6 => /lib64/libssl.so.6 (0x2aad15cef000)
> > >         libcrypto.so.6 => /lib64/libcrypto.so.6 (0x2aad15f38000)
> > >         libpython2.5.so.1.0 => /usr/local/lib/libpython2.5.so.1.0
> > > (0x2aad1628)
>
> > The ldap module is link Python shared library.
>
> > That mod_python.so has embedded static module and you can shared being
> > linked in here can cause crashes.
>
> > Haven't seen this variation of problem before, but see:
>
> >http://code.google.com/p/modwsgi/wiki/InstallationIssues
>
> > This describes issues with use of static and shared library for Python
> > at same time when using mod_python and mod_wsgi together.
>
> > In short, rebuild mod_python so it uses shared Python library instead.
>
> > Maybe also consider using mod_wsgi as well. It will not solve the
> > problem, but arguable better solution these days. :-)
>
> > Graham
>
> > >         libpthread.so.0 => /lib64/libpthread.so.0 (0x2aad165ef000)
> > >         libc.so.6 => /lib64/libc.so.6 (0x2aad16809000)
> > >         libresolv.so.2 => /lib64/libresolv.so.2 (0x2aad16b5c000)
> > >         libdl.so.2 => /lib64/libdl.so.2 (0x2aad16d72000)
> > >         libcrypt.so.1 => /lib64/libcrypt.so.1 (0x2aad16f76000)
> > >         libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2
> > > (0x2aad171ae000)
> > >         libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x2aad173dd000)
> > 

Re: using Etags or http response code 304 (not modified)

2008-11-10 Thread Karen Tracey
On Mon, Nov 10, 2008 at 4:14 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

>
> I've tried using the USE_ETAGS=true in my project settings and even
> tried using the ConditionalGet Middleware. However, whenever an http
> request is made to my page, it always seems to return a http code 200
> along with the entire data.
>
> how / what do I need to do so that a http 304 is issued if the data
> hasnt been modified ?
>
> do i need to do do anything within my view to issue the http 304 ?
>

No, I just set USE_ETAGS=True in my settings.py and (since I already had
CommonMiddleware specified) now I see my server return 304 for unchanged
pages.  Presumably you're using something to look at the headers in the
requests/responses -- can you see the Etag in the responses?  Is your client
sending If-None-Match when it then requests the same page?

Karen

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



Re: apache and django

2008-11-10 Thread Graham Dumpleton



On Nov 10, 5:50 pm, "DULMANDAKH Sukhbaatar" <[EMAIL PROTECTED]>
wrote:
> > Ok.  But are the configuration lines any different or will they
> > change.  If anyone has a good tutorial written could you please post
> > it.  Also, What does this line mean ?
> > SetEnv DJANGO_SETTINGS_MODULE mysite.settings
>
> See http://httpd.apache.org/docs/2.2/mod/mod_env.html. I suggest you
> to do some research by yourself.

Note that SetEnv in Apache is traditionally used for CGI scripts and
would dictate what operating system environment variables are set in
the separate process created to run the CGI script. It does not in
itself change operating system environment variables for the Apache
child worker processes where Django runs itself.

When Django is run with mod_python however, Django is taking the
variables set by SetEnv and forcibly updating os.environ and as a side
affect also updating the operating system environment variables as
well. This is actually somewhat bad practice for anything running
directly under an Apache module as it will affect code running under
other Apache modules as well, eg, PHP. Things can get even worse if
running multiple Django instances in a multithreaded server
configuration and setting overlapping sets of variables to different
values as you can end up with race conditions on values of operating
system environment variables as seen by C code or other Apache
modules.

In other words, it isn't that simple and Django in the long term
should target getting rid of reliance on variables in os.environ.

FWIW, with mod_wsgi anything defined using SetEnv only populates the
per request WSGI environment dictionary and not the process level
operating system environment variables. At this stage though, Django
cannot use per request environment that WSGI provides and so manual
step of setting os.environ still required. At least updating
os.environ is only done once when WSGI script loaded and not on every
request like mod_python.

So, it isn't as simple as you may think. :-)

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



Sending mass, yet personalised email newsletters using Django

2008-11-10 Thread Patrick J. Anderson

I'm in the process of writing a simple newsletter managers with a web 
interface and since I've been a Django user for the past 2 years, I 
thought of using Django for this task.

Some of the main requirements are:

* Personalised HTML/text messages
* Manual delivery twice a week
* Message logging/archiving
* Amount of newsleter issues: ~50
* Amount of subscribers: 500-5000

I was wondering about sending personalised mass mail and scaling issues, 
since I assume that each email message would need to be rendered 
separately to insert subscribers' first and last name, and other related 
information and sent using its own SMTPConnection.

Can Django handle this task reliably? If so, I'd be interested in best, 
most efficient ways of doing so from other Django users who have done it 
before.

I'd appreciate your comments, suggestions, tips and any other advice you 
might offer.


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



Re: Custom prepopulated SelectField's in DjangoAdmin

2008-11-10 Thread ilmarik

you're absolutely right.
I shouldn't say that but still its easier to get information from this
group rather than by reading the docs.
last year I was working with Kohana framework and it was pain in the
ass and great loss of time to learn from source code because
documentation was strongly incomplete . luckily, I wasn't a newbe in
php...
and in the time I'm starting better life as python and django fan, the
same doc story is happening.
so the most discouraged person is me...

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



ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.

2008-11-10 Thread ayayalar

Hello I am new to Django.

I am trying to exercise "templates" through the interactive shell,
however I end up getting this error. Can anyone help?

here is the exact steps I follow:

1) cd C:\Django\mysite

manage.py
settings.py
settings.pyc
urls.py
urls.pyc
views.py
views.pyc
__init__.py
__init__.pyc

2) set DJANGO_SETTINGS_MODULE=mysite.settings I've also tried set
DJANGO_SETTINGS_MODULE=settings.py

3) python


4) >>> from django.template import Template
>>> t = Template("My name is {{ name }}.")

5) ERROR: ImportError: Settings cannot be imported, because
environment variable DJANGO_SETTINGS_MODULE is undefined.

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



Re: SQL in queryset extra method not showing in results

2008-11-10 Thread chris

Now, to answer myself, I found the solution:

qs =
Reference.objects.all().extra(select={'title_count' 
:'COUNT(*)'}).values('title',
'title_count')
qs.query.group_by = ['title']

This gives me exactly the aggregated list of titles with the number of
occurrences.  The trick with group_by is undocumented, but mentioned
in this blog post by Eric Florenzano: 
http://www.eflorenzano.com/blog/post/secrets-django-orm/

Chris

On Nov 11, 7:43 am, chris <[EMAIL PROTECTED]> wrote:
> Thanks Malcolm,
>
> This brings me one step closer, but not quite there.
>
> On Nov 10, 8:21 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
> > > SELECT title, COUNT (*) AS count FROM persons_reference GROUP BY title
> > > ORDER BY count DESC
>
> > > Trying to get the same from the Django ORM, I do the following:
>
> > > r = Reference.objects.values('title').extra(select={'title_count' :
> > > 'COUNT(*)'}).distinct()
> > You've asked for a queryset that *only* includes the "title" field, so
> > that's what you're given. If you want it to also include the title_count
> > field, you need to describe that to the queryset first and then also
> > include it in the values() call:
>
> >         Reference.objects.extra(select={'title_count' 
> > :'COUNT(*)'}).distinct().values('title', 'title_count')
>
> This query returns only one row, the total count of all titles.  What
> I am trying to achieve is what the SQL above does, namely aggregating
> the titles and give the count for the occurrence of each title.
> I wonder if this could be done with the Django ORM?
>
> Chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SQL in queryset extra method not showing in results

2008-11-10 Thread chris

Thanks Malcolm,

This brings me one step closer, but not quite there.

On Nov 10, 8:21 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> > SELECT title, COUNT (*) AS count FROM persons_reference GROUP BY title
> > ORDER BY count DESC
>
> > Trying to get the same from the Django ORM, I do the following:
>
> > r = Reference.objects.values('title').extra(select={'title_count' :
> > 'COUNT(*)'}).distinct()
> You've asked for a queryset that *only* includes the "title" field, so
> that's what you're given. If you want it to also include the title_count
> field, you need to describe that to the queryset first and then also
> include it in the values() call:
>
>         Reference.objects.extra(select={'title_count' 
> :'COUNT(*)'}).distinct().values('title', 'title_count')

This query returns only one row, the total count of all titles.  What
I am trying to achieve is what the SQL above does, namely aggregating
the titles and give the count for the occurrence of each title.
I wonder if this could be done with the Django ORM?

Chris

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



Re: apache and django

2008-11-10 Thread prem1er


ServerName www.dev.xxx.us
ServerAlias dev.xxx.us
DocumentRoot /home/dev/djprojects/xxx

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE xxx.settings
PythonOption django.root /
PythonDebug On
PythonPath "['/home/dev/djprojects/'] + sys.path"



Yes so I figured that part out.  And the settings file for Django is
finally being found!  BUT, when I try and go the the admin site to
login, I receive this error.

TypeError at admin

'NoneType' object is not iterable

Request Method: GET
Request URL:http://dev.xxx.usadmin
Exception Type: TypeError
Exception Value:

'NoneType' object is not iterable

Exception Location: /usr/lib/python2.5/site-packages/django/core/
handlers/base.py in get_response, line 77
Python Executable:  /usr/bin/python
Python Version: 2.5.2
Python Path:['/home/dev/djprojects/', '/usr/lib/python25.zip', '/usr/
lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/
lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/
site-packages', '/usr/lib/python2.5/site-packages', '/usr/lib/
python2.5/site-packages/Numeric', '/usr/lib/python2.5/site-packages/
PIL', '/usr/lib/python2.5/site-packages/gst-0.10', '/var/lib/python-
support/python2.5', '/usr/lib/python2.5/site-packages/gtk-2.0', '/var/
lib/python-support/python2.5/gtk-2.0']
Server time:Mon, 10 Nov 2008 15:55:35 -0600

I feel like it has to do with the line
Request URL:http://dev.xxx.usadmin

There is no trailing '/' between the subdomain and the admin
parameter.

On Nov 10, 4:06 pm, Brandon Martin <[EMAIL PROTECTED]> wrote:
> On Mon, 10 Nov 2008 12:55:44 -0800 (PST), prem1er
>
>
>
> <[EMAIL PROTECTED]> wrote:
>
> > Ok this is where I'm at.  Here is my config file for sites-available.
>
> > 
> >     ServerNamewww.dev.xxx.us
> >     ServerAlias dev.xxx.us
> >     DocumentRoot /home/dev/djprojects/xxx
> >         
> >                 Options Indexes FollowSymLinks MultiViews
> >                 AllowOverride None
> >                 Order allow,deny
> >                 allow from all
> >                 AddHandler mod_python .py
> >                 PythonHandler mod_python.publisher
> >                 PythonDebug On
> >         
> >         
> >                 SetHandler python-program
> >                 PythonHandler django.core.handlers.modpython
> >                 SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> >                 PythonDebug On
> >                 PythonPath "['/home/dev/djprojects/xxx'] + sys.path"
> >         
> > 
>
> > And I'm getting this error.
>
> > Could not import settings 'mysite.settings' (Is it on sys.path? Does
> > it have syntax errors?): No module named mysite.settings
>
> > I understand that mysite.settings is supposed to be the location of my
> > settings.py, but is it just supposed to be the path of that file?
>
> Try removing the mysite part so it is juat
>
> SetEnv DJANGO_SETTINGS_MODULE settings
>
> --
> Brandon Martin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django pluggable adressbook/mini-CRM?

2008-11-10 Thread Mikkel Høgh

Hi there,

I'm working on a small time tracking app (http://github.com/mikl/djime/
tree/master – in case anyone is interested), and I'm looking to track
time spent on clients, projects and tasks, and currently I'm on the
lookout for some sort of address book or CRM that I could utilize
instead of writing my own. Must be plugable, of course.

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



Model manager not working with related sets of records.

2008-11-10 Thread John M

I have the following model (http://dpaste.com/89869/).  The model is
for a status report application I'm trying to create at work (so I
don't have to do powerpoints).  So each report, has several tasks /
milestones associated with it.

My problem is when I use a related set, the custom manager methods
don't work.

For example,

Report 1 has tasks 1, 2, 3 associated with them, which task 1 is a
milestone, 2 and 3 are both next steps (per the filter in the model.

Report 2 has tasks 4, 5, 6 associated with them, same types as above.

So Report1.task_set.all() works great, and gives me only tasks 1-3.
Report2.task_set, same thing.

However, If I ask for Report1.milestones() I get all the milestones
for all the reports, uggh.  Same on the other manager methods
(milestones and nextsteps)

What am I doing wrong?

I can work around this for now, but was hoping it's something i'm
doing wrong.

Thanks

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



using Etags or http response code 304 (not modified)

2008-11-10 Thread [EMAIL PROTECTED]

I've tried using the USE_ETAGS=true in my project settings and even
tried using the ConditionalGet Middleware. However, whenever an http
request is made to my page, it always seems to return a http code 200
along with the entire data.

how / what do I need to do so that a http 304 is issued if the data
hasnt been modified ?

do i need to do do anything within my view to issue the http 304 ?

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



Re: apache and django

2008-11-10 Thread Brandon Martin

On Mon, 10 Nov 2008 12:55:44 -0800 (PST), prem1er
<[EMAIL PROTECTED]> wrote:
> 
> Ok this is where I'm at.  Here is my config file for sites-available.
> 
> 
> ServerName www.dev.xxx.us
> ServerAlias dev.xxx.us
> DocumentRoot /home/dev/djprojects/xxx
> 
> Options Indexes FollowSymLinks MultiViews
> AllowOverride None
> Order allow,deny
> allow from all
> AddHandler mod_python .py
> PythonHandler mod_python.publisher
> PythonDebug On
> 
> 
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> PythonDebug On
> PythonPath "['/home/dev/djprojects/xxx'] + sys.path"
> 
> 
> 
> And I'm getting this error.
> 
> Could not import settings 'mysite.settings' (Is it on sys.path? Does
> it have syntax errors?): No module named mysite.settings
> 
> I understand that mysite.settings is supposed to be the location of my
> settings.py, but is it just supposed to be the path of that file?


Try removing the mysite part so it is juat 

SetEnv DJANGO_SETTINGS_MODULE settings


--
Brandon Martin


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



Re: apache and django

2008-11-10 Thread prem1er

Ok this is where I'm at.  Here is my config file for sites-available.


ServerName www.dev.xxx.us
ServerAlias dev.xxx.us
DocumentRoot /home/dev/djprojects/xxx

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
PythonPath "['/home/dev/djprojects/xxx'] + sys.path"



And I'm getting this error.

Could not import settings 'mysite.settings' (Is it on sys.path? Does
it have syntax errors?): No module named mysite.settings

I understand that mysite.settings is supposed to be the location of my
settings.py, but is it just supposed to be the path of that file?


On Nov 10, 3:32 pm, prem1er <[EMAIL PROTECTED]> wrote:
> Thanks for your replies everyone.  I'm looking into it more now and
> will let you know if I have any other questions.
>
> On Nov 10, 8:44 am, Brandon Martin <[EMAIL PROTECTED]> wrote:
>
> > I would just like to note here that when I first installed django with
> > apache and mod_python most of the problem I had was on the apache side
> > with vhosts not django. Each operating system handles apache configs a
> > little different. The guide on django's web site is great for the base
> > information. You just might need to adjust slightly for you OS.
>
> > Steve Holden wrote:
> > > If you read your httpd.conf file you will find at some point there is a
> > > line that includes the configuration data from the sites-enabled
> > > directory. This idea is to be able to switch sites on and off by adding
> > > and removing symbolic links from sites-enabled.
>
> > > Make sure you *always* edit the files in sites-available! If you edit in
> > > site-enabled, some editors will replace the original symbolic link in
> > > sites-enabled with an updated copy of the file itself, and then you will
> > > lose you configuration data if you decide to switch the site off
> > > temporarily ...
>
> > > The configuration commands are exactly the same for a configuration
> > > sub-file: it's exactly as though they had appeared in the main
> > > configuration file at the point of inclusion, so once you understand the
> > > relationship between the sites-available and sites-enabled directories
> > > and your main configuration file you should be good to go.
>
> > > You *could* put the configuration commands in http.conf itself, but this
> > > goes against the Debian/Ubuntu organization scheme, and so probably
> > > wouldn't be helpful long-term.
>
> > > The Django setup instructions aren't bad, but there are so many
> > > different ways that Apache is organized that the authors couldn't hope
> > > to cover them all.
>
> > > regards
> > >  Steve
>
> > >> On Nov 9, 10:33 pm, "DULMANDAKH Sukhbaatar" <[EMAIL PROTECTED]>
> > >> wrote:
>
> > >>> Please follow instructions 
> > >>> onhttp://docs.djangoproject.com/en/dev/howto/deployment/modpython/to
> > >>> setup django and mod_python.
>
> > >>> And it's interesting that how do you know that mod_python is working?
>
> > >>> --
> > >>> Regards
> > >>> Dulmandakh
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom Inline Forms with InlineFormsets

2008-11-10 Thread John Boxall

I take it back.

I over thought it -

Instead of using a custom inline form model just pass the parameters
directly to inlineformset_factory as per it's spec:
def inlineformset_factory(parent_model, model, form=ModelForm,
  formset=BaseInlineFormSet, fk_name=None,
  fields=None, exclude=None,
  extra=3, can_order=False, can_delete=True,
max_num=0,
  formfield_callback=lambda f:
f.formfield()):

On Nov 10, 12:47 pm, John Boxall <[EMAIL PROTECTED]> wrote:
> Heyo Django Users,
>
> I'm in a bit of a pickle with InlineFormsets -
>
> I'm following the example at the Django 
> Docs:http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-i...
>
> I've got two models:
> 
> class Author(models.Model):
>     name = models.CharField(max_length=100)
>
> class Book(models.Model):
>     author = models.ForeignKey(Author)
>     title = models.CharField(max_length=100)
>     description = models.CharField(max_length=255)
> 
>
> And I want to have an inline formsets to edit authors & books inline.
>
> What I want to do is just show the title field of the Book so  I have
> a custom ModelForm for that:
>
> 
> class BookModelForm(forms.ModelForm):
>     class Meta:
>         model = Book
>         fields = ('title',)
> 
>
> Everything looks good, I'm all ready to construct my
> inlinemodelformset using inlineformset_factory...
> 
> from django.forms.models import inlineformset_factory
> # ???
> BookFormSet = inlineformset_factory(Author, Book)
> 
>
> And doh! inlineformset_factory doesn't seem to want to let me set the
> form for the inline 
> model.http://code.djangoproject.com/browser/django/trunk/django/forms/model...
>
> Anyone have any luck with this?
>
> Thanks,
>
> John
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Custom Inline Forms with InlineFormsets

2008-11-10 Thread John Boxall

Heyo Django Users,

I'm in a bit of a pickle with InlineFormsets -

I'm following the example at the Django Docs:
http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-inlineformset-factory

I've got two models:

class Author(models.Model):
name = models.CharField(max_length=100)

class Book(models.Model):
author = models.ForeignKey(Author)
title = models.CharField(max_length=100)
description = models.CharField(max_length=255)


And I want to have an inline formsets to edit authors & books inline.

What I want to do is just show the title field of the Book so  I have
a custom ModelForm for that:


class BookModelForm(forms.ModelForm):
class Meta:
model = Book
fields = ('title',)


Everything looks good, I'm all ready to construct my
inlinemodelformset using inlineformset_factory...

from django.forms.models import inlineformset_factory
# ???
BookFormSet = inlineformset_factory(Author, Book)


And doh! inlineformset_factory doesn't seem to want to let me set the
form for the inline model.
http://code.djangoproject.com/browser/django/trunk/django/forms/models.py

Anyone have any luck with this?

Thanks,

John

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



Re: Custom prepopulated SelectField's in DjangoAdmin

2008-11-10 Thread Karen Tracey
On Mon, Nov 10, 2008 at 3:19 PM, ilmarik <[EMAIL PROTECTED]> wrote:

>
> PS. django documentation is getting crapy these days :(
>

Comments like this are not particularly helpful.  What do you expect anyone
to do in response to this comment? It's quite likely all it will do is
discourage anyone who has spent any significant effort on the docs (and that
set of people doesn't include me so I am not reacting out of any personal
feelings here).  The docs recently underwent a complete restructure in an
effort to make them more useful, not less -- it is not a case that they have
been neglected.

If you have specific suggestions for improvement, please share them.

Karen

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



Re: apache and django

2008-11-10 Thread prem1er

Thanks for your replies everyone.  I'm looking into it more now and
will let you know if I have any other questions.

On Nov 10, 8:44 am, Brandon Martin <[EMAIL PROTECTED]> wrote:
> I would just like to note here that when I first installed django with
> apache and mod_python most of the problem I had was on the apache side
> with vhosts not django. Each operating system handles apache configs a
> little different. The guide on django's web site is great for the base
> information. You just might need to adjust slightly for you OS.
>
> Steve Holden wrote:
> > If you read your httpd.conf file you will find at some point there is a
> > line that includes the configuration data from the sites-enabled
> > directory. This idea is to be able to switch sites on and off by adding
> > and removing symbolic links from sites-enabled.
>
> > Make sure you *always* edit the files in sites-available! If you edit in
> > site-enabled, some editors will replace the original symbolic link in
> > sites-enabled with an updated copy of the file itself, and then you will
> > lose you configuration data if you decide to switch the site off
> > temporarily ...
>
> > The configuration commands are exactly the same for a configuration
> > sub-file: it's exactly as though they had appeared in the main
> > configuration file at the point of inclusion, so once you understand the
> > relationship between the sites-available and sites-enabled directories
> > and your main configuration file you should be good to go.
>
> > You *could* put the configuration commands in http.conf itself, but this
> > goes against the Debian/Ubuntu organization scheme, and so probably
> > wouldn't be helpful long-term.
>
> > The Django setup instructions aren't bad, but there are so many
> > different ways that Apache is organized that the authors couldn't hope
> > to cover them all.
>
> > regards
> >  Steve
>
> >> On Nov 9, 10:33 pm, "DULMANDAKH Sukhbaatar" <[EMAIL PROTECTED]>
> >> wrote:
>
> >>> Please follow instructions 
> >>> onhttp://docs.djangoproject.com/en/dev/howto/deployment/modpython/to
> >>> setup django and mod_python.
>
> >>> And it's interesting that how do you know that mod_python is working?
>
> >>> --
> >>> Regards
> >>> Dulmandakh
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom prepopulated SelectField's in DjangoAdmin

2008-11-10 Thread Jarek Zgoda

Wiadomość napisana w dniu 2008-11-10, o godz. 21:03, przez ilmarik:

> Is there any simple way to change  to  in
> autogenerated django admin ?
>
> I have some fields that takes simple values to varchar and integer
> fields and these values are predefined alternatives.
>
> for example: field for Ms/Mrs/Mr...
>
> simple link to explanation would do...

You can supply choices argument in model's field constructor. Or  
replace the form's field with the one that has choices in modelform  
for this model.

-- 
We read Knuth so you don't have to. - Tim Peters

Jarek Zgoda, R, Redefine
[EMAIL PROTECTED]


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



Re: Custom prepopulated SelectField's in DjangoAdmin

2008-11-10 Thread ilmarik

> You can supply choices argument in model's field constructor. Or  
> replace the form's field with the one that has choices in modelform  
> for this model.

choices is that little thing I was looking for.. and suprisingly
couldn't find by myself.

many thanks!


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



Re: Custom prepopulated SelectField's in DjangoAdmin

2008-11-10 Thread Sahil R Cooner

It's a little outdated, but it shows you how to override a template file
per view of model.

http://www.djangobook.com/en/1.0/chapter17/.

On Mon, Nov 10, 2008 at 12:03:04PM -0800, ilmarik wrote:
> 
> Is there any simple way to change  to  in
> autogenerated django admin ?
> 
> I have some fields that takes simple values to varchar and integer
> fields and these values are predefined alternatives.
> 
> for example: field for Ms/Mrs/Mr...
> 
> simple link to explanation would do...
> > 

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



Custom prepopulated SelectField's in DjangoAdmin

2008-11-10 Thread ilmarik

Is there any simple way to change  to  in
autogenerated django admin ?

I have some fields that takes simple values to varchar and integer
fields and these values are predefined alternatives.

for example: field for Ms/Mrs/Mr...

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



Re: Django and Python 2.6

2008-11-10 Thread James Matthews
I just use 2.5.2 and i might upgrade when needed

On Mon, Nov 10, 2008 at 10:44 AM, Kegan <[EMAIL PROTECTED]> wrote:

>
> I am planning to host at WebFaction. Anyone using Django + Python2.6
> at WebFaction ? Care to share ?
>
> On Nov 10, 4:42 pm, m0nonoke <[EMAIL PROTECTED]> wrote:
> > I am using Win32 and there are still quite a few Python 2.6 libs /
> > binaries that are unavailable, such as mod_python. If you are on linux
> > though, you should have no problems.
> >
> > On Nov 10, 8:08 am, Kegan <[EMAIL PROTECTED]> wrote:
> >
> > > Hi,
> >
> > > If I start a new Django project today. Should I not be using Python
> > > 2.6 ?
> >
> > > I have read some threads here that ensure Django 1.0+ have no problem
> > > with Python 2.6. However, is there any other reason you would
> > > discourage using of Python 2.6 (if you 'do' discourage) ? Example,
> > > inadequate 3rd party libraries, etc?
> >
> > > Thanks.
> >
>


-- 
http://www.goldwatches.com/

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



Re: Usaing quotations in comments - please share

2008-11-10 Thread nkulmati

Wow, Thanks!
And what do you use "fix_ampersands" for?

On Nov 10, 1:02 am, Dmitry Dzhus <[EMAIL PROTECTED]> wrote:
> nkulmati wrote:
> > So here's a task which I do not yet know how to solve with django.
>
> > When users post comments and wish to include a quote of another user,
> > I would like them to use:
>
> >> quoted phrase 1
>
> > reply to phrase 1
>
> >> quoted phrase 2
>
> > reply to phase 2
>
> > (similar to an e-mail conversation)
>
> > No HTML allowed in the comments, of course. Then how would I go about
> > selecting quoted text with a different color? I.e. whenever there is
> > an expression "> quoted phrase", I want to wrap in, let's say:
>
> >   quoted phrase 
> > reply to phrase
>
> > Another problem is distinguishing where the quote ends and the reply
> > starts.
>
> > What solution would you recommend? If you implemented this concept in
> > a different way, what was it?
>
> I use Markdown to markup comments. By default it wraps quotes in
> `` tag. You may use CSS to give it another
> color etc.
>
> {% load markup %}
> ...
> {{ comment.comment|markdown|fix_ampersands }}
>
> Seehttp://docs.djangoproject.com/en/dev/ref/contrib/#ref-contrib-markup
> --
> Happy Hacking.
>
> http://sphinx.net.ru
> む
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



compare old and new model field value

2008-11-10 Thread Tim

Basically, I want to be able to do something if the value of a field
changes in a model.

c = Category.objects.get(pk=1)
c.name = "New Name"
c.save()

At any point (when the model is saved, when the value is set, etc.) is
it possible to compare the old and new value? The first thought that
popped into my head was something like this. I know this exact code
isn't possible, it's just an example of what I'm trying to do.

class Category(models.Models):

def save(self):
if self.name.old_value != self.name.value:
do something fun here
super(Category, self).save()

If something like this isn't built in to Django, I was thinking of
writing a custom field and overwriting __set__() to store the old
value somewhere, since that seems to be the only place that would have
access to the new and old value.

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



Re: No clue what to do !

2008-11-10 Thread dboddin

Thank You, Thank You, Thank You !!


-Ursprüngliche Nachricht-
Von: "Daniel Roseman" <[EMAIL PROTECTED]>
Gesendet: 10.11.08 11:17:52
An: Django users 
Betreff: Re: No clue what to do !


On Nov 10, 9:21 am, [EMAIL PROTECTED] wrote:
> Hi,
>
> I get this error
> AttributeError: type object 'CM' has no attribute 'fields'
> and than
> AlreadyRegistered: The model List is already registered
>
> I see no error in models.py or admin.py, please help.
>
> http://dpaste.com/hold/89667/http://dpaste.com/89670/
> 
>
> r/Delle

In this line:
admin.site.register(AM, CM)
both AM and CM are models. You can't do that. Register them both in
separate calls, like you have with the other models.
--
DR.



-- 

Mit freundlichen Grüßen
Detlef Boddin

Elly-Heuss-Knapp Weg 14
D-31141 Hildesheim (Germany)


Telefon:  +49/(0)5121/86226
Handy: +49/(0)173/629 1228

Fax & Anrufbeantworter  01212-6-112-60-51958


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



Re: Browser access to manage.py / django command extensions

2008-11-10 Thread R. Gorman

Oh the weight of various risks...

If you're just looking to execute a command and the response is quick
an os.system command in a view might work.  If it's a longer running
process you might want to look at subprocess.

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



Re: Browser access to manage.py / django command extensions

2008-11-10 Thread [EMAIL PROTECTED]

Maybe a button with a drop-down list for the commands he wants? Could
be part of the admin.

On Nov 10, 12:50 pm, Joe Murphy <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Boss wants browser access to a couple custom django command extensions
> -- wants it to be simple to administer for those who aren't
> comfortable on the command line.
>
> Any advice on how to approach this? I've searched google /
> djangosearch.com, and the django-users archive, and have come up with
> blanks.
>
> I understand the security risks in something like this, I also
> understand the job-security risks in not doing this.
>
> Thanks,
> Joe
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Browser access to manage.py / django command extensions

2008-11-10 Thread Joe Murphy

Hi all,

Boss wants browser access to a couple custom django command extensions
-- wants it to be simple to administer for those who aren't
comfortable on the command line.

Any advice on how to approach this? I've searched google /
djangosearch.com, and the django-users archive, and have come up with
blanks.

I understand the security risks in something like this, I also
understand the job-security risks in not doing this.

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



Re: Apache Segmentation Fault on succesful authentication

2008-11-10 Thread huw_at1

Some more info. Apache also segfaults when I succesfully sign in to
the admin site.

On Nov 10, 9:53 am, huw_at1 <[EMAIL PROTECTED]> wrote:
> Hi Graham and thanks for the response again.
>
> I seem to remember when I originally built this 64-bit mod_python
> module I had a lot of difficulty. I was getting error messages which I
> solved by following the solution in this article:
>
> http://agiletesting.blogspot.com/2007_10_01_archive.html
>
> Although I didn't fully understand what I was doing, the instructions
> fixed the issue I was having. I'm hoping that as a result this is a 64-
> bit issue which I can get around when I move to a 32-bit production
> server.
>
> I have never tried nor heard of mod_wsgi. Is this just a new
> replacement for mod_python which I can run Django and other python web
> apps through? Are there any changes I need to make to them if I
> implement this module?
>
> Many thanks
>
> Huw
>
> On Nov 8, 10:05 am, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > On Nov 7, 10:29 pm, huw_at1 <[EMAIL PROTECTED]> wrote:
>
> > > Graham thanks,
>
> > > First of all here is my httpd.conf file modules:
>
> > > # Example:
> > > # LoadModule foo_module modules/mod_foo.so
> > > #
>
> > > LoadModule python_module modules/mod_python.so
> > > #LoadModule dav_svn_module     modules/mod_dav_svn.so
> > > #LoadModule authz_svn_module   modules/mod_authz_svn.so
>
> > > 
> > > 
> > > #
>
> > > So as you can see the only module I am actually using is the
> > > mod_python one. 'httpd -l' reveals:
>
> > >   core.c
> > >   mod_authn_file.c
> > >   mod_authn_default.c
> > >   mod_authz_host.c
> > >   mod_authz_groupfile.c
> > >   mod_authz_user.c
> > >   mod_authz_default.c
> > >   mod_auth_basic.c
> > >   mod_include.c
> > >   mod_filter.c
> > >   mod_log_config.c
> > >   mod_env.c
> > >   mod_setenvif.c
> > >   prefork.c
> > >   http_core.c
> > >   mod_mime.c
> > >   mod_status.c
> > >   mod_autoindex.c
> > >   mod_asis.c
> > >   mod_cgi.c
> > >   mod_negotiation.c
> > >   mod_dir.c
> > >   mod_actions.c
> > >   mod_userdir.c
> > >   mod_alias.c
> > >   mod_so.c
>
> > > Running ldd on mod_python reveals:
>
> > > /usr/local/apache2/modules/mod_python.so:
> > >         libpthread.so.0 => /lib64/libpthread.so.0 (0x2af216d13000)
> > >         libdl.so.2 => /lib64/libdl.so.2 (0x2af216f2d000)
> > >         libutil.so.1 => /lib64/libutil.so.1 (0x2af217131000)
> > >         libm.so.6 => /lib64/libm.so.6 (0x2af217335000)
> > >         libc.so.6 => /lib64/libc.so.6 (0x2af2175b8000)
> > >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> > The mod_python module isn't linking to shared Python library but has
> > linked it statically. This can cause problems, see below.
>
> > > and on the python ldap module:
>
> > > /usr/local/lib/python2.5/site-packages/python_ldap-2.3.5-py2.5-linux-
> > > x86_64.egg/_ldap.so
> > >         libldap_r-2.3.so.0 => /usr/lib64/libldap_r-2.3.so.0
> > > (0x2aad1567e000)
> > >         liblber-2.3.so.0 => /usr/lib64/liblber-2.3.so.0
> > > (0x2aad158c7000)
> > >         libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x2aad15ad5000)
> > >         libssl.so.6 => /lib64/libssl.so.6 (0x2aad15cef000)
> > >         libcrypto.so.6 => /lib64/libcrypto.so.6 (0x2aad15f38000)
> > >         libpython2.5.so.1.0 => /usr/local/lib/libpython2.5.so.1.0
> > > (0x2aad1628)
>
> > The ldap module is link Python shared library.
>
> > That mod_python.so has embedded static module and you can shared being
> > linked in here can cause crashes.
>
> > Haven't seen this variation of problem before, but see:
>
> >http://code.google.com/p/modwsgi/wiki/InstallationIssues
>
> > This describes issues with use of static and shared library for Python
> > at same time when using mod_python and mod_wsgi together.
>
> > In short, rebuild mod_python so it uses shared Python library instead.
>
> > Maybe also consider using mod_wsgi as well. It will not solve the
> > problem, but arguable better solution these days. :-)
>
> > Graham
>
> > >         libpthread.so.0 => /lib64/libpthread.so.0 (0x2aad165ef000)
> > >         libc.so.6 => /lib64/libc.so.6 (0x2aad16809000)
> > >         libresolv.so.2 => /lib64/libresolv.so.2 (0x2aad16b5c000)
> > >         libdl.so.2 => /lib64/libdl.so.2 (0x2aad16d72000)
> > >         libcrypt.so.1 => /lib64/libcrypt.so.1 (0x2aad16f76000)
> > >         libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2
> > > (0x2aad171ae000)
> > >         libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x2aad173dd000)
> > >         libcom_err.so.2 => /lib64/libcom_err.so.2 (0x2aad1767)
> > >         libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3
> > > (0x2aad17872000)
> > >         libz.so.1 => /usr/lib64/libz.so.1 (0x2aad17a98000)
> > >         libutil.so.1 => /lib64/libutil.so.1 (0x2aad17cac000)
> > >         libm.so.6 => /lib64/libm.so.6 (0x2aad17eaf000)
> > >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
> 

Re: Eager loading backward relationships

2008-11-10 Thread vmihaylov

Yes, but I thinks this will not load blog objects that do not have
entries.


Vassil

On Nov 10, 12:17 pm, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> On Nov 10, 7:18 am, vmihaylov <[EMAIL PROTECTED]> wrote:
>
> > Hello everyone,
> > I need to eager load an object along with any backward relationships
> > it has.
> > But I can't figure out how to do it.
> > Lets consider the example 
> > fromhttp://docs.djangoproject.com/en/dev/topics/db/queries/
> > What I want is to load a blog object and then access its entries even
> > if they are null, without hitting the database again.
> > Is this possible at all?
>
> > Thanks,
> > Vassil
>
> You can't do it directly. The best thing to do is turn the query
> around:
>
> Entry.objects.select_related().filter(blog__pk=myblogid)
>
> --
> 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin interface crashes when adding a new item with a ForeignKey

2008-11-10 Thread Ben Gerdemann

I figured out the problem. I used inspectdb to import my models from
an existing database. I then marked the primary_key fields with
primary_key=True, but I didn't should have also converted them from
IntegerField to AutoField. Once I did that everything worked fine. I
hope this message saves someone else from debugging in the future. For
future reference the assertion was: "invalid literal for int(): None"

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



Re: has more than 1 ForeignKey to

2008-11-10 Thread Karen Tracey
On Mon, Nov 10, 2008 at 3:50 AM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> Hi all,
>
> I have a UserProfile connected to auth.models.User using
>
>user = models.ForeignKey(User, unique=True)
>
> Additionally, I'd like to connect users to each other with manager/
> managed hierarchical relationships, whereby everyone has one manager
> (except the big boss who has none):
>
>manager = models.ForeignKey(User, blank=True,
> related_name='employees_userprofile_manager')
>
> My models fail to load with the exception:
>  has more than 1
> ForeignKey to 
>
> This doesn't seem logical to me at all: the above is a perfectly fine
> example of two foreign keys being meaningful. Why is this not possible
> and what is the workaround, or rather, the proper way to do this?
>
> I'm using Django 1.0.
>
> Any help is much appreciated.
>

I don't know what "fails to load" means -- that is, you haven't made it
clear what you are doing when the error is triggered.  manage.py runserver?
Something in the admin? Also the full traceback would be helpful, since that
would give a clue what portion of the Djano code is objecting.  As is I
suspect you are doing something with inlines but haven't told the admin
which ForeignKey to use, see:

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#fk-name

If that's not it please provide more specifics of what you are doing and the
traceback received.

Karen

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



Re: Admin Interface - "You don't have permission to edit anything"

2008-11-10 Thread Karen Tracey
On Mon, Nov 10, 2008 at 5:06 AM, Saravana Kumar K, Bangalore <
[EMAIL PROTECTED]> wrote:

>  Hi All,
>
>I was trying to install Autotest tool, which is used for kernel testing.
> It uses the Django also, Please  find the link below
>
>http://autotest.kernel.org/wiki/AutotestServerInstall
>
>  I followed all the instructions from the above link, But when i try to
> access the Admin interface, getting error Site Administrator "You don't have
> permission to edit anything". Can any one help me out of this issue...
>

I know nothing of this tool, but that error generally means you have not
included `admin.autodiscover()` in your urls.py file.  However, that command
was added in Django 1.0 (and I never saw an occurrance of that error
reported prior to the additon of admin.autdiscover()) and I see from looking
at the page you point to that they tell you to install Django 0.96.  So, if
you are using 0.96 admin.autodiscover() won't help.  It might not really
help on 1.0 either since if the app was written for 0.96 it is unlikely to
run unchanged on 1.0.

Karen

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



Re: 'NoneType' object is not iterable

2008-11-10 Thread Diego Cibils

Hi Javi,

I'm having the same problem... any progress so far?

Thanks.

On Nov 10, 8:35 am, Javi <[EMAIL PROTECTED]> wrote:
> Hello Rajesh,
>
> I've tried putting FORCE_SCRIPT_NAME="" but everything continues at
> the same state. I'm running the app in Apache2/mod_python. I've pasted
> the htttp.conf file athttp://rafb.net/p/Ya1VKT55.html
>
> I'm going to continue trying to solve it.
>
> On Nov 5, 7:11 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
>
> > Hi Javi,
>
> > > Thanks but I'd already tried it. I don't understand why in the
> > > production server is not added the preceeding slash to the url. My
> > > urls.py is as follows:
> > > urlpatterns = patterns('candidateTool.assessmentSystem.views',
> > >     (r'^$', 'index'),
> > >     (r'^enter/$', 'enter'),
> > >     (r'^main/$', 'main'),
> > >     (r'^exam/(?P\d+)/$', 'exam'),
> > >     (r'^myexam/(?P\d+)/$', 'my_exam'),
> > >     (r'^solved/(?P\d+)/$', 'solved_exam'),
> > >     (r'^report/$', 'report'),
> > >     (r'^exams/$', 'exams'),
> > >     (r'^admin/(.*)', admin.site.root),
> > > )
>
> > > In the index page is called /enter and I've also tried /enter/ but
> > > neither work :(
>
> > Try, putting FORCE_SCRIPT_NAME='' in your settings file.
>
> > Also, how are you running the application in your production server
> > (Apache/mod_python, lighttpd/flup, nginx/proxy, etc.)?
>
> > -RD

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



Re: Admin interface crashes when adding a new item with a ForeignKey

2008-11-10 Thread Karen Tracey
You left off the actual exception you get.  Also, the details of your Model
and ModelAdmin definitions would be helpful (please post to dpaste.com and
point to them if they're big enough to display poorly in email), since I've
used this method myself without error so I suspect there is something
specific about your setup coming into play.

Karen

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



Admin interface crashes when adding a new item with a ForeignKey

2008-11-10 Thread Ben Gerdemann

Good morning all,

This problem sure seems like a bug, but it's such a common operation
that I must be doing something wrong. I am using the admin interface
to add a new student to my database. At the same time I also want to
add the parents of the student, so I click on the "+" icon on the
student page to add the data for the parents. The data for the parents
saves fine, but when I click to save the student I always get an error
(copied below). If I do the operation in two steps, adding the parent
first then going to the student page and adding the student linked to
the parents, everything works fine. In fact, if I simply click back
from the error page to the student page I submitted from, click reload
so the parent now appears in the select box, select the parent and
then click save everything works too.

Looking at the traceback, it appears the value of the field for the
ForeignKey in the student that points to the parent has a value of
u"None" when I suppose that it should have an integer value that
points the parent primary key. Anyway, I'm not expert here, but I hope
that someone can help out. This operation seems so common that I must
be doing something wrong.

Cheers,
Ben

Environment:

Request Method: POST
Request URL: http://www.moviemago.com/admin/students/aluno/add/
Django Version: 1.0-final-SVN-unknown
Python Version: 2.4.3
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'ETF.students',
 'django.contrib.admin']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Traceback:
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py"
in get_response
  86. response = callback(request, *callback_args,
**callback_kwargs)
File "/usr/lib/python2.4/site-packages/django/contrib/admin/sites.py"
in root
  158. return self.model_page(request, *url.split('/',
2))
File "/usr/lib/python2.4/site-packages/django/views/decorators/
cache.py" in _wrapped_view_func
  44. response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.4/site-packages/django/contrib/admin/sites.py"
in model_page
  177. return admin_obj(request, rest_of_url)
File "/usr/lib/python2.4/site-packages/django/contrib/admin/
options.py" in __call__
  191. return self.add_view(request)
File "/usr/lib/python2.4/site-packages/django/db/transaction.py" in
_commit_on_success
  238. res = func(*args, **kw)
File "/usr/lib/python2.4/site-packages/django/contrib/admin/
options.py" in add_view
  490. if form.is_valid():
File "/usr/lib/python2.4/site-packages/django/forms/forms.py" in
is_valid
  120. return self.is_bound and not bool(self.errors)
File "/usr/lib/python2.4/site-packages/django/forms/forms.py" in
_get_errors
  111. self.full_clean()
File "/usr/lib/python2.4/site-packages/django/forms/forms.py" in
full_clean
  224. value = field.clean(value)
File "/usr/lib/python2.4/site-packages/django/forms/models.py" in
clean
  650. value = self.queryset.get(**{key: value})
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
get
  297. clone = self.filter(*args, **kwargs)
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
filter
  483. return self._filter_or_exclude(False, *args, **kwargs)
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
_filter_or_exclude
  501. clone.query.add_q(Q(*args, **kwargs))
File "/usr/lib/python2.4/site-packages/django/db/models/sql/query.py"
in add_q
  1224. can_reuse=used_aliases)
File "/usr/lib/python2.4/site-packages/django/db/models/sql/query.py"
in add_filter
  1167. self.where.add((alias, col, field, lookup_type,
value), connector)
File "/usr/lib/python2.4/site-packages/django/db/models/sql/where.py"
in add
  48. params = field.get_db_prep_lookup(lookup_type,
value)
File "/usr/lib/python2.4/site-packages/django/db/models/fields/
__init__.py" in get_db_prep_lookup
  202. return [self.get_db_prep_value(value)]
File "/usr/lib/python2.4/site-packages/django/db/models/fields/
__init__.py" in get_db_prep_value
  671. return int(value)

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



Re: How can I create a new table without primary key filed?

2008-11-10 Thread AndyB

If it's one to one then the field that maps to the primary key in the
other table should be unique. Why not designate that as a primary key?

I was in a similar situation integrating a legacy Access app. I simply
added an autonumber id field. Your old app will ignore it but it keeps
Django happy.

On Nov 10, 11:45 am, "K*K" <[EMAIL PROTECTED]> wrote:
> Actually this table filed is a one to one mapper to other table's
> field. this table doesn't need primary key field.
>
> But I have to keep the database schema compatible with old system so I
> have to keep it.
>
> On Nov 10, 7:20 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
> wrote:
>
> > On Mon, Nov 10, 2008 at 7:59 PM, K*K <[EMAIL PROTECTED]> wrote:
>
> > > Hi, all.
>
> > > How can I create a new table without primary key in Django modeling. ?
>
> > > I'm porting a old program to Django web framework. After inspect
> > > database to modules.py and then syncdb, It create the id filed with
> > > primary key attribute, how can I disable this feature ?
>
> > inspectdb isn't perfect - it's just a starting point that will
> > hopefully remove the need to do a lot of typing. It is entirely
> > expected that you will need to tweak the model provided by inspectdb.
> > If inspectdb is producing an extra 'id' field in the model it
> > suggests, just delete that field from the suggested model.
>
> > However, because of the way Django operates, you will need to nominate
> > one of the fields in your model to be the primary key. In your case,
> > I'm guessing that inspectdb can't find an obvious candidate for the
> > primary key, so it has given up and put an extra 'id' field into the
> > definition it suggests.
>
> > You can choose any field you want to be the primary key (provided it
> > actually contains unique data). It doesn't matter what that field is
> > called - it just needs to set the primary_key attribute to True. For
> > example, if one of your models has a 'name' field that could be used
> > as a primary key, you would use a definition something like:
>
> >     name = models.CharField(max_length=40, primary_key=True)
>
> > Yours,
> > Russ Magee %-)
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: apache and django

2008-11-10 Thread Brandon Martin

I would just like to note here that when I first installed django with 
apache and mod_python most of the problem I had was on the apache side 
with vhosts not django. Each operating system handles apache configs a 
little different. The guide on django's web site is great for the base 
information. You just might need to adjust slightly for you OS.

Steve Holden wrote:
> If you read your httpd.conf file you will find at some point there is a
> line that includes the configuration data from the sites-enabled
> directory. This idea is to be able to switch sites on and off by adding
> and removing symbolic links from sites-enabled.
>
> Make sure you *always* edit the files in sites-available! If you edit in
> site-enabled, some editors will replace the original symbolic link in
> sites-enabled with an updated copy of the file itself, and then you will
> lose you configuration data if you decide to switch the site off
> temporarily ...
>
> The configuration commands are exactly the same for a configuration
> sub-file: it's exactly as though they had appeared in the main
> configuration file at the point of inclusion, so once you understand the
> relationship between the sites-available and sites-enabled directories
> and your main configuration file you should be good to go.
>
> You *could* put the configuration commands in http.conf itself, but this
> goes against the Debian/Ubuntu organization scheme, and so probably
> wouldn't be helpful long-term.
>
> The Django setup instructions aren't bad, but there are so many
> different ways that Apache is organized that the authors couldn't hope
> to cover them all.
>
> regards
>  Steve
>   
>> On Nov 9, 10:33 pm, "DULMANDAKH Sukhbaatar" <[EMAIL PROTECTED]>
>> wrote:
>>   
>> 
>>> Please follow instructions 
>>> onhttp://docs.djangoproject.com/en/dev/howto/deployment/modpython/to
>>> setup django and mod_python.
>>>
>>> And it's interesting that how do you know that mod_python is working?
>>>
>>> --
>>> Regards
>>> Dulmandakh
>>> 
>>>
>>>   
>>   
>> 
>
>
>
> >
>   

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



Admin Interface - "You don't have permission to edit anything"

2008-11-10 Thread Saravana Kumar K, Bangalore
Title: Admin Interface -  "You don't have permission to edit anything"






Hi All,

   I was trying to install Autotest tool, which is used for kernel testing. It uses the Django also, Please  find the link below

   http://autotest.kernel.org/wiki/AutotestServerInstall

 I followed all the instructions from the above link, But when i try to access the Admin interface, getting error Site Administrator “You don't have permission to edit anything”. Can any one help me out of this issue...

Thanks in Advance

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


DISCLAIMER:
---

The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only. 
It shall not attach any liability on the originator or HCL or its affiliates. 
Any views or opinions presented in 
this email are solely those of the author and may not necessarily reflect the 
opinions of HCL or its affiliates. 
Any form of reproduction, dissemination, copying, disclosure, modification, 
distribution and / or publication of 
this message without the prior written consent of the author of this e-mail is 
strictly prohibited. If you have 
received this email in error please delete it and notify the sender 
immediately. Before opening any mail and 
attachments please check them for viruses and defect.

---

Re: has more than 1 ForeignKey to

2008-11-10 Thread Michael Ellis

Try settting related_name on "user" as well.

user = models.ForeignKey(User, unique=True, related_name='foo')

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



Re: apache and django

2008-11-10 Thread Steve Holden

If you read your httpd.conf file you will find at some point there is a
line that includes the configuration data from the sites-enabled
directory. This idea is to be able to switch sites on and off by adding
and removing symbolic links from sites-enabled.

Make sure you *always* edit the files in sites-available! If you edit in
site-enabled, some editors will replace the original symbolic link in
sites-enabled with an updated copy of the file itself, and then you will
lose you configuration data if you decide to switch the site off
temporarily ...

The configuration commands are exactly the same for a configuration
sub-file: it's exactly as though they had appeared in the main
configuration file at the point of inclusion, so once you understand the
relationship between the sites-available and sites-enabled directories
and your main configuration file you should be good to go.

You *could* put the configuration commands in http.conf itself, but this
goes against the Debian/Ubuntu organization scheme, and so probably
wouldn't be helpful long-term.

The Django setup instructions aren't bad, but there are so many
different ways that Apache is organized that the authors couldn't hope
to cover them all.

regards
 Steve
>
> On Nov 9, 10:33 pm, "DULMANDAKH Sukhbaatar" <[EMAIL PROTECTED]>
> wrote:
>   
>> Please follow instructions 
>> onhttp://docs.djangoproject.com/en/dev/howto/deployment/modpython/to
>> setup django and mod_python.
>>
>> And it's interesting that how do you know that mod_python is working?
>>
>> --
>> Regards
>> Dulmandakh
>> 
> >
>
>   



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



Re: How can I create a new table without primary key filed?

2008-11-10 Thread K*K

OK, I got it ;-)

I will try other method to implement the application.

Thx

On Nov 10, 7:43 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Mon, 2008-11-10 at 03:41 -0800, K*K wrote:
> > Thank you for you reply.
>
> > But I mean I want to create a table without primary key field.
>
> This isn't going to work very well with Django. There are a lot of
> places in Django that use the primary key on a table to access it. So
> tables without primary keys at all aren't supported (or possible).
>
> > I want
> > to disable django's automatic add the id key with primary key feature.
>
> > The primary key field in old table doesn't exist, and I checked it's
> > not in the models.py too.
>
> Either you specify the primary key manually or Django adds it
> automatically. There's no option to avoid one altogether.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How can I create a new table without primary key filed?

2008-11-10 Thread K*K

Actually this table filed is a one to one mapper to other table's
field. this table doesn't need primary key field.

But I have to keep the database schema compatible with old system so I
have to keep it.


On Nov 10, 7:20 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Mon, Nov 10, 2008 at 7:59 PM, K*K <[EMAIL PROTECTED]> wrote:
>
> > Hi, all.
>
> > How can I create a new table without primary key in Django modeling. ?
>
> > I'm porting a old program to Django web framework. After inspect
> > database to modules.py and then syncdb, It create the id filed with
> > primary key attribute, how can I disable this feature ?
>
> inspectdb isn't perfect - it's just a starting point that will
> hopefully remove the need to do a lot of typing. It is entirely
> expected that you will need to tweak the model provided by inspectdb.
> If inspectdb is producing an extra 'id' field in the model it
> suggests, just delete that field from the suggested model.
>
> However, because of the way Django operates, you will need to nominate
> one of the fields in your model to be the primary key. In your case,
> I'm guessing that inspectdb can't find an obvious candidate for the
> primary key, so it has given up and put an extra 'id' field into the
> definition it suggests.
>
> You can choose any field you want to be the primary key (provided it
> actually contains unique data). It doesn't matter what that field is
> called - it just needs to set the primary_key attribute to True. For
> example, if one of your models has a 'name' field that could be used
> as a primary key, you would use a definition something like:
>
>     name = models.CharField(max_length=40, primary_key=True)
>
> Yours,
> Russ Magee %-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How can I create a new table without primary key filed?

2008-11-10 Thread Malcolm Tredinnick


On Mon, 2008-11-10 at 03:41 -0800, K*K wrote:
> Thank you for you reply.
> 
> But I mean I want to create a table without primary key field. 

This isn't going to work very well with Django. There are a lot of
places in Django that use the primary key on a table to access it. So
tables without primary keys at all aren't supported (or possible).

> I want
> to disable django's automatic add the id key with primary key feature.
> 
> The primary key field in old table doesn't exist, and I checked it's
> not in the models.py too.

Either you specify the primary key manually or Django adds it
automatically. There's no option to avoid one altogether.

Regards,
Malcolm



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



Re: How can I create a new table without primary key filed?

2008-11-10 Thread K*K

Thank you for you reply.

But I mean I want to create a table without primary key field. I want
to disable django's automatic add the id key with primary key feature.

The primary key field in old table doesn't exist, and I checked it's
not in the models.py too.
But after syncdb django add a primary key field 'id' automatically.

For example I wrote below in the models.py:

class TestPlanPermissions(models.Model):
userid = models.IntegerField(unique=True)
plan_id = models.IntegerField()
permissions = models.IntegerField()
grant_type = models.IntegerField()

But after sync db, django add a id filed in the table automatically:

mysql> DESCRIBE test_plan_permissions;
+-+-+--+-+-++
| Field   | Type| Null | Key | Default | Extra  |
+-+-+--+-+-++
| id  | int(11) | NO   | PRI | NULL| auto_increment |
| userid  | int(11) | NO   | UNI | NULL||
| plan_id | int(11) | NO   | | NULL||
| permissions | int(11) | NO   | | NULL||
| grant_type  | int(11) | NO   | | NULL||
+-+-+--+-+-++
5 rows in set (0.00 sec)

I don't want to create neither the id field nor other primary key
field.



On Nov 10, 7:20 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Mon, Nov 10, 2008 at 7:59 PM, K*K <[EMAIL PROTECTED]> wrote:
>
> > Hi, all.
>
> > How can I create a new table without primary key in Django modeling. ?
>
> > I'm porting a old program to Django web framework. After inspect
> > database to modules.py and then syncdb, It create the id filed with
> > primary key attribute, how can I disable this feature ?
>
> inspectdb isn't perfect - it's just a starting point that will
> hopefully remove the need to do a lot of typing. It is entirely
> expected that you will need to tweak the model provided by inspectdb.
> If inspectdb is producing an extra 'id' field in the model it
> suggests, just delete that field from the suggested model.
>
> However, because of the way Django operates, you will need to nominate
> one of the fields in your model to be the primary key. In your case,
> I'm guessing that inspectdb can't find an obvious candidate for the
> primary key, so it has given up and put an extra 'id' field into the
> definition it suggests.
>
> You can choose any field you want to be the primary key (provided it
> actually contains unique data). It doesn't matter what that field is
> called - it just needs to set the primary_key attribute to True. For
> example, if one of your models has a 'name' field that could be used
> as a primary key, you would use a definition something like:
>
>     name = models.CharField(max_length=40, primary_key=True)
>
> Yours,
> Russ Magee %-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: loading initial data with yml

2008-11-10 Thread Adda Badda

On Nov 10, 10:18 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Mon, Nov 10, 2008 at 6:30 PM, Adda Badda <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > Im having a problem loading initial data into my app with yaml. I have
> > installed yaml for python using macports and placed the package in my
> > site-packages directory. From the shell the yaml package loads when I
> > type "import yaml" but django still tells me: "yml is not a known
> > serialization" when I try and load data.
>
> yml isn't a known serialization format, but yaml is. Django uses file
> extensions to identify file types; you need to name your fixtures
> my_fixture.yaml, not my_fixture.yml.
>
> If you specifically want to use yml as an extension for fixtures, you
> will need to register the YAML serializer with that extension. This
> can be done by putting the following into your settings.py file:
>
> SERIALIZATION_MODULES = {
>     'yml': "django.core.serializers.pyyaml"
>
> }
>
> Yours,
> Russ Magee %-)

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



Re: SQL in queryset extra method not showing in results

2008-11-10 Thread Malcolm Tredinnick


On Sun, 2008-11-09 at 22:19 -0800, chris wrote:
> Dear Django users,
> 
> Here is the problem I am trying to solve:
> 
> I have a Reference object defined as follows:
> 
> class Reference(models.Model):
> person = models.ForeignKey(Person)
> author = models.CharField(max_length = 20,  blank=True)
> location = models.CharField(max_length=255,  blank=True)
> title = models.TextField( blank=True)
> def __unicode__(self):
> return "%s / %s"%(self.title, self.location)
> 
> 
> Now I want to get a list of titles and the number of occurrences.  The
> following SQL gives me what I want in SQLITE:
> 
> 
> SELECT title, COUNT (*) AS count FROM persons_reference GROUP BY title
> ORDER BY count DESC
> 
> Trying to get the same from the Django ORM, I do the following:
> 
> r = Reference.objects.values('title').extra(select={'title_count' :
> 'COUNT(*)'}).distinct()
> 
> but this gives me only title, not the title_count, which does not show
> up in the results.
> 
> I guess I am doing something wrong, but can't quite figure out what.

You've asked for a queryset that *only* includes the "title" field, so
that's what you're given. If you want it to also include the title_count
field, you need to describe that to the queryset first and then also
include it in the values() call:

Reference.objects.extra(select={'title_count' 
:'COUNT(*)'}).distinct().values('title', 'title_count')

Regards,
Malcolm



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



Re: How can I create a new table without primary key filed?

2008-11-10 Thread Russell Keith-Magee

On Mon, Nov 10, 2008 at 7:59 PM, K*K <[EMAIL PROTECTED]> wrote:
>
> Hi, all.
>
> How can I create a new table without primary key in Django modeling. ?
>
> I'm porting a old program to Django web framework. After inspect
> database to modules.py and then syncdb, It create the id filed with
> primary key attribute, how can I disable this feature ?

inspectdb isn't perfect - it's just a starting point that will
hopefully remove the need to do a lot of typing. It is entirely
expected that you will need to tweak the model provided by inspectdb.
If inspectdb is producing an extra 'id' field in the model it
suggests, just delete that field from the suggested model.

However, because of the way Django operates, you will need to nominate
one of the fields in your model to be the primary key. In your case,
I'm guessing that inspectdb can't find an obvious candidate for the
primary key, so it has given up and put an extra 'id' field into the
definition it suggests.

You can choose any field you want to be the primary key (provided it
actually contains unique data). It doesn't matter what that field is
called - it just needs to set the primary_key attribute to True. For
example, if one of your models has a 'name' field that could be used
as a primary key, you would use a definition something like:

name = models.CharField(max_length=40, primary_key=True)

Yours,
Russ Magee %-)

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



Re: Join of any db table with Q.add_to_query

2008-11-10 Thread Malcolm Tredinnick


On Mon, 2008-11-03 at 03:02 -0800, Dima Dogadaylo wrote:
> Before merging of queryset-refactor it was possible to join any table
> with any ON clause to any queryset with help of Q.as_sql. 

It was "possible" for small values of possible that meant "extremely
fragile and didn't work in a large number of cases". That's why more
sophisticated support was needed for custom Q-like objects.

> For example,
> please see this one:
> http://www.djangosnippets.org/snippets/257/
> 
> Since Django 1.0 ORM looks like more complicated, Q.as_sql is
> disappeared (but still mentioned in docs (http://
> docs.djangoproject.com/en/dev/ref/models/fields/).

I don't see where you're seeing this reference still. A search on that
page doesn't turn up the sequence "as_sql" at all.

>  As I see from code
> Q.as_sql was replaced with Q.add_to_query(self, query, used_aliases)
> but from current code it looks like new implementation does not allow
> to use ON clause with more than 1 statements, for example:

The new code allows you to make any changes you like to the query, so
it's fully general. That is why the Query class is passed in. You write
an object that has an add_to_query() method and then you can do whatever
you like. Mostly this will involve calling query.join() and/or
query.add_filter(). Have a look at the docstring for join() in
particular to see how to promote a join to LEFT OUTER.

Regards,
Malcolm


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



How can I create a new table without primary key filed?

2008-11-10 Thread K*K

Hi, all.

How can I create a new table without primary key in Django modeling. ?

I'm porting a old program to Django web framework. After inspect
database to modules.py and then syncdb, It create the id filed with
primary key attribute, how can I disable this feature ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 'NoneType' object is not iterable

2008-11-10 Thread Javi

Hello Rajesh,

I've tried putting FORCE_SCRIPT_NAME="" but everything continues at
the same state. I'm running the app in Apache2/mod_python. I've pasted
the htttp.conf file at http://rafb.net/p/Ya1VKT55.html

I'm going to continue trying to solve it.

On Nov 5, 7:11 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi Javi,
>
>
>
> > Thanks but I'd already tried it. I don't understand why in the
> > production server is not added the preceeding slash to the url. My
> > urls.py is as follows:
> > urlpatterns = patterns('candidateTool.assessmentSystem.views',
> >     (r'^$', 'index'),
> >     (r'^enter/$', 'enter'),
> >     (r'^main/$', 'main'),
> >     (r'^exam/(?P\d+)/$', 'exam'),
> >     (r'^myexam/(?P\d+)/$', 'my_exam'),
> >     (r'^solved/(?P\d+)/$', 'solved_exam'),
> >     (r'^report/$', 'report'),
> >     (r'^exams/$', 'exams'),
> >     (r'^admin/(.*)', admin.site.root),
> > )
>
> > In the index page is called /enter and I've also tried /enter/ but
> > neither work :(
>
> Try, putting FORCE_SCRIPT_NAME='' in your settings file.
>
> Also, how are you running the application in your production server
> (Apache/mod_python, lighttpd/flup, nginx/proxy, etc.)?
>
> -RD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: loading initial data with yml

2008-11-10 Thread Russell Keith-Magee

On Mon, Nov 10, 2008 at 6:30 PM, Adda Badda <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> Im having a problem loading initial data into my app with yaml. I have
> installed yaml for python using macports and placed the package in my
> site-packages directory. From the shell the yaml package loads when I
> type "import yaml" but django still tells me: "yml is not a known
> serialization" when I try and load data.

yml isn't a known serialization format, but yaml is. Django uses file
extensions to identify file types; you need to name your fixtures
my_fixture.yaml, not my_fixture.yml.

If you specifically want to use yml as an extension for fixtures, you
will need to register the YAML serializer with that extension. This
can be done by putting the following into your settings.py file:

SERIALIZATION_MODULES = {
'yml': "django.core.serializers.pyyaml"
}

Yours,
Russ Magee %-)

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



Re: Eager loading backward relationships

2008-11-10 Thread Daniel Roseman

On Nov 10, 7:18 am, vmihaylov <[EMAIL PROTECTED]> wrote:
> Hello everyone,
> I need to eager load an object along with any backward relationships
> it has.
> But I can't figure out how to do it.
> Lets consider the example 
> fromhttp://docs.djangoproject.com/en/dev/topics/db/queries/
> What I want is to load a blog object and then access its entries even
> if they are null, without hitting the database again.
> Is this possible at all?
>
> Thanks,
> Vassil

You can't do it directly. The best thing to do is turn the query
around:

Entry.objects.select_related().filter(blog__pk=myblogid)

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



Re: No clue what to do !

2008-11-10 Thread Daniel Roseman

On Nov 10, 9:21 am, [EMAIL PROTECTED] wrote:
> Hi,
>
> I get this error
> AttributeError: type object 'CM' has no attribute 'fields'
> and than
> AlreadyRegistered: The model List is already registered
>
> I see no error in models.py or admin.py, please help.
>
> http://dpaste.com/hold/89667/http://dpaste.com/89670/
> 
>
> r/Delle

In this line:
admin.site.register(AM, CM)
both AM and CM are models. You can't do that. Register them both in
separate calls, like you have with the other models.
--
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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Extending the User Model with Inheritance | How to save extended data

2008-11-10 Thread johan.uhIe

So I have just had a try with a new written UserManager and it works.

My model looks the following way now:

from django.db import models
from django.contrib.auth.models import User, UserManager
import datetime

class NewUserManager(models.Manager):
def create_user(self, username, email, password, extradata):
"""Creates and saves a User with the given username, 
e-mail and
password.
The extradata dictionary set as attributes to the 
model"""
now = datetime.datetime.now()
user = self.model(None, username, '', '', 
email.strip().lower(),
'placeholder', False, True, False, now, now)
user.set_password(password)
# username email and password do not have to be saved 
again
del extradata['username']
del extradata['email']
del extradata['password']
for key in extradata:
setattr(user, key, extradata[key])
user.save()
return user

class CustomUserData(User):
# New Extra Data being saved with every User
city = models.CharField(max_length = 255)
[...]
# Use UserManager to get the create_user method, etc.
objects = NewUserManager()


and the save() changed to

def save(self):
CustomUserData.objects.create_user(
username=self.cleaned_data['username'],

email=self.cleaned_data['email'],

password=self.cleaned_data['password'],

extradata=self.cleaned_data)


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



Re: Apache Segmentation Fault on succesful authentication

2008-11-10 Thread huw_at1

Hi Graham and thanks for the response again.

I seem to remember when I originally built this 64-bit mod_python
module I had a lot of difficulty. I was getting error messages which I
solved by following the solution in this article:

http://agiletesting.blogspot.com/2007_10_01_archive.html

Although I didn't fully understand what I was doing, the instructions
fixed the issue I was having. I'm hoping that as a result this is a 64-
bit issue which I can get around when I move to a 32-bit production
server.

I have never tried nor heard of mod_wsgi. Is this just a new
replacement for mod_python which I can run Django and other python web
apps through? Are there any changes I need to make to them if I
implement this module?

Many thanks

Huw

On Nov 8, 10:05 am, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Nov 7, 10:29 pm, huw_at1 <[EMAIL PROTECTED]> wrote:
>
>
>
> > Graham thanks,
>
> > First of all here is my httpd.conf file modules:
>
> > # Example:
> > # LoadModule foo_module modules/mod_foo.so
> > #
>
> > LoadModule python_module modules/mod_python.so
> > #LoadModule dav_svn_module     modules/mod_dav_svn.so
> > #LoadModule authz_svn_module   modules/mod_authz_svn.so
>
> > 
> > 
> > #
>
> > So as you can see the only module I am actually using is the
> > mod_python one. 'httpd -l' reveals:
>
> >   core.c
> >   mod_authn_file.c
> >   mod_authn_default.c
> >   mod_authz_host.c
> >   mod_authz_groupfile.c
> >   mod_authz_user.c
> >   mod_authz_default.c
> >   mod_auth_basic.c
> >   mod_include.c
> >   mod_filter.c
> >   mod_log_config.c
> >   mod_env.c
> >   mod_setenvif.c
> >   prefork.c
> >   http_core.c
> >   mod_mime.c
> >   mod_status.c
> >   mod_autoindex.c
> >   mod_asis.c
> >   mod_cgi.c
> >   mod_negotiation.c
> >   mod_dir.c
> >   mod_actions.c
> >   mod_userdir.c
> >   mod_alias.c
> >   mod_so.c
>
> > Running ldd on mod_python reveals:
>
> > /usr/local/apache2/modules/mod_python.so:
> >         libpthread.so.0 => /lib64/libpthread.so.0 (0x2af216d13000)
> >         libdl.so.2 => /lib64/libdl.so.2 (0x2af216f2d000)
> >         libutil.so.1 => /lib64/libutil.so.1 (0x2af217131000)
> >         libm.so.6 => /lib64/libm.so.6 (0x2af217335000)
> >         libc.so.6 => /lib64/libc.so.6 (0x2af2175b8000)
> >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
>
> The mod_python module isn't linking to shared Python library but has
> linked it statically. This can cause problems, see below.
>
> > and on the python ldap module:
>
> > /usr/local/lib/python2.5/site-packages/python_ldap-2.3.5-py2.5-linux-
> > x86_64.egg/_ldap.so
> >         libldap_r-2.3.so.0 => /usr/lib64/libldap_r-2.3.so.0
> > (0x2aad1567e000)
> >         liblber-2.3.so.0 => /usr/lib64/liblber-2.3.so.0
> > (0x2aad158c7000)
> >         libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x2aad15ad5000)
> >         libssl.so.6 => /lib64/libssl.so.6 (0x2aad15cef000)
> >         libcrypto.so.6 => /lib64/libcrypto.so.6 (0x2aad15f38000)
> >         libpython2.5.so.1.0 => /usr/local/lib/libpython2.5.so.1.0
> > (0x2aad1628)
>
> The ldap module is link Python shared library.
>
> That mod_python.so has embedded static module and you can shared being
> linked in here can cause crashes.
>
> Haven't seen this variation of problem before, but see:
>
> http://code.google.com/p/modwsgi/wiki/InstallationIssues
>
> This describes issues with use of static and shared library for Python
> at same time when using mod_python and mod_wsgi together.
>
> In short, rebuild mod_python so it uses shared Python library instead.
>
> Maybe also consider using mod_wsgi as well. It will not solve the
> problem, but arguable better solution these days. :-)
>
> Graham
>
> >         libpthread.so.0 => /lib64/libpthread.so.0 (0x2aad165ef000)
> >         libc.so.6 => /lib64/libc.so.6 (0x2aad16809000)
> >         libresolv.so.2 => /lib64/libresolv.so.2 (0x2aad16b5c000)
> >         libdl.so.2 => /lib64/libdl.so.2 (0x2aad16d72000)
> >         libcrypt.so.1 => /lib64/libcrypt.so.1 (0x2aad16f76000)
> >         libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2
> > (0x2aad171ae000)
> >         libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x2aad173dd000)
> >         libcom_err.so.2 => /lib64/libcom_err.so.2 (0x2aad1767)
> >         libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3
> > (0x2aad17872000)
> >         libz.so.1 => /usr/lib64/libz.so.1 (0x2aad17a98000)
> >         libutil.so.1 => /lib64/libutil.so.1 (0x2aad17cac000)
> >         libm.so.6 => /lib64/libm.so.6 (0x2aad17eaf000)
> >         /lib64/ld-linux-x86-64.so.2 (0x0039a2c0)
> >         libkrb5support.so.0 => /usr/lib64/libkrb5support.so.0
> > (0x2aad18133000)
> >         libkeyutils.so.1 => /lib64/libkeyutils.so.1
> > (0x2aad1833b000)
> >         libselinux.so.1 => /lib64/libselinux.so.1 (0x2aad1853e000)
> >         libsepol.so.1 => /lib64/libsepol.so.1 (0x2aad18756000)
>
> > and:
>
> > 

Re: Easy way to serialize objects

2008-11-10 Thread Ivan Tarradellas

Tnxs a lot Russ,

Then I will take a look on the state-of-the-art of this libraries. ;-)

On 8 nov, 05:22, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote:
> On Sat, Nov 8, 2008 at 1:35 AM,IvanTarradellas<[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > With Django, what is the easy and best way to serialize/deserialize
> > objects that are no Django objects?
>
> > django.core.serializers only works with Django objects. But what
> > happens if we have other object type?
>
> The short answer is "you have to build the serializer yourself".
> Django doesn't provide any mechanism for serializing arbitrary Python
> objects.
>
> The long answer depends on the serializer you want to use. Django's
> model serialization module builds on a number of other libraries
> (Python's builtin XML handling, simpleJSON, YAML, etc). These
> libraries handle the logic for how to serialize python primitive types
> (integer, list, etc). The Django serialization module describes how to
> decompose a django model instance into a series of primitives.
>
> If you want to serialize your own arbitrary object, you will need to
> come up with a similar set of rules, and wrap it around the base
> serialization libraries.
>
> Yours,
> Russ Magee %-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



loading initial data with yml

2008-11-10 Thread Adda Badda

Hi all,

Im having a problem loading initial data into my app with yaml. I have
installed yaml for python using macports and placed the package in my
site-packages directory. From the shell the yaml package loads when I
type "import yaml" but django still tells me: "yml is not a known
serialization" when I try and load data.

Any ideas?

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



has more than 1 ForeignKey to

2008-11-10 Thread [EMAIL PROTECTED]

Hi all,

I have a UserProfile connected to auth.models.User using

user = models.ForeignKey(User, unique=True)

Additionally, I'd like to connect users to each other with manager/
managed hierarchical relationships, whereby everyone has one manager
(except the big boss who has none):

manager = models.ForeignKey(User, blank=True,
related_name='employees_userprofile_manager')

My models fail to load with the exception:
 has more than 1
ForeignKey to 

This doesn't seem logical to me at all: the above is a perfectly fine
example of two foreign keys being meaningful. Why is this not possible
and what is the workaround, or rather, the proper way to do this?

I'm using Django 1.0.

Any help is much appreciated.

regards,
Klaas van Schelven

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



No clue what to do !

2008-11-10 Thread dboddin

Hi,

I get this error 
AttributeError: type object 'CM' has no attribute 'fields'
and than
AlreadyRegistered: The model List is already registered

I see no error in models.py or admin.py, please help.

http://dpaste.com/hold/89667/
http://dpaste.com/89670/


r/Delle


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



Re: Django and Python 2.6

2008-11-10 Thread Kegan

I am planning to host at WebFaction. Anyone using Django + Python2.6
at WebFaction ? Care to share ?

On Nov 10, 4:42 pm, m0nonoke <[EMAIL PROTECTED]> wrote:
> I am using Win32 and there are still quite a few Python 2.6 libs /
> binaries that are unavailable, such as mod_python. If you are on linux
> though, you should have no problems.
>
> On Nov 10, 8:08 am, Kegan <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > If I start a new Django project today. Should I not be using Python
> > 2.6 ?
>
> > I have read some threads here that ensure Django 1.0+ have no problem
> > with Python 2.6. However, is there any other reason you would
> > discourage using of Python 2.6 (if you 'do' discourage) ? Example,
> > inadequate 3rd party libraries, etc?
>
> > Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django and Python 2.6

2008-11-10 Thread m0nonoke

I am using Win32 and there are still quite a few Python 2.6 libs /
binaries that are unavailable, such as mod_python. If you are on linux
though, you should have no problems.

On Nov 10, 8:08 am, Kegan <[EMAIL PROTECTED]> wrote:
> Hi,
>
> If I start a new Django project today. Should I not be using Python
> 2.6 ?
>
> I have read some threads here that ensure Django 1.0+ have no problem
> with Python 2.6. However, is there any other reason you would
> discourage using of Python 2.6 (if you 'do' discourage) ? Example,
> inadequate 3rd party libraries, etc?
>
> Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



bottom line on postgres schema use in 0.96?

2008-11-10 Thread jeff

hi. i have been working to make use of postres schema in an app wit
version 0.96. tried 3 options:

1. in settings.py, put in an entry like this:
CONNECTION_INIT_SQL = ( 'SET search_path TO
django_application_schema',)

2. in settings.py, put in an entry like this:
DATABASE_SCHEMAS = 'django_application_schema'

3. finally, in models .py for each model add a clause like this:
class meta:
db_table = "'schema_name'.'model_table_name'"

1 and 2 did nothing. 3 created a table in the right schema in
postgres, but puked when i wrote to it.

does anyone know whether any of these options should work? if not is
there a work-around or is it expected in a particular version?

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



Django and Python 2.6

2008-11-10 Thread Kegan

Hi,

If I start a new Django project today. Should I not be using Python
2.6 ?

I have read some threads here that ensure Django 1.0+ have no problem
with Python 2.6. However, is there any other reason you would
discourage using of Python 2.6 (if you 'do' discourage) ? Example,
inadequate 3rd party libraries, etc?

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