Re: How can I delete the default sqlite3 db?

2008-07-14 Thread adldesigner

Thanks a lot for the quick reply!

I know how to create the db.
What I need to know is where did django create the default one.

I didn't create it. I just specified I wanted to use sqlite3 in the
settings.py file, and left the DATABASE_NAME intact.

On Jul 15, 1:58 am, cschand <[EMAIL PROTECTED]> wrote:
> create a folder called db in your project folder
>
> and in your settings file
>
> import os
>
> DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2',
> 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
> DATABASE_NAME = os.path.join(os.path.dirname("__file__"), 'db/
> test.db')
>
> here test.db is your sqllite database. You can change with your db
> name
>
> satheesh
>
> On Jul 14, 11:44 am, adldesigner <[EMAIL PROTECTED]> wrote:
>
> > Hi guys,
>
> > I'm trying to look for the location of the sqlite3 database that
> > django creates if you don't specify anything for DATABASE_NAME in the
> > settings.py file.
>
> > I wish to delete this db, and use a new one created by me in a custom
> > directory.
> > Where is this default database located?
>
> > Thank you very much for your help...
>
> > Regards,
> > adldesigner
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: IOError with files uploads bigger than 2.5 MB

2008-07-14 Thread tom

hi,

i have done that. I am running the server with the runserver command.
I tried also different directories using the FILE_UPLOAD_TEMP_DIR
without any change. This behaviour is reproducable on different
servers and come up with upgrading to the latest revision of the
django branch. It has been working before. I increased the
FILE_UPLOAD_MAX_MEMORY_SIZE for the moment, but need to change that
back to the FILE_UPLOAD_TEMP_DIR soon.

cheers, tom

On 14 Jul., 04:54, Julien Phalip <[EMAIL PROTECTED]> wrote:
> Looks like apache does not have write access to that directory.
> Try setting a different directory where Apache will have appropriate
> access, use the FILE_UPLOAD_TEMP_DIR setting for that.
>
> On Jul 14, 11:48 am, tom <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I have a problem with file uploads which are bigger than 2.5 MBs. When
> > I use files which are smaller than 2.5 MBs, the files save as
> > expected. As soon as they are bigger than that, I get an IOError (see
> > traceback further down). I have checked that i have write and delete
> > permissions on this directory. When I change the
> > FILE_UPLOAD_MAX_MEMORY_SIZE the uploads are working fine.
>
> > Help would be very much appreciated. :)
>
> > Cheers, Tom
>
> > """
> > Environment:
>
> > Request Method: POST
> > Request URL:http://localhost:8000/admin/ads/ad/11/
> > Django Version: 0.97-pre-SVN-unknown
> > Python Version: 2.5.1
> > Installed Applications:
> > ['django.contrib.auth',
> >  'django.contrib.contenttypes',
> >  'django.contrib.sessions',
> >  'django.contrib.sites',
> >  'django.contrib.admin',
> >  'django.contrib.flatpages',
> >  'django.contrib.comments',
> >  'our.aps']
> > Installed Middleware:
> > ('django.middleware.common.CommonMiddleware',
> >  'django.contrib.sessions.middleware.SessionMiddleware',
> >  'django.contrib.auth.middleware.AuthenticationMiddleware',
> >  'django.middleware.cache.CacheMiddleware',
> >  'django.middleware.doc.XViewMiddleware',
> >  'our.middleware.threadlocals.ThreadLocals',
> >  'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware')
>
> > Traceback:
> > File "/Library/Python/2.5/site-packages/django/core/handlers/base.py"
> > in get_response
> >   86.                 response = callback(request, *callback_args,
> > **callback_kwargs)
> > File "/Library/Python/2.5/site-packages/django/contrib/admin/views/
> > decorators.py" in _checklogin
> >   62.             return view_func(request, *args, **kwargs)
> > File "/Library/Python/2.5/site-packages/django/views/decorators/
> > cache.py" in _wrapped_view_func
> >   44.         response = view_func(request, *args, **kwargs)
> > File "/Library/Python/2.5/site-packages/django/contrib/admin/views/
> > main.py" in change_stage
> >   338.             new_object = manipulator.save(new_data)
> > File "/Library/Python/2.5/site-packages/django/db/models/
> > manipulators.py" in save
> >   106.                 f.save_file(new_data, new_object, self.change
> > and self.original_object or None, self.change, rel=False, save=False)
> > File "/Library/Python/2.5/site-packages/django/db/models/fields/
> > __init__.py" in save_file
> >   855.             func(file_name, file, save)
> > File "/Library/Python/2.5/site-packages/django/db/models/fields/
> > __init__.py" in 
> >   817.         setattr(cls, 'save_%s_file' % self.name, lambda
> > instance, filename, raw_field, save=True:
> > instance._save_FIELD_file(self, filename, raw_field, save))
> > File "/Library/Python/2.5/site-packages/django/db/models/base.py" in
> > _save_FIELD_file
> >   532.             file_move_safe(raw_field.temporary_file_path(),
> > full_filename)
> > File "/Library/Python/2.5/site-packages/django/core/files/move.py" in
> > file_move_safe
> >   40.         file_move(old_file_name, new_file_name)
> > File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > python2.5/shutil.py" in move
> >   199.             copy2(src,dst)
> > File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > python2.5/shutil.py" in copy2
> >   91.     copyfile(src, dst)
> > File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > python2.5/shutil.py" in copyfile
> >   46.         fsrc = open(src, 'rb')
>
> > Exception Type: IOError at /admin/ads/ad/11/
> > Exception Value: [Errno 2] No such file or directory: '/var/folders/g2/
> > g2k+MI0fHlCR7GvjpacMPU+++TI/-Tmp-/tmpR3rxkC.upload'
>
> > """
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: IOError with files uploads bigger than 2.5 MB

2008-07-14 Thread Julien Phalip

Do you also get a 'No such file or directory' error when using the
FILE_UPLOAD_TEMP_DIR setting, or do you get a different error?

On Jul 14, 5:34 pm, tom <[EMAIL PROTECTED]> wrote:
> hi,
>
> i have done that. I am running the server with the runserver command.
> I tried also different directories using the FILE_UPLOAD_TEMP_DIR
> without any change. This behaviour is reproducable on different
> servers and come up with upgrading to the latest revision of the
> django branch. It has been working before. I increased the
> FILE_UPLOAD_MAX_MEMORY_SIZE for the moment, but need to change that
> back to the FILE_UPLOAD_TEMP_DIR soon.
>
> cheers, tom
>
> On 14 Jul., 04:54, Julien Phalip <[EMAIL PROTECTED]> wrote:
>
> > Looks like apache does not have write access to that directory.
> > Try setting a different directory where Apache will have appropriate
> > access, use the FILE_UPLOAD_TEMP_DIR setting for that.
>
> > On Jul 14, 11:48 am, tom <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > I have a problem with file uploads which are bigger than 2.5 MBs. When
> > > I use files which are smaller than 2.5 MBs, the files save as
> > > expected. As soon as they are bigger than that, I get an IOError (see
> > > traceback further down). I have checked that i have write and delete
> > > permissions on this directory. When I change the
> > > FILE_UPLOAD_MAX_MEMORY_SIZE the uploads are working fine.
>
> > > Help would be very much appreciated. :)
>
> > > Cheers, Tom
>
> > > """
> > > Environment:
>
> > > Request Method: POST
> > > Request URL:http://localhost:8000/admin/ads/ad/11/
> > > Django Version: 0.97-pre-SVN-unknown
> > > Python Version: 2.5.1
> > > Installed Applications:
> > > ['django.contrib.auth',
> > >  'django.contrib.contenttypes',
> > >  'django.contrib.sessions',
> > >  'django.contrib.sites',
> > >  'django.contrib.admin',
> > >  'django.contrib.flatpages',
> > >  'django.contrib.comments',
> > >  'our.aps']
> > > Installed Middleware:
> > > ('django.middleware.common.CommonMiddleware',
> > >  'django.contrib.sessions.middleware.SessionMiddleware',
> > >  'django.contrib.auth.middleware.AuthenticationMiddleware',
> > >  'django.middleware.cache.CacheMiddleware',
> > >  'django.middleware.doc.XViewMiddleware',
> > >  'our.middleware.threadlocals.ThreadLocals',
> > >  'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware')
>
> > > Traceback:
> > > File "/Library/Python/2.5/site-packages/django/core/handlers/base.py"
> > > in get_response
> > >   86.                 response = callback(request, *callback_args,
> > > **callback_kwargs)
> > > File "/Library/Python/2.5/site-packages/django/contrib/admin/views/
> > > decorators.py" in _checklogin
> > >   62.             return view_func(request, *args, **kwargs)
> > > File "/Library/Python/2.5/site-packages/django/views/decorators/
> > > cache.py" in _wrapped_view_func
> > >   44.         response = view_func(request, *args, **kwargs)
> > > File "/Library/Python/2.5/site-packages/django/contrib/admin/views/
> > > main.py" in change_stage
> > >   338.             new_object = manipulator.save(new_data)
> > > File "/Library/Python/2.5/site-packages/django/db/models/
> > > manipulators.py" in save
> > >   106.                 f.save_file(new_data, new_object, self.change
> > > and self.original_object or None, self.change, rel=False, save=False)
> > > File "/Library/Python/2.5/site-packages/django/db/models/fields/
> > > __init__.py" in save_file
> > >   855.             func(file_name, file, save)
> > > File "/Library/Python/2.5/site-packages/django/db/models/fields/
> > > __init__.py" in 
> > >   817.         setattr(cls, 'save_%s_file' % self.name, lambda
> > > instance, filename, raw_field, save=True:
> > > instance._save_FIELD_file(self, filename, raw_field, save))
> > > File "/Library/Python/2.5/site-packages/django/db/models/base.py" in
> > > _save_FIELD_file
> > >   532.             file_move_safe(raw_field.temporary_file_path(),
> > > full_filename)
> > > File "/Library/Python/2.5/site-packages/django/core/files/move.py" in
> > > file_move_safe
> > >   40.         file_move(old_file_name, new_file_name)
> > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > > python2.5/shutil.py" in move
> > >   199.             copy2(src,dst)
> > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > > python2.5/shutil.py" in copy2
> > >   91.     copyfile(src, dst)
> > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > > python2.5/shutil.py" in copyfile
> > >   46.         fsrc = open(src, 'rb')
>
> > > Exception Type: IOError at /admin/ads/ad/11/
> > > Exception Value: [Errno 2] No such file or directory: '/var/folders/g2/
> > > g2k+MI0fHlCR7GvjpacMPU+++TI/-Tmp-/tmpR3rxkC.upload'
>
> > > """
--~--~-~--~~~---~--~~
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@googlegr

worked fine last night, no changes but now get DoesNotExistError

2008-07-14 Thread allisongardner

I am stumped. Database worked fine yesterday, adding new protein
sequence quite happily. Start tryign to do the same today, having made
no changes at all to my models or anything, and I get the error:
DoesNotExist at /admin/amyprot/sequence/add/
Protein matching query does not exist.
Request Method: GET
Request URL:http://127.0.0.1:8000/admin/amyprot/sequence/add/
Exception Type: DoesNotExist
Exception Value:Protein matching query does not exist.
Exception Location: /usr/lib/python2.5/site-packages/django/db/models/
query.py in get, line 252

(ps is it bad that i show all my paths here?)

I have three tables: Protein, Mutation and Sequence. Prot_name is the
primary key in my protein table. Mutation has this set as a foreign
key, the primary key in my Mutation table is Mut_id. I have a one to
one relationship from Mutation to Sequence (with me renaming the
primary key sequence_id but obviously it is the same as mut_id). I am
not using the svn release and can't update to that for a couple of
months.

Why work last night and not now..how can it break itself over
night???!

Regards,
Allison
--~--~-~--~~~---~--~~
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 delete the default sqlite3 db?

2008-07-14 Thread Evert

> What I need to know is where did django create the default one.
>
> I didn't create it. I just specified I wanted to use sqlite3 in the
> settings.py file, and left the DATABASE_NAME intact.

Probably in your tmp directory: /tmp on most unices, or /var/tmp on OS
X (don't know about windows).

You can find it by starting the database with python manage.py
dbshell, and then on the sqlite prompt, use the '.databases' command.

Although, from a quick try myself, while .databases does list some
paths in tmp, these files don't actually show up in tmp. I guess it
just creates an empty database in memory for the moment, until you
save something.
Does your application actually work without a DATABASE_NAME? Ie, do
you get a database filled with data?

  Evert

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



ForeignKey ordering on Models

2008-07-14 Thread Darthmahon

Hey,

I want to have a field on one model link to another model as a
ForeignKey. Problem is, this field needs to be declared before the
second model has been defined.

Example below - latest refers to Album, but Album is below Musician so
it won't let me do this? Is there a way of getting around this without
having to create another Model just for this?

class Musician(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
instrument = models.CharField(max_length=100)
latest = models.ForeignKey(Album)

class Album(models.Model):
artist = models.ForeignKey(Musician)
name = models.CharField(max_length=100)
release_date = models.DateField()
num_stars = models.IntegerField()
--~--~-~--~~~---~--~~
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 doesn't catch IntegrityErrors?

2008-07-14 Thread Alex Rades

Hi,
I'm using latest newforms-admin and I have a simple model which is:

class Backend(models.Model):
name = models.CharField(unique=True, max_length=255)
address = models.IPAddressField()

class Meta:
db_table = u'backend'
ordering = ('name',)

In the admin, when I try to add a new object with a name which is
already present, the unique=True constraint doesn't work as expected,
the error is:

IntegrityError at /admin/models_app/backend/add/
duplicate key value violates unique constraint "backend_name_key"


Basically, it seems the admin site doesn't handle unique
constraints...do you have suggestions?

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: ForeignKey ordering on Models

2008-07-14 Thread Daniel Roseman

On Jul 14, 10:27 am, Darthmahon <[EMAIL PROTECTED]> wrote:
> Hey,
>
> I want to have a field on one model link to another model as a
> ForeignKey. Problem is, this field needs to be declared before the
> second model has been defined.
>
> Example below - latest refers to Album, but Album is below Musician so
> it won't let me do this? Is there a way of getting around this without
> having to create another Model just for this?
>
> class Musician(models.Model):
>     first_name = models.CharField(max_length=50)
>     last_name = models.CharField(max_length=50)
>     instrument = models.CharField(max_length=100)
>     latest = models.ForeignKey(Album)
>
> class Album(models.Model):
>     artist = models.ForeignKey(Musician)
>     name = models.CharField(max_length=100)
>     release_date = models.DateField()
>     num_stars = models.IntegerField()


Just put the name of the model in quotes:

latest = models.ForeignKey('Album')

--
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 doesn't catch IntegrityErrors?

2008-07-14 Thread rui
I had to come around this doing in the start of the code:

from django.db import transaction

And after the IntegrityError is catched (with a try/except block):

transaction.rollback()

Like:
  try:
   user.save()
  except IntegrityError, e:
transaction.rollback()

Sorry but i don´t have experience with the admin-app to help you on
this, but this did the trick for me.

Cheers.
--
Rui
http://ruivaldo.blogspot.com


On Mon, Jul 14, 2008 at 6:23 AM, Alex Rades <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I'm using latest newforms-admin and I have a simple model which is:
>
> class Backend(models.Model):
>name = models.CharField(unique=True, max_length=255)
>address = models.IPAddressField()
>
>class Meta:
>db_table = u'backend'
>ordering = ('name',)
>
> In the admin, when I try to add a new object with a name which is
> already present, the unique=True constraint doesn't work as expected,
> the error is:
>
> IntegrityError at /admin/models_app/backend/add/
> duplicate key value violates unique constraint "backend_name_key"
>
>
> Basically, it seems the admin site doesn't handle unique
> constraints...do you have suggestions?
>
> 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: How to display the images in the template page under the django development server

2008-07-14 Thread rui
Hi Eric,

There is a bit about it in this excerpt:

"""
MEDIA_ROOT

Default: '' (Empty string)

Absolute path to the directory that holds media for this installation.
Example: "/home/media/media.lawrence.com/" See also MEDIA_URL.
MEDIA_URL

Default: '' (Empty string)

URL that handles the media served from MEDIA_ROOT. Example:
"http://media.lawrence.com";

Note that this should have a trailing slash if it has a path component.

Good: "http://www.example.com/static/"; Bad: "http://www.example.com/static";
"""

As far i know (please, someone correct me if i´m wrong), this
configuration tells Django (on the production mode) which
request.path´s are for static files and for performance reasons
prevent them of generating full HttpRequests on Django app, as the
others, to views.

And other things like: they will not pass by middleware´s,
context_processors, etc.


Cheers :)
--
Rui
http://ruivaldo.blogspot.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: worked fine last night, no changes but now get DoesNotExistError

2008-07-14 Thread allisongardner

Hi, Thank you for replying.
I am using MySQL. I ran Protein.objects.all() (i typed in Python
manage.py dbshell and the typed the query at the MySQL prompt). All I
get is a -> prompt.
Really stumped on this one and near to having a very big tantrum.
Allison

On Jul 14, 12:10 pm, rui <[EMAIL PROTECTED]> wrote:
> Hi Allison,
>
> Which database are you using ? SQLite ?
> The Protein.objects.all() return the desired object ? Does it returns
> something ?
>
> Cheers :)
> --
> Ruihttp://ruivaldo.blogspot.com
>
> On Mon, Jul 14, 2008 at 6:04 AM, allisongardner
>
> <[EMAIL PROTECTED]> wrote:
>
> > I am stumped. Database worked fine yesterday, adding new protein
> > sequence quite happily. Start tryign to do the same today, having made
> > no changes at all to my models or anything, and I get the error:
> > DoesNotExist at /admin/amyprot/sequence/add/
> > Protein matching query does not exist.
> > Request Method:         GET
> > Request URL:    http://127.0.0.1:8000/admin/amyprot/sequence/add/
> > Exception Type:         DoesNotExist
> > Exception Value:        Protein matching query does not exist.
> > Exception Location:     /usr/lib/python2.5/site-packages/django/db/models/
> > query.py in get, line 252
>
> > (ps is it bad that i show all my paths here?)
>
> > I have three tables: Protein, Mutation and Sequence. Prot_name is the
> > primary key in my protein table. Mutation has this set as a foreign
> > key, the primary key in my Mutation table is Mut_id. I have a one to
> > one relationship from Mutation to Sequence (with me renaming the
> > primary key sequence_id but obviously it is the same as mut_id). I am
> > not using the svn release and can't update to that for a couple of
> > months.
>
> > Why work last night and not now..how can it break itself over
> > night???!
>
> > Regards,
> > Allison
--~--~-~--~~~---~--~~
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: worked fine last night, no changes but now get DoesNotExistError

2008-07-14 Thread allisongardner

My mistake, ran it from python interactive prompt after typing in
python manage.py shell (you can tell I am a real newbie). I get all
the objects returned that are there, no problem.
By the way I have tried the classic turning my computer on and off
again ...next stage will be a hammer!
Allison

On Jul 14, 12:10 pm, rui <[EMAIL PROTECTED]> wrote:
> Hi Allison,
>
> Which database are you using ? SQLite ?
> The Protein.objects.all() return the desired object ? Does it returns
> something ?
>
> Cheers :)
> --
> Ruihttp://ruivaldo.blogspot.com
>
> On Mon, Jul 14, 2008 at 6:04 AM, allisongardner
>
> <[EMAIL PROTECTED]> wrote:
>
> > I am stumped. Database worked fine yesterday, adding new protein
> > sequence quite happily. Start tryign to do the same today, having made
> > no changes at all to my models or anything, and I get the error:
> > DoesNotExist at /admin/amyprot/sequence/add/
> > Protein matching query does not exist.
> > Request Method:         GET
> > Request URL:    http://127.0.0.1:8000/admin/amyprot/sequence/add/
> > Exception Type:         DoesNotExist
> > Exception Value:        Protein matching query does not exist.
> > Exception Location:     /usr/lib/python2.5/site-packages/django/db/models/
> > query.py in get, line 252
>
> > (ps is it bad that i show all my paths here?)
>
> > I have three tables: Protein, Mutation and Sequence. Prot_name is the
> > primary key in my protein table. Mutation has this set as a foreign
> > key, the primary key in my Mutation table is Mut_id. I have a one to
> > one relationship from Mutation to Sequence (with me renaming the
> > primary key sequence_id but obviously it is the same as mut_id). I am
> > not using the svn release and can't update to that for a couple of
> > months.
>
> > Why work last night and not now..how can it break itself over
> > night???!
>
> > Regards,
> > Allison
--~--~-~--~~~---~--~~
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: worked fine last night, no changes but now get DoesNotExistError

2008-07-14 Thread rui

Could post your view-code at "admin/amyprot/sequence/add/" ?

Looks like that it is a ForeignKey  broken relationship or something like this.

--
Rui
http://ruivaldo.blogspot.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: worked fine last night, no changes but now get DoesNotExistError

2008-07-14 Thread allisongardner

Okay, that is my gut instinct too, a broken relationship. What gets me
though is that is worked last night no problem. Nothing was changed.
Will have a fiddle around and see what I can do.
By the way I do not understand what you mean by "could post your view
code at "admin/amyprot/sequence/add/"?...Like i said I am a real
newbie, and a not very confident one at that!
Allison

On Jul 14, 12:38 pm, rui <[EMAIL PROTECTED]> wrote:
> Could post your view-code at "admin/amyprot/sequence/add/" ?
>
> Looks like that it is a ForeignKey  broken relationship or something like 
> this.
>
> --
> Ruihttp://ruivaldo.blogspot.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: worked fine last night, no changes but now get DoesNotExistError

2008-07-14 Thread rui

Hi Allison,

Which database are you using ? SQLite ?
The Protein.objects.all() return the desired object ? Does it returns
something ?

Cheers :)
--
Rui
http://ruivaldo.blogspot.com


On Mon, Jul 14, 2008 at 6:04 AM, allisongardner
<[EMAIL PROTECTED]> wrote:
>
> I am stumped. Database worked fine yesterday, adding new protein
> sequence quite happily. Start tryign to do the same today, having made
> no changes at all to my models or anything, and I get the error:
> DoesNotExist at /admin/amyprot/sequence/add/
> Protein matching query does not exist.
> Request Method: GET
> Request URL:http://127.0.0.1:8000/admin/amyprot/sequence/add/
> Exception Type: DoesNotExist
> Exception Value:Protein matching query does not exist.
> Exception Location: /usr/lib/python2.5/site-packages/django/db/models/
> query.py in get, line 252
>
> (ps is it bad that i show all my paths here?)
>
> I have three tables: Protein, Mutation and Sequence. Prot_name is the
> primary key in my protein table. Mutation has this set as a foreign
> key, the primary key in my Mutation table is Mut_id. I have a one to
> one relationship from Mutation to Sequence (with me renaming the
> primary key sequence_id but obviously it is the same as mut_id). I am
> not using the svn release and can't update to that for a couple of
> months.
>
> Why work last night and not now..how can it break itself over
> night???!
>
> Regards,
> Allison
> >
>

--~--~-~--~~~---~--~~
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: worked fine last night, no changes but now get DoesNotExistError

2008-07-14 Thread rui

I meant the code that is called when you access:
'"admin/amyprot/sequence/add/" :)
Cheers.
--
Rui
http://ruivaldo.blogspot.com


On Mon, Jul 14, 2008 at 7:42 AM, allisongardner
<[EMAIL PROTECTED]> wrote:
>
> Okay, that is my gut instinct too, a broken relationship. What gets me
> though is that is worked last night no problem. Nothing was changed.
> Will have a fiddle around and see what I can do.
> By the way I do not understand what you mean by "could post your view
> code at "admin/amyprot/sequence/add/"?...Like i said I am a real
> newbie, and a not very confident one at that!
> Allison
>
> On Jul 14, 12:38 pm, rui <[EMAIL PROTECTED]> wrote:
>> Could post your view-code at "admin/amyprot/sequence/add/" ?
>>
>> Looks like that it is a ForeignKey  broken relationship or something like 
>> this.
>>
>> --
>> Ruihttp://ruivaldo.blogspot.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: admin doesn't catch IntegrityErrors?

2008-07-14 Thread Alex Rades

My problem is specifically with the admin site
Thanks


On Mon, Jul 14, 2008 at 11:55 AM, rui <[EMAIL PROTECTED]> wrote:
> I had to come around this doing in the start of the code:
>
> from django.db import transaction
>
> And after the IntegrityError is catched (with a try/except block):
>
> transaction.rollback()
>
> Like:
>  try:
>   user.save()
>  except IntegrityError, e:
>transaction.rollback()
>
> Sorry but i don´t have experience with the admin-app to help you on
> this, but this did the trick for me.
>
> Cheers.
> --
> Rui
> http://ruivaldo.blogspot.com
>
>
> On Mon, Jul 14, 2008 at 6:23 AM, Alex Rades <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>> I'm using latest newforms-admin and I have a simple model which is:
>>
>> class Backend(models.Model):
>>name = models.CharField(unique=True, max_length=255)
>>address = models.IPAddressField()
>>
>>class Meta:
>>db_table = u'backend'
>>ordering = ('name',)
>>
>> In the admin, when I try to add a new object with a name which is
>> already present, the unique=True constraint doesn't work as expected,
>> the error is:
>>
>> IntegrityError at /admin/models_app/backend/add/
>> duplicate key value violates unique constraint "backend_name_key"
>>
>>
>> Basically, it seems the admin site doesn't handle unique
>> constraints...do you have suggestions?
>>
>> 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: templates: additional forloop variable?

2008-07-14 Thread Russell Keith-Magee

On Mon, Jul 14, 2008 at 7:46 AM, Scott Moonen <[EMAIL PROTECTED]> wrote:
> I'm considering adding a forloop.previous (or somesuch) variable to the
> supplemental variables produced by the for tag.  If forloop.first is true,
> this value would always be None, but otherwise it would reference the actual
> loop item from the prior iteration.

I can't help but get the feeling that there is another way to skin
your cat. However, without knowing exactly what you're trying to do,
its difficult to tell for certain.

> Is there sufficient interest in this that I should consider going the extra
> mile by opening a ticket and submitting a patch?

I can't vouch for the community as a whole, but as fair warning: the
core developers are preoccupied with delivering v1.0 at the moment, so
you may find that suggestions about improvements that aren't on the
schedule for v1.0 will probably get ignored for a little while

> Or (please excuse my
> ignorance!) is opening a ticket actually the preferred way to gauge the
> interest level?

Generally, doing both is a good idea. The ticket tracks the idea
itself - if nobody is interested, we can close the ticket, and if
anyone else has the same idea later on, we can point them at the
ticket. The mailing list enables you to establish who is interested in
the idea, and nail down the little details.

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: templates: additional forloop variable?

2008-07-14 Thread Scott Moonen
(Tim - thanks for the suggestion.)

Russ,

I'm considering adding a forloop.previous (or somesuch) variable to the
>> supplemental variables produced by the for tag.  If forloop.first is true,
>> this value would always be None, but otherwise it would reference the
>> actual
>> loop item from the prior iteration.
>>
>
> I can't help but get the feeling that there is another way to skin
> your cat. However, without knowing exactly what you're trying to do,
> its difficult to tell for certain.
>

Here's my use case: think tags with tag bundles.  So I have a list of tags
for an object that are like ("AGroup:Tag1", "AGroup:Tag2", "FluxCapacitor",
"ZGroup:Tag1", "ZGroup:Tag2").  At the moment I'm storing tags like this, as
"bundle:tagname" or "tagname".  For display purposes I order them by that
string, and format bundles within a , but individual tags as-is.  When
<% ifchanged tag.get_bundle %> (get_bundle is an instance method), I want to
determine whether I need to emit a , so I need to access the previous
tag in the list to determine if get_bundle returns an empty string.

As I write this, "forloop.previous" aside, it occurs to me that an alternate
approach might be for me to provide the unbundled and bundled tags to my
template in separate lists and display the unbundled tags all together
rather than interspersed.  Come to think of it, that might actually display
more attractively -- it could be rather ugly to have tags and bundles
interspersed.

Thank you for serving as my
CardboardProgrammerfor the
day. :)

  -- Scott

On Mon, Jul 14, 2008 at 7:53 AM, Russell Keith-Magee <[EMAIL PROTECTED]>
wrote:

>
> On Mon, Jul 14, 2008 at 7:46 AM, Scott Moonen <[EMAIL PROTECTED]>
> wrote:
> > I'm considering adding a forloop.previous (or somesuch) variable to the
> > supplemental variables produced by the for tag.  If forloop.first is
> true,
> > this value would always be None, but otherwise it would reference the
> actual
> > loop item from the prior iteration.
>
> I can't help but get the feeling that there is another way to skin
> your cat. However, without knowing exactly what you're trying to do,
> its difficult to tell for certain.
>
> > Is there sufficient interest in this that I should consider going the
> extra
> > mile by opening a ticket and submitting a patch?
>
> I can't vouch for the community as a whole, but as fair warning: the
> core developers are preoccupied with delivering v1.0 at the moment, so
> you may find that suggestions about improvements that aren't on the
> schedule for v1.0 will probably get ignored for a little while
>
> > Or (please excuse my
> > ignorance!) is opening a ticket actually the preferred way to gauge the
> > interest level?
>
> Generally, doing both is a good idea. The ticket tracks the idea
> itself - if nobody is interested, we can close the ticket, and if
> anyone else has the same idea later on, we can point them at the
> ticket. The mailing list enables you to establish who is interested in
> the idea, and nail down the little details.
>
> Yours,
> Russ Magee %-)
>
> >
>


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

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



Re: IOError with files uploads bigger than 2.5 MB

2008-07-14 Thread tom

Yes, I get the same error message. I tried it with a different
directory within the homedir of the user who is running the server and
also with the temp directory and even without any setting. Either on
Linux or on Max OSX. I also tried to run the server with sudo and I
also tried to write into the directories. With sudo I've got the same
error and writing into the directories was possible.

On 14 Jul., 10:54, Julien Phalip <[EMAIL PROTECTED]> wrote:
> Do you also get a 'No such file or directory' error when using the
> FILE_UPLOAD_TEMP_DIR setting, or do you get a different error?
>
> On Jul 14, 5:34 pm, tom <[EMAIL PROTECTED]> wrote:
>
> > hi,
>
> > i have done that. I am running the server with the runserver command.
> > I tried also different directories using the FILE_UPLOAD_TEMP_DIR
> > without any change. This behaviour is reproducable on different
> > servers and come up with upgrading to the latest revision of the
> > django branch. It has been working before. I increased the
> > FILE_UPLOAD_MAX_MEMORY_SIZE for the moment, but need to change that
> > back to the FILE_UPLOAD_TEMP_DIR soon.
>
> > cheers, tom
>
> > On 14 Jul., 04:54, Julien Phalip <[EMAIL PROTECTED]> wrote:
>
> > > Looks like apache does not have write access to that directory.
> > > Try setting a different directory where Apache will have appropriate
> > > access, use the FILE_UPLOAD_TEMP_DIR setting for that.
>
> > > On Jul 14, 11:48 am, tom <[EMAIL PROTECTED]> wrote:
>
> > > > Hi,
>
> > > > I have a problem with file uploads which are bigger than 2.5 MBs. When
> > > > I use files which are smaller than 2.5 MBs, the files save as
> > > > expected. As soon as they are bigger than that, I get an IOError (see
> > > > traceback further down). I have checked that i have write and delete
> > > > permissions on this directory. When I change the
> > > > FILE_UPLOAD_MAX_MEMORY_SIZE the uploads are working fine.
>
> > > > Help would be very much appreciated. :)
>
> > > > Cheers, Tom
>
> > > > """
> > > > Environment:
>
> > > > Request Method: POST
> > > > Request URL:http://localhost:8000/admin/ads/ad/11/
> > > > Django Version: 0.97-pre-SVN-unknown
> > > > Python Version: 2.5.1
> > > > Installed Applications:
> > > > ['django.contrib.auth',
> > > >  'django.contrib.contenttypes',
> > > >  'django.contrib.sessions',
> > > >  'django.contrib.sites',
> > > >  'django.contrib.admin',
> > > >  'django.contrib.flatpages',
> > > >  'django.contrib.comments',
> > > >  'our.aps']
> > > > Installed Middleware:
> > > > ('django.middleware.common.CommonMiddleware',
> > > >  'django.contrib.sessions.middleware.SessionMiddleware',
> > > >  'django.contrib.auth.middleware.AuthenticationMiddleware',
> > > >  'django.middleware.cache.CacheMiddleware',
> > > >  'django.middleware.doc.XViewMiddleware',
> > > >  'our.middleware.threadlocals.ThreadLocals',
> > > >  'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware')
>
> > > > Traceback:
> > > > File "/Library/Python/2.5/site-packages/django/core/handlers/base.py"
> > > > in get_response
> > > >   86.                 response = callback(request, *callback_args,
> > > > **callback_kwargs)
> > > > File "/Library/Python/2.5/site-packages/django/contrib/admin/views/
> > > > decorators.py" in _checklogin
> > > >   62.             return view_func(request, *args, **kwargs)
> > > > File "/Library/Python/2.5/site-packages/django/views/decorators/
> > > > cache.py" in _wrapped_view_func
> > > >   44.         response = view_func(request, *args, **kwargs)
> > > > File "/Library/Python/2.5/site-packages/django/contrib/admin/views/
> > > > main.py" in change_stage
> > > >   338.             new_object = manipulator.save(new_data)
> > > > File "/Library/Python/2.5/site-packages/django/db/models/
> > > > manipulators.py" in save
> > > >   106.                 f.save_file(new_data, new_object, self.change
> > > > and self.original_object or None, self.change, rel=False, save=False)
> > > > File "/Library/Python/2.5/site-packages/django/db/models/fields/
> > > > __init__.py" in save_file
> > > >   855.             func(file_name, file, save)
> > > > File "/Library/Python/2.5/site-packages/django/db/models/fields/
> > > > __init__.py" in 
> > > >   817.         setattr(cls, 'save_%s_file' % self.name, lambda
> > > > instance, filename, raw_field, save=True:
> > > > instance._save_FIELD_file(self, filename, raw_field, save))
> > > > File "/Library/Python/2.5/site-packages/django/db/models/base.py" in
> > > > _save_FIELD_file
> > > >   532.             file_move_safe(raw_field.temporary_file_path(),
> > > > full_filename)
> > > > File "/Library/Python/2.5/site-packages/django/core/files/move.py" in
> > > > file_move_safe
> > > >   40.         file_move(old_file_name, new_file_name)
> > > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > > > python2.5/shutil.py" in move
> > > >   199.             copy2(src,dst)
> > > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > > >

AuthenticationMiddleware question

2008-07-14 Thread alex finn

Can anybody explain me why django's AuthenticationMiddleware is
setting user attribute of request.__class__ and not of request itself?
What's the point of setting it on a class level rather then on the
instance level?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: IOError with files uploads bigger than 2.5 MB

2008-07-14 Thread Ramiro Morales

On Sun, Jul 13, 2008 at 10:48 PM, tom <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have a problem with file uploads which are bigger than 2.5 MBs. When
> I use files which are smaller than 2.5 MBs, the files save as
> expected. As soon as they are bigger than that, I get an IOError (see
> traceback further down). I have checked that i have write and delete
> permissions on this directory. When I change the
> FILE_UPLOAD_MAX_MEMORY_SIZE the uploads are working fine.
>

What SVN revision of Django are you using?.

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: Python PATH question

2008-07-14 Thread phillc

> > The runserver stuff is a bit too magic. It puts 'root' on sys.path but
> > only long enough to import 'mysite' package root.

um, i have never experienced this behavior.







plug: http://www.wtflab.com/tech/2008/jul/01/developed-directory-structure/

--~--~-~--~~~---~--~~
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: AuthenticationMiddleware question

2008-07-14 Thread Marty Alchin

On Mon, Jul 14, 2008 at 10:12 AM, alex finn <[EMAIL PROTECTED]> wrote:
> Can anybody explain me why django's AuthenticationMiddleware is
> setting user attribute of request.__class__ and not of request itself?
> What's the point of setting it on a class level rather then on the
> instance level?

Because it's not setting the user directly, it's setting a LazyUser
object, which is a Python descriptor. Descriptors only work the way
they're supposed to if they're set at the class level. Using a
descriptor allows it to go through the trouble of getting the user
only when it's actually gonna be used, and also cache it for later, so
it doesn't have to go through all that extra work more than once per
request, no matter how many times the user is accessed.

If you're interested in learning more about descriptors, I've written
a couple blog posts about it that might help.

http://gulopine.gamemusic.org/2007/nov/23/python-descriptors-part-1-of-2/
http://gulopine.gamemusic.org/2007/nov/24/python-descriptors-part-2-of-2/

-Gul

--~--~-~--~~~---~--~~
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 to display the images in the template page under the django development server

2008-07-14 Thread Karen Tracey
On Mon, Jul 14, 2008 at 6:06 AM, rui <[EMAIL PROTECTED]> wrote:

> Hi Eric,
>
> There is a bit about it in this excerpt:
>
> """
> MEDIA_ROOT
>
> Default: '' (Empty string)
>
> Absolute path to the directory that holds media for this installation.
> Example: "/home/media/media.lawrence.com/" See also MEDIA_URL.
> MEDIA_URL
>
> Default: '' (Empty string)
>
> URL that handles the media served from MEDIA_ROOT. Example:
> "http://media.lawrence.com";
>
> Note that this should have a trailing slash if it has a path component.
>
> Good: "http://www.example.com/static/"; Bad: "http://www.example.com/static
> "
> """
>
> As far i know (please, someone correct me if i´m wrong), this
> configuration tells Django (on the production mode) which
> request.path´s are for static files and for performance reasons
> prevent them of generating full HttpRequests on Django app, as the
> others, to views.
>
> And other things like: they will not pass by middleware´s,
> context_processors, etc.


No. In production, you configure your webserver so that URLs for your static
media are never routed to Django at all.  This configuration is entirely
outside of Django, and specific to whatever webserver you are using.  Django
doesn't do any special short-circuit processing on "media" urls because you
configure things so that Django is never asked to handle any of these
requests.  In coding your templates, you can use MEDIA_URL to ensure that
the static files are given the right prefix to prevent Django ever seeing
requests for them.

MEDIA_ROOT is used in production in conjuction with the FileField, see:

http://www.djangoproject.com/documentation/model-api/#filefield

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: AuthenticationMiddleware question

2008-07-14 Thread alex finn

Thank you so much Marty, that's what I need.

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



Images in MySQL

2008-07-14 Thread lukeqsee

I know you can store images in a BLOB field in mysql, but is it
possible with Django models?

Thanks,
Luke
--~--~-~--~~~---~--~~
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: worked fine last night, no changes but now get DoesNotExistError

2008-07-14 Thread Karen Tracey
On Mon, Jul 14, 2008 at 6:53 AM, rui <[EMAIL PROTECTED]> wrote:

> I meant the code that is called when you access:
> '"admin/amyprot/sequence/add/" :)
> Cheers.
>

Rui: Well, that'd be the admin app, so likely not the poster's code at all.


Allison: I assume you are using MyISAM tables?  They allow you to get into a
state where you've lost referential integrity, which could explain the
error.  Though, Django's admin code follows relationships on delete in an
attempt to prevent this sort of thing, so if the only way you've been
modifying the DB is with Django admin, this shouldn't really happen even
with MyISAM tables.  If you (or anyone else) use the mysql command line or
anything else non-Django, though, to delete records, then all bets are off.
The error makes it sound like a Protein has been deleted without all
references to it also being deleted.  A full traceback posted at someplace
like dpaste.com might help pin down more exactly what is going on.

What leve of Django exactly are you using?  You say 'not svn' but it isn't
clear whether you mean just a non-current svn checkout or something as old
as the 0.96.x release.

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: Images in MySQL

2008-07-14 Thread Marty Alchin

On Mon, Jul 14, 2008 at 10:41 AM, lukeqsee <[EMAIL PROTECTED]> wrote:
> I know you can store images in a BLOB field in mysql, but is it
> possible with Django models?

Not out of the box, but you're free to create your own custom field[1]
to do that for you. If you look hard enough, you can probably even
figure out how to get it supported in the admin interface, with a nice
file widget and everything.

-Gul

[1] http://www.djangoproject.com/documentation/custom_model_fields/

--~--~-~--~~~---~--~~
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 doesn't catch IntegrityErrors?

2008-07-14 Thread Karen Tracey
On Mon, Jul 14, 2008 at 5:23 AM, Alex Rades <[EMAIL PROTECTED]> wrote:

>
> Hi,
> I'm using latest newforms-admin and I have a simple model which is:
>
> class Backend(models.Model):
>name = models.CharField(unique=True, max_length=255)
>address = models.IPAddressField()
>
>class Meta:
>db_table = u'backend'
>ordering = ('name',)
>
> In the admin, when I try to add a new object with a name which is
> already present, the unique=True constraint doesn't work as expected,
> the error is:
>
> IntegrityError at /admin/models_app/backend/add/
> duplicate key value violates unique constraint "backend_name_key"
>
>
> Basically, it seems the admin site doesn't handle unique
> constraints...do you have suggestions?
>

In old admin these sorts of constraints were handled by the oldforms
manipulator framework, which did validation.  In newforms this validation is
still a work-in-progress, see ticket 6845:

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

I'm assuming (someone please correct me if I'm wrong) when newforms-admin
gets merged to trunk and this ticket gets integrated, issues like this will
be handled more elegantly like they were in the old admin.  But I haven't
actually had time to experiment at all with the new validation stuff yet.

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: Images in MySQL

2008-07-14 Thread Rudolph

Ticket 5361 provides a way to accomplish this by writing a custom
backend:
http://code.djangoproject.com/ticket/5361

The ticket is on the "maybe" list for 1.0!

Rudolph
--~--~-~--~~~---~--~~
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: Inquiry

2008-07-14 Thread Jeff Anderson

Kadusale, Myles wrote:

Good Day to All!

I am new to Django and I was wondering if there is a sample application
that deals with sessions that is not using cookies.
  
Django's session framework uses cookies. I don't know why you wouldn't 
want to do sessions without cookies, and I don't know of any projects 
that aim to do that. It wouldn't be difficult, however, to implement 
your own sessions that don't use cookies.

Also is there a directory structure in an web app when using Django?
Like in J2EE??
  

If you are referring to Java namespaces, then yes: Python has them.
If you are asking about urls in Django, I suggest you read through the 
tutorial in the official Django documentation.


Good luck!


Jeff Anderson

PS - instead of replying to an existing thread and changing the subject, 
it is better to start your own thread. Your message is in the middle of 
another thread. Thanks!




signature.asc
Description: OpenPGP digital signature


Re: worked fine last night, no changes but now get DoesNotExistError

2008-07-14 Thread rui

Thanks, Karen, for pointing out. The admin is yet a secret for me :)


--
Rui
http://ruivaldo.blogspot.com


On Mon, Jul 14, 2008 at 11:46 AM, Karen Tracey <[EMAIL PROTECTED]> wrote:
> On Mon, Jul 14, 2008 at 6:53 AM, rui <[EMAIL PROTECTED]> wrote:
>>
>> I meant the code that is called when you access:
>> '"admin/amyprot/sequence/add/" :)
>> Cheers.
>
> Rui: Well, that'd be the admin app, so likely not the poster's code at all.
>
> Allison: I assume you are using MyISAM tables?  They allow you to get into a
> state where you've lost referential integrity, which could explain the
> error.  Though, Django's admin code follows relationships on delete in an
> attempt to prevent this sort of thing, so if the only way you've been
> modifying the DB is with Django admin, this shouldn't really happen even
> with MyISAM tables.  If you (or anyone else) use the mysql command line or
> anything else non-Django, though, to delete records, then all bets are off.
> The error makes it sound like a Protein has been deleted without all
> references to it also being deleted.  A full traceback posted at someplace
> like dpaste.com might help pin down more exactly what is going on.
>
> What leve of Django exactly are you using?  You say 'not svn' but it isn't
> clear whether you mean just a non-current svn checkout or something as old
> as the 0.96.x release.
>
> 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: Images in MySQL

2008-07-14 Thread Marty Alchin

On Mon, Jul 14, 2008 at 11:02 AM, Rudolph <[EMAIL PROTECTED]> wrote:
> Ticket 5361 provides a way to accomplish this by writing a custom
> backend:
> http://code.djangoproject.com/ticket/5361
>
> The ticket is on the "maybe" list for 1.0!

I was afraid someone would bring up that ticket on this thread. That
ticket has nothing to do with storing files in a BLOB field, but
instead, its backends allow you to swap out different file systems,
such as MogileFS or even Amazon's S3. A BLOB isn't really a file
system at all, it's just designed to store a single field, so calling
things like blob_backend.save(filename, content) make absolutely no
sense.

That said, I will concede that some of the incidental changes that
#5361 introduces *could* make it a little bit easier to write a BLOB
field. It organizes FileField a bit better, so it might be easier to
subclass it when making the custom field. It would be an interesting
test to see if those changes help in more cases than just those I
expected.

There's still a fair amount of work to be done between now and having
a working BLOB field, and some of the changes in #5361 might make that
slightly easier. The rest of it, including the pluggable backend
support, will just add completely useless overhead and cause more
confusion than it will solve problems.

There's already a ticket[1] for adding a BLOB field to Django, which I
haven't been following. If it gains traction, I'd be willing to invest
some energy in helping it along. For the moment, I'll just settle for
asking people not to put too much hope in #5361 solving this
particular issue.

-Gul

[1] http://code.djangoproject.com/ticket/2417

--~--~-~--~~~---~--~~
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: Images in MySQL

2008-07-14 Thread Oliver Andrich

Hi Luke,

I have tried this in an asset management system I am currently  
implementing for my company, which is ment to store a lots of images  
(round about 300.000+). Generally it is a very bad idea, at least this  
is what I have found. I ignored this article

http://mysqldump.azundris.com/archives/36-Serving-Images-From-A-Database.html

at first, but after some serious testing I have to admit, that  
everything is true what the author says.

So, if you plan to store some images in your database, it might be  
okay, but if you plan to serve a lot of images it is not. You are  
better of with storing images in your filesystem and serving them from  
a seperate http server.

Hopefully, I haven't told you something you already know and have  
already considered.

Best regards,
Oliver

Am 14.07.2008 um 16:41 schrieb lukeqsee:

>
> I know you can store images in a BLOB field in mysql, but is it
> possible with Django models?
>
> Thanks,
> Luke
> >


--~--~-~--~~~---~--~~
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: Images in MySQL

2008-07-14 Thread lukeqsee

Thanks Oliver, hadn't researched that yet I have decided to use
lighttpd to serve up the images now, looks to be much more reliable.

On Jul 14, 11:48 am, Oliver Andrich <[EMAIL PROTECTED]> wrote:
> Hi Luke,
>
> I have tried this in an asset management system I am currently  
> implementing for my company, which is ment to store a lots of images  
> (round about 300.000+). Generally it is a very bad idea, at least this  
> is what I have found. I ignored this article
>
> http://mysqldump.azundris.com/archives/36-Serving-Images-From-A-Datab...
>
> at first, but after some serious testing I have to admit, that  
> everything is true what the author says.
>
> So, if you plan to store some images in your database, it might be  
> okay, but if you plan to serve a lot of images it is not. You are  
> better of with storing images in your filesystem and serving them from  
> a seperate http server.
>
> Hopefully, I haven't told you something you already know and have  
> already considered.
>
> Best regards,
> Oliver
>
> Am 14.07.2008 um 16:41 schrieb lukeqsee:
>
>
>
> > I know you can store images in a BLOB field in mysql, but is it
> > possible with Django models?
>
> > Thanks,
> > Luke
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Change form - populating selected item from a ForeignKey field?

2008-07-14 Thread mbdtsmh

Hi everyone - wondering if someone could point me in the right
direction with this one?

I am trying to populate fields in a form with data from the database
(i.e., a change form rather than an add new form). It works fine for
populating Char/Date Fields but when I do the same for ForeignKey or
m2m fields I loose the information about the items that have been
selected. I.e., for a foreign key I get the dropdown for the foreign
key list but no single item is highlighted as selected.

Below is an example:

models.py:

class SmallDesignSet(models.Model):
title=models.CharField(max_length=100)
priority=models.ForeignKey('Priority')
status=models.ForeignKey(Status, default=2)
concept=models.DateField()

class Priority(models.Model):
priority=models.CharField(max_length=20)
...


forms.py:

class SmallDesignSetSaveForm(forms.Form):
priority = forms.ModelChoiceField(
label='Priority',
queryset=Priority.objects.all()
)
status = forms.ModelChoiceField(
label='Status',
queryset=Status.objects.all()
)
title = forms.CharField(
label='Title',
widget=forms.TextInput(attrs={'size':64})
)
concept = forms.DateField(
label='Concept',
widget=forms.TextInput(attrs={'size':10})
   )


views.py:

def smalldesignset_save_page(request):
 ...
   elif request.GET.has_key('id'):
id = request.GET['id']
designset = SmallDesignSet.objects.get(pk=id)
priority = designset.priority
status = designset.status
title = designset.title
concept = designset.concept
form = SmallDesignSetSaveForm(initial={
'priority': priority,
'status': status,
'title': title,
'concept': concept,
})
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: IOError with files uploads bigger than 2.5 MB

2008-07-14 Thread tom

I am running on this version:
Revision: 7920
Node Kind: directory
Schedule: normal
Last Changed Author: russellm
Last Changed Rev: 7917


On 14 Jul., 16:14, "Ramiro Morales" <[EMAIL PROTECTED]> wrote:
> On Sun, Jul 13, 2008 at 10:48 PM, tom <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I have a problem with file uploads which are bigger than 2.5 MBs. When
> > I use files which are smaller than 2.5 MBs, the files save as
> > expected. As soon as they are bigger than that, I get an IOError (see
> > traceback further down). I have checked that i have write and delete
> > permissions on this directory. When I change the
> > FILE_UPLOAD_MAX_MEMORY_SIZE the uploads are working fine.
>
> What SVN revision of Django are you using?.
>
> --
>  Ramiro Morales
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: IOError with files uploads bigger than 2.5 MB

2008-07-14 Thread Ramiro Morales

On Mon, Jul 14, 2008 at 1:19 PM, tom <[EMAIL PROTECTED]> wrote:
>
> I am running on this version:
> Revision: 7920
> Node Kind: directory
> Schedule: normal
> Last Changed Author: russellm
> Last Changed Rev: 7917
>

Try applying the [1]tempfile3.diff patch attached to ticket [2]7658
but it is a bit unclear because the
reporter has reported  two different issues in teh same ticket. One of
these is the same as yours.

Please report back here your experiences with these tests.

Something a bit strange about the temporary file full path contained
in the traceback
you posted:

Exception Type: IOError at /admin/ads/ad/11/
Exception Value: [Errno 2] No such file or directory:
'/var/folders/g2/g2k+MI0fHlCR7GvjpacMPU+++TI/-Tmp-/tmpR3rxkC.upload'

What's your temporary folder? /var/folders/g2/ ? or
/var/folders/g2/g2k+MI0fHlCR7GvjpacMPU+++TI/ ?

Because  the g2k+MI0fHlCR7GvjpacMPU+++TI/-Tmp-/tmpR3rxkC.upload part
is very long
and contains / characters.

Regards,

-- 
 Ramiro Morales

1.(http://code.djangoproject.com/attachment/ticket/7658/tempfile.3.diff
2. http://code.djangoproject.com/ticket/7658

--~--~-~--~~~---~--~~
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: Accessing Components of a MultipleChoiceField

2008-07-14 Thread Tim

Thanks Malcolm -

I will give this a shot - and if I understand J's self-described hack
this is similar to what he is doing. If I end up successful, I'll post
here.

- Tim

On Jul 11, 10:19 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2008-07-11 at 14:57 -0700, Tim wrote:
> > I would like some finer control over the display of a
> > MultipleChoiceField, but I'm not sure how to get to the individual
> > components (in my case, checkboxes). For example, if I define the
> > field in the form like so:
>
> > tags =
> > forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple,
> > choices=tag_list,)
>
> > then I would like to be able to control the resulting HTML of the
> > individual checkboxes, and not just the checkboxes with label wrappers
> > as a whole (via as_p or as_table or whatever) - I thought it might be
> > possible to access by name or id (since forms has access to this
> > information during rendering), but that doesn't seem to be the case.
>
> A bunch of the output you're wanting to control is generated by the
> widget class. Since all the code is set up in a fairly self-contained
> object-based manner, customising this is mostly a matter of subclassing
> the right widget classes and passing in your custom widget to the form
> field class. Have a look at the existing source in
> django.newforms.widgets and django.newforms.fields to see how it's done.
>
> 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
-~--~~~~--~~--~--~---



URLs question

2008-07-14 Thread Bobby Roberts

greetings.

I'm using the urllib to post data to another site.  In the data, I
have to pass back a url for an "accept" page and url for a "decline"
page.

Now my very limited understanding of https posting is to allow you to
send data to a website and get a response without leaving the url you
are at.

The site i'm hitting supposedly sends returns back as url variables/
values rather than as a https post.

What is the best way to handle this in Django because I sure can't
figure it 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
-~--~~~~--~~--~--~---



Setting the time on a datetimefield

2008-07-14 Thread Tim Sawyer

Hi Folks,

I have an object with a model.DateTimeField on it.  For various reasons, I 
need to set the time portion of this field to 23:59 when I populate it from a 
form.  

datetime = models.DateTimeField()

How can I do this?  I've tried 

self.datetime = pForm.cleaned_data['datetime']
self.datetime.replace(hour=23, minute=59)

but hour isn't accepted as a parameter to replace.

I'm also confused as to how the DateTimeField maps on to a python datetime 
object, can anyone educate me?

Thanks,

Tim.

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



SMS code examples

2008-07-14 Thread John Handelaar

Hola

I'm looking to use an SMS service provider to allow users to 'register'
their cell phones to receive updates.  The registration is necessary in
the same way that email confirmation is necessary.

Available gateways here (UK and Ireland) all seem to have HTTP POST
gateways for this sort of thing.  Is there some decent (documented)
example code somewhere for this sort of thing?  cURL, possibly?

I've seen this: http://code.google.com/p/django-sms/  but it seems to
be a fake project.


jh

--~--~-~--~~~---~--~~
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: modify select widget

2008-07-14 Thread rskm1

On Jul 13, 9:58 am, "Nikolay Panov" <[EMAIL PROTECTED]> wrote:
> You should create your custom widget for this.

Also see the thread from a couple weeks ago titled "choices",
http://groups.google.com/group/django-users/browse_thread/thread/d373794afef19e39/0009b671ebd91ac1

--~--~-~--~~~---~--~~
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: modify select widget

2008-07-14 Thread [EMAIL PROTECTED]

Sounds like you are looking for this: http://code.djangoproject.com/ticket/4412

On Jul 14, 12:18 pm, rskm1 <[EMAIL PROTECTED]> wrote:
> On Jul 13, 9:58 am, "Nikolay Panov" <[EMAIL PROTECTED]> wrote:
>
> > You should create your custom widget for this.
>
> Also see the thread from a couple weeks ago titled 
> "choices",http://groups.google.com/group/django-users/browse_thread/thread/d373...
--~--~-~--~~~---~--~~
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: SMS code examples

2008-07-14 Thread [EMAIL PROTECTED]

Remember, django is just python, so you can use httplib or urllib to
do whatever http work you need to.

On Jul 14, 12:00 pm, "John Handelaar" <[EMAIL PROTECTED]> wrote:
> Hola
>
> I'm looking to use an SMS service provider to allow users to 'register'
> their cell phones to receive updates.  The registration is necessary in
> the same way that email confirmation is necessary.
>
> Available gateways here (UK and Ireland) all seem to have HTTP POST
> gateways for this sort of thing.  Is there some decent (documented)
> example code somewhere for this sort of thing?  cURL, possibly?
>
> I've seen this:http://code.google.com/p/django-sms/ but it seems to
> be a fake project.
>
> jh
--~--~-~--~~~---~--~~
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 more mail for ADMINS

2008-07-14 Thread EAMiller

The first few lines of settings.py:

DEBUG = False
TEMPLATE_DEBUG = DEBUG

ADMINS = (
('E Miller', '[EMAIL PROTECTED]'),
('E Miller', '[EMAIL PROTECTED]')
)

MANAGERS = ADMINS
SEND_BROKEN_LINK_EMAILS = True
SERVER_EMAIL = '[EMAIL PROTECTED]'

Up until a few months ago this was fine - I mostly depended on gmail
to see any 500 or 404 errors. Now no mail seems to get through. I
haven't been messing with postfix settings, so I'm not sure what has
changed.

I added ('E Miller', '[EMAIL PROTECTED]') to admins to see if I could at
least check for mail on the server. Still no mail. I'm sure mail to
localhost works because I can do:

$ mail [EMAIL PROTECTED] -s 'test'
etc...

and I do receive the email. I have checked relevant /var/log files and
I can't seem to diagnose this. Any suggestions?

relevant server info:
ubuntu 7.04
postfix 2.3.8-2
django development version (currently r7922)

--~--~-~--~~~---~--~~
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: URLs question

2008-07-14 Thread Bobby Roberts

ok disregard this post.  I dropped sending the accept/decline urls and
i'm getting a direct post back to my url now.




On Jul 14, 12:52 pm, Bobby Roberts <[EMAIL PROTECTED]> wrote:
> greetings.
>
> I'm using the urllib to post data to another site.  In the data, I
> have to pass back a url for an "accept" page and url for a "decline"
> page.
>
> Now my very limited understanding of https posting is to allow you to
> send data to a website and get a response without leaving the url you
> are at.
>
> The site i'm hitting supposedly sends returns back as url variables/
> values rather than as a https post.
>
> What is the best way to handle this in Django because I sure can't
> figure it 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
-~--~~~~--~~--~--~---



how to parse results from a URL post

2008-07-14 Thread Bobby Roberts

I'm getting a response back from my ongoing saga with https posting:
The response is as follows:

UMversion=2.9&UMstatus=Declined&UMauthCode=&UMrefNum=70994924&UMavsResult=No
%20AVS%20response%20%28Typically%20no%20AVS%20data%20sent%20or%20swiped
%20transaction%29&UMavsResultCode=&UMcvv2Result=No%20CVV2%2FCVC%20data
%20available%20for
%20transaction.&UMcvv2ResultCode=&UMvpasResultCode=&UMresult=D&UMerror=Credit
%20card%20has
%20expired.&UMerrorcode=00017&UMbatch=2080&UMfiller=filled


Can someone point me in the right direction to get useful information
from this... How can i parse out the returns.
--~--~-~--~~~---~--~~
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: URLs question

2008-07-14 Thread EAMiller

Bobby -
I've used urllib in a django view for grabbing a json feed. You'll
have to figure out how to handle the format you get your response in.
I would suggest firing up an interactive prompt and trying it out...
it's as simple as:

>>> import urllib
>>> response = urllib.urlopen('https://etc...')

- Ethan

On Jul 14, 9:52 am, Bobby Roberts <[EMAIL PROTECTED]> wrote:
> greetings.
>
> I'm using the urllib to post data to another site.  In the data, I
> have to pass back a url for an "accept" page and url for a "decline"
> page.
>
> Now my very limited understanding of https posting is to allow you to
> send data to a website and get a response without leaving the url you
> are at.
>
> The site i'm hitting supposedly sends returns back as url variables/
> values rather than as a https post.
>
> What is the best way to handle this in Django because I sure can't
> figure it 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
-~--~~~~--~~--~--~---



Re: how to parse results from a URL post

2008-07-14 Thread Karen Tracey
On Mon, Jul 14, 2008 at 2:05 PM, Bobby Roberts <[EMAIL PROTECTED]> wrote:

>
> I'm getting a response back from my ongoing saga with https posting:
> The response is as follows:
>
>
> UMversion=2.9&UMstatus=Declined&UMauthCode=&UMrefNum=70994924&UMavsResult=No
> %20AVS%20response%20%28Typically%20no%20AVS%20data%20sent%20or%20swiped
> %20transaction%29&UMavsResultCode=&UMcvv2Result=No%20CVV2%2FCVC%20data
> %20available%20for
>
> %20transaction.&UMcvv2ResultCode=&UMvpasResultCode=&UMresult=D&UMerror=Credit
> %20card%20has
> %20expired.&UMerrorcode=00017&UMbatch=2080&UMfiller=filled
>
>
> Can someone point me in the right direction to get useful information
> from this... How can i parse out the returns.
>

Take a look at the cgi parsing functions:

http://docs.python.org/lib/node562.html

cgi.parse_qs, for example, would turn this into a dictionary with keys
UMversion, UMstatus, etc.

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: how to parse results from a URL post

2008-07-14 Thread Rajesh Dhawan

Hi Bobby,

Bobby Roberts wrote:
> I'm getting a response back from my ongoing saga with https posting:
> The response is as follows:
>
> UMversion=2.9&UMstatus=Declined&UMauthCode=&UMrefNum=70994924&UMavsResult=No
> %20AVS%20response%20%28Typically%20no%20AVS%20data%20sent%20or%20swiped
> %20transaction%29&UMavsResultCode=&UMcvv2Result=No%20CVV2%2FCVC%20data
> %20available%20for
> %20transaction.&UMcvv2ResultCode=&UMvpasResultCode=&UMresult=D&UMerror=Credit
> %20card%20has
> %20expired.&UMerrorcode=00017&UMbatch=2080&UMfiller=filled
>
>
> Can someone point me in the right direction to get useful information
> from this... How can i parse out the returns.

Use the cgi built-in module's parse_qs* functions:

http://docs.python.org/lib/node562.html

Or an instance of django.http.QueryDict

-Rajesh D
--~--~-~--~~~---~--~~
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 more mail for ADMINS

2008-07-14 Thread Rajesh Dhawan

Hi,

EAMiller wrote:
> The first few lines of settings.py:
>
> DEBUG = False
> TEMPLATE_DEBUG = DEBUG
>
> ADMINS = (
> ('E Miller', '[EMAIL PROTECTED]'),
> ('E Miller', '[EMAIL PROTECTED]')
> )
>
> MANAGERS = ADMINS
> SEND_BROKEN_LINK_EMAILS = True
> SERVER_EMAIL = '[EMAIL PROTECTED]'
>
> Up until a few months ago this was fine - I mostly depended on gmail
> to see any 500 or 404 errors. Now no mail seems to get through. I
> haven't been messing with postfix settings, so I'm not sure what has
> changed.
>
> I added ('E Miller', '[EMAIL PROTECTED]') to admins to see if I could at
> least check for mail on the server. Still no mail. I'm sure mail to
> localhost works because I can do:
>
> $ mail [EMAIL PROTECTED] -s 'test'
> etc...
>
> and I do receive the email. I have checked relevant /var/log files and
> I can't seem to diagnose this. Any suggestions?

Drop into a shell (python manage.py shell) and send yourself a test
message using:

from django.core.mail import send_mail

send_mail('Subject test', 'Message test', '[EMAIL PROTECTED]',
['your_email_address_here'], fail_silently=False)

With fail_silently=False, you will receive some kind of an error
message if that email send is unsuccessful. Use that to investigate
further.

If the above call doesn't show any errors, check your Postfix logs.

Lastly, although this is probably not related to your problem at the
moment, make sure you have SPF records set for your sending domain
name to allow emails from the server. Without an appropriate SPF
record, Gmail might take these emails to be spam.

http://en.wikipedia.org/wiki/Sender_Policy_Framework

Also, it's a good idea to have a Reverse DNS pointer record for your
server's IP address.
http://en.wikipedia.org/wiki/Anti-spam_techniques_%28e-mail%29#PTR.2FReverse_DNS_checks

-Rajesh D

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



Standalone script + get_absolute_url with urlresolvers

2008-07-14 Thread MikeHowarth

I was wondering whether anyone can help me with a problem I'm having.

I'm running a standalone script outside of the web server to do some
maintainence tasks.

In particular I need to return the absolute url from one of my models,
however when I call the get_absolute_url() method, I'm getting a
ViewDoesNotExist exception raised. A view exists however upon further
investigation I've found that this line of code is causing me some
real problems:

return urlresolvers.reverse('satchmo_product', kwargs={'product_slug':
self.slug})

Basically it appears that Django is concatenating the view path or
similar, so instead of either searching in:
satchmo.shop.views or satchmo.scripts.views

Its actually searching in satcho.shop.views.satchmo.scripts.views

Anyone got any idea how I could overide Django to tell it where to
search for the view or similar?




--~--~-~--~~~---~--~~
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: Setting the time on a datetimefield

2008-07-14 Thread Rajesh Dhawan

Hi Tim,

> I have an object with a model.DateTimeField on it.  For various reasons, I
> need to set the time portion of this field to 23:59 when I populate it from a
> form.
>
> datetime = models.DateTimeField()
>
> How can I do this?  I've tried
>
> self.datetime = pForm.cleaned_data['datetime']
> self.datetime.replace(hour=23, minute=59)

The replace method here returns a new instance of a datetime object --
it's not an in-place replace. This should work:

self.datetime = self.datetime.replace(hour=23, minute=59)

That works both when datetime is a forms.DateTimeField or
models.DateTimeField.

>
> but hour isn't accepted as a parameter to replace.

It is. Are you getting a Python error when you do that?

>
> I'm also confused as to how the DateTimeField maps on to a python datetime
> object, can anyone educate me?

You can directly assign a Python datetime object to a
models.DateTimeField.

-Rajesh D

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



auto_id after validation

2008-07-14 Thread tosh

i'm using newforms admin branch. i have a form and auto_id="%s".
everything works fine on the initial load. However, If there is a
validation error when the form is redisplayed i get id_ prepended to
my form ids. is there some way to control this or am i missing
something? 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: Standalone script + get_absolute_url with urlresolvers

2008-07-14 Thread Rajesh Dhawan

Hi Mike,

>
> I'm running a standalone script outside of the web server to do some
> maintainence tasks.
>
> In particular I need to return the absolute url from one of my models,
> however when I call the get_absolute_url() method, I'm getting a
> ViewDoesNotExist exception raised. A view exists however upon further
> investigation I've found that this line of code is causing me some
> real problems:
>
> return urlresolvers.reverse('satchmo_product', kwargs={'product_slug':
> self.slug})
>
> Basically it appears that Django is concatenating the view path or
> similar, so instead of either searching in:
> satchmo.shop.views or satchmo.scripts.views
>
> Its actually searching in satcho.shop.views.satchmo.scripts.views
>
> Anyone got any idea how I could overide Django to tell it where to
> search for the view or similar?

Do you have a stack trace you can DPaste?

The urlresolvers.reverse function throws an exception if *any* of your
URLs anywhere in the project have a bad view and not necessarily the
one you are trying to reverse map. So, check that you don't have any
URL mappings with undefined view functions (or views with syntax
errors).

Since 'satchmo_product' is a named URL mapping, Django should resolve
that to the right Satchmo view directly without going through any
searches.

-Rajesh D

--~--~-~--~~~---~--~~
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: auto_id after validation

2008-07-14 Thread Rajesh Dhawan

Hi,

On Jul 14, 3:32 pm, tosh <[EMAIL PROTECTED]> wrote:
> i'm using newforms admin branch. i have a form and auto_id="%s".
> everything works fine on the initial load. However, If there is a
> validation error when the form is redisplayed i get id_ prepended to
> my form ids. is there some way to control this or am i missing
> something? thanks

In your view, you are typically instantiating your form class twice:

Once, when the form is first displayed (request method is GET), and a
second time, when the form is posted (request method is POST). Based
on your above description, it seems that you are setting the auto_id
parameter only during the GET call and not during the POST call.

-Rajesh D
--~--~-~--~~~---~--~~
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: Change form - populating selected item from a ForeignKey field?

2008-07-14 Thread Rajesh Dhawan

Hi Martin,

On Jul 14, 12:14 pm, mbdtsmh <[EMAIL PROTECTED]> wrote:
> Hi everyone - wondering if someone could point me in the right
> direction with this one?
>
> I am trying to populate fields in a form with data from the database
> (i.e., a change form rather than an add new form). It works fine for
> populating Char/Date Fields but when I do the same for ForeignKey or
> m2m fields I loose the information about the items that have been
> selected. I.e., for a foreign key I get the dropdown for the foreign
> key list but no single item is highlighted as selected.
>
> Below is an example:
>
> models.py:
>
> class SmallDesignSet(models.Model):
> title=models.CharField(max_length=100)
> priority=models.ForeignKey('Priority')
> status=models.ForeignKey(Status, default=2)
> concept=models.DateField()
>
> class Priority(models.Model):
> priority=models.CharField(max_length=20)
> ...
>
> forms.py:
>
> class SmallDesignSetSaveForm(forms.Form):
> priority = forms.ModelChoiceField(
> label='Priority',
> queryset=Priority.objects.all()
> )
> status = forms.ModelChoiceField(
> label='Status',
> queryset=Status.objects.all()
> )
> title = forms.CharField(
> label='Title',
> widget=forms.TextInput(attrs={'size':64})
> )
> concept = forms.DateField(
> label='Concept',
> widget=forms.TextInput(attrs={'size':10})
>)
>
> views.py:
>
> def smalldesignset_save_page(request):
>  ...
>elif request.GET.has_key('id'):
> id = request.GET['id']
> designset = SmallDesignSet.objects.get(pk=id)
> priority = designset.priority
> status = designset.status
> title = designset.title
> concept = designset.concept
> form = SmallDesignSetSaveForm(initial={
> 'priority': priority,
> 'status': status,
> 'title': title,
> 'concept': concept,
> })

Try:

form = SmallDesignSetSaveForm(initial={
'priority': priority.pk,
'status': status.pk,
'title': title,
'concept': concept,
 })

-Rajesh D
--~--~-~--~~~---~--~~
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: auto_id after validation

2008-07-14 Thread tosh

On Jul 14, 2:40 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi,
>
> On Jul 14, 3:32 pm, tosh <[EMAIL PROTECTED]> wrote:
>
> > i'm using newforms admin branch. i have a form and auto_id="%s".
> > everything works fine on the initial load. However, If there is a
> > validation error when the form is redisplayed i get id_ prepended to
> > my form ids. is there some way to control this or am i missing
> > something? thanks
>
> In your view, you are typically instantiating your form class twice:
>
> Once, when the form is first displayed (request method is GET), and a
> second time, when the form is posted (request method is POST). Based
> on your above description, it seems that you are setting the auto_id
> parameter only during the GET call and not during the POST call.
>
> -Rajesh D


well that's a little embarrassing but exactly right. 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: Root Access

2008-07-14 Thread Jeff Gentry

> I don't think that is true, the only time I needed root was when I was
> symlinking django into /usr/lib/python2.5/site-packages/ but since you

I've run Django on machines w/ no root access and nothing special
installed for me.  Granted I've been running off of non-standard ports,
but ...


--~--~-~--~~~---~--~~
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: Standalone script + get_absolute_url with urlresolvers

2008-07-14 Thread MikeHowarth

Yeah. I did think that.

As far as I'm aware there aren't any errors in any of the views,
however the views.py file for scripts it is an empty file. I'm
guessing this is the problem in itself.

Is it syntactically correct to have a views.py which is empty but
exists? I'm not really sure of the process Django will use to validate
the view.

I've also pasted the stack trace to Dpaste: http://dpaste.com/64942/

On Jul 14, 8:35 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi Mike,
>
>
>
>
>
> > I'm running a standalone script outside of the web server to do some
> > maintainence tasks.
>
> > In particular I need to return the absolute url from one of my models,
> > however when I call the get_absolute_url() method, I'm getting a
> > ViewDoesNotExist exception raised. A view exists however upon further
> > investigation I've found that this line of code is causing me some
> > real problems:
>
> > return urlresolvers.reverse('satchmo_product', kwargs={'product_slug':
> > self.slug})
>
> > Basically it appears that Django is concatenating the view path or
> > similar, so instead of either searching in:
> > satchmo.shop.views or satchmo.scripts.views
>
> > Its actually searching in satcho.shop.views.satchmo.scripts.views
>
> > Anyone got any idea how I could overide Django to tell it where to
> > search for the view or similar?
>
> Do you have a stack trace you can DPaste?
>
> The urlresolvers.reverse function throws an exception if *any* of your
> URLs anywhere in the project have a bad view and not necessarily the
> one you are trying to reverse map. So, check that you don't have any
> URL mappings with undefined view functions (or views with syntax
> errors).
>
> Since 'satchmo_product' is a named URL mapping, Django should resolve
> that to the right Satchmo view directly without going through any
> searches.
>
> -Rajesh D
--~--~-~--~~~---~--~~
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: Setting the time on a datetimefield

2008-07-14 Thread Tim Sawyer

On Monday 14 Jul 2008, Rajesh Dhawan wrote:
> The replace method here returns a new instance of a datetime object --
> it's not an in-place replace. This should work:
>
> self.datetime = self.datetime.replace(hour=23, minute=59)

Hmm, that seemed to make sense to me too, though with my Java background I 
wasn't sure.  I get:

Exception Value:'hour' is an invalid keyword argument for this function

on

self.datetime = self.datetime.replace(hour=23, minute=59) 

self.datetime is defined as:

datetime = models.DateTimeField()

Cheers,

Tim.

--~--~-~--~~~---~--~~
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 inheritance problem in admin

2008-07-14 Thread David

When I save objects from the admin pages, I get COPIES of what I'm
saving. When I save them through the API, I don't get the duplicates.
I'd like to know if I'm doing something wrong or misunderstanding
something.

Model:

from django.db import models

class Process(models.Model):
process_name = models.CharField(max_length=100)
def __str__(self): return self.process_name
class Admin:
pass

class subProcess(Process):
myname = models.CharField(max_length=20)
def __str__(self): return self.myname
class Admin:
pass

Given this model (and using the built-in admin) if I create a
subProcess, the Process gets created properly. If I subsequently load
that process and save it, even without changing anything, I end up
with a second copy of that subProcess.

If I do this from the API, the second and subsequent saves do NOT
create a duplicate copy:

In [3]: from procs.models import *
In [7]: sp = subProcess(myname='hello world', process_name='command
line')
In [8]: sp.save() # one object
In [9]: sp.myname="good bye
world"
In [10]: sp.save() # still just one object

Thanks for any ideas you can
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
-~--~~~~--~~--~--~---



Seperate project in a subdirectory (Apache 2.2 & mod_python)

2008-07-14 Thread Chris H.

Trying to run a separate Django project in a sub-directory while the
main project runs in the root.  I'm using Apache 2.2 and mod_python on
Windows.

If my apache httpd.conf includes just the subdirectory I get things
working correctly:


SetHandler python-program
PythonPath "['C:/django-projects'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE testproject.settings
PythonDebug On
PythonInterpreter testproject


If I include the domain root, it will no longer hit the subdirectory:


SetHandler python-program
PythonPath "['C:/django-projects'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mainproject.settings
PythonInterpreter mainproject
PythonDebug Off


Basically, I need to make the second Location directive include
everything except /testproject/ and that needs to hit the first
directive.  The reason for this is testproject is running against
django 0.96 while the main project is running against trunk.  Any
thought on how to handle this?
--~--~-~--~~~---~--~~
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: Model inheritance problem in admin

2008-07-14 Thread Malcolm Tredinnick


On Mon, 2008-07-14 at 14:46 -0700, David wrote:
> When I save objects from the admin pages, I get COPIES of what I'm
> saving. When I save them through the API, I don't get the duplicates.
> I'd like to know if I'm doing something wrong or misunderstanding
> something.

You're assuming that model inheritance is supported in the admin
interface. It isn't. That would be the main problem here.

It's just not worth doing all the work required to change existing admin
when newforms-admin is arriving so soon. So you'll just have to wait a
bit (or not use the admin for inherited models).

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



newforms-admin: Interaction between pre_save signals and form validation

2008-07-14 Thread Martin Diers

I am currently trying to use django-mptt in a CMS project. (More about  
django-mptt here: http://code.google.com/p/django-mptt/)

django-mptt manages the implementation of an MPTT tree in a nearly  
transparent way. You register your model with the django-mptt  
application, and it will automatically add attributes and (if  
necessary) fields to your model to manage tree traversal, node  
creation and moving, etc.

The tricky parts are implemented via the dispatch.pre_save() and  
dispatch.pre_delete() signals. Essentially, these signal handles  
update the MPTT specific fields in your model before creating or  
changing a node, or deleting it.

This all works fine when I create and save model instances from code.  
It fails miserably once I try to create page instances via newforms- 
admin.

Here is what I am pretty sure is happening:
When one attempts to save a new record, the MPTT fields are blank. the  
pre_save() signal handler that django-mptt registered will populate  
them. However, since the fields are Null=False, form validation fails.

Form validation does not attempt to call the save method on the model  
which would populate those fields, because the fields are empty and it  
knows they should not be empty. Catch-22.

I am trying to find a way to force newforms-admin to skip the  
validation of the four fields in question, since essentially django- 
mptt has taken over management of those fields completely. Hiding  
them, as demonstrated in NewformsadminHOWTO, does not work. The  
validation still fails, only now you can't even see the fields which  
are causing the problem.

I further attempted to hide the fields from the ModelForm entirely, by  
subclassing ModelForm like this:

class PageOptionsForm(forms.ModelForm):
 model=Page
 exclude=('lft', 'rght', 'tree_id', 'level')

class PageOptions(ModelAdmin):
 form=PageOptionsForm


This did nothing. It didn't even hide the fields, so I would presume  
that newforms-admin must override the exclude options.

So, I'm not sure where to go next. My next thought is maybe there is  
some way to call the MPTT signal handling code before validation  
occurs, so that those fields get populated. Haven't quite figured how  
to do that yet.

--~--~-~--~~~---~--~~
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: Standalone script + get_absolute_url with urlresolvers

2008-07-14 Thread MikeHowarth

Think I may have found the issue.

My .pth file was pointing to an old directory which didn't have the
relevant module.

For anyone wondering, its permissable not to have a views.py providing
you have the __init__.py and models.py

On Jul 14, 10:28 pm, MikeHowarth <[EMAIL PROTECTED]> wrote:
> Yeah. I did think that.
>
> As far as I'm aware there aren't any errors in any of the views,
> however the views.py file for scripts it is an empty file. I'm
> guessing this is the problem in itself.
>
> Is it syntactically correct to have a views.py which is empty but
> exists? I'm not really sure of the process Django will use to validate
> the view.
>
> I've also pasted the stack trace to Dpaste:http://dpaste.com/64942/
>
> On Jul 14, 8:35 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
>
> > Hi Mike,
>
> > > I'm running a standalone script outside of the web server to do some
> > > maintainence tasks.
>
> > > In particular I need to return the absolute url from one of my models,
> > > however when I call the get_absolute_url() method, I'm getting a
> > > ViewDoesNotExist exception raised. A view exists however upon further
> > > investigation I've found that this line of code is causing me some
> > > real problems:
>
> > > return urlresolvers.reverse('satchmo_product', kwargs={'product_slug':
> > > self.slug})
>
> > > Basically it appears that Django is concatenating the view path or
> > > similar, so instead of either searching in:
> > > satchmo.shop.views or satchmo.scripts.views
>
> > > Its actually searching in satcho.shop.views.satchmo.scripts.views
>
> > > Anyone got any idea how I could overide Django to tell it where to
> > > search for the view or similar?
>
> > Do you have a stack trace you can DPaste?
>
> > The urlresolvers.reverse function throws an exception if *any* of your
> > URLs anywhere in the project have a bad view and not necessarily the
> > one you are trying to reverse map. So, check that you don't have any
> > URL mappings with undefined view functions (or views with syntax
> > errors).
>
> > Since 'satchmo_product' is a named URL mapping, Django should resolve
> > that to the right Satchmo view directly without going through any
> > searches.
>
> > -Rajesh D
--~--~-~--~~~---~--~~
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: Standalone script + get_absolute_url with urlresolvers

2008-07-14 Thread Rajesh Dhawan


>
> Is it syntactically correct to have a views.py which is empty but
> exists? I'm not really sure of the process Django will use to validate
> the view.

Django will look for all view functions that your project's various
urls point to. So those functions need to exist. From that point of
view, an empty views.py doesn't really help.

>
> I've also pasted the stack trace to Dpaste:http://dpaste.com/64942/

At the end of that trace, I see:
Error was: No module named satchmo.feeds.views

Perhaps you will want to make sure that there's a valid module like
that in your PYTHONPATH when you execute the script.

--~--~-~--~~~---~--~~
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: Left Outer Join

2008-07-14 Thread Malcolm Tredinnick


On Sun, 2008-07-13 at 20:38 +0800, Russell Keith-Magee wrote:
> On Sun, Jul 13, 2008 at 1:37 PM, Chris <[EMAIL PROTECTED]> wrote:
> >
> > I'm reasonably fluent in SQL, and while I've found Django's ORM is
> > great for basic CRUD operations, I'm having trouble creating joins.
> >
> > For example, I have a three tables, Article, Rating, and User. Rating
> > stores a user's rating of a particular article. I'm trying to create a
> > view that lists articles, and optionally shows the current user's
> > rating of each article, if they've made one. To query the rating
> > record along with the article in SQL, this would just be a simple left
> > outer join. How would this be done with Django's ORM? I've reviewed
> > http://www.djangoproject.com/documentation/model-api/#relationships
> > but I don't think it covers this case.
> 
> Option 1 - use raw SQL. This is always an option - Django provides a
> nice ORM on top of basic SQL, but there are some queries that are
> easier to express in raw SQL than it is to mangle into the ORM.
> 
> Option 2 - The Django ORM automatically creates joins as they are
> required by the query that is posed. For the most part, this means
> inner joins, but the trunk version of Django does provide some ability
> to customize the type of join that is used. However, this isn't
> currently documented; it would mean a bit of digging into the
> internals.

To extend what Russell's saying a little: by and large, you don't need
to specify the type of join. If  the relation is non-nullable, an inner
join is used. If null results (or non-existent) results are possible in
the join (mostly because it's a nullable relation and you're checking
for a null value or something like that), a left outer join is used. So
Django picks the more-or-less appropriate join type for the relation.

The only case where this isn't perfect is where you somehow have
external knowledge that the result set won't contain non-existent rows
in the join but the relation description is nullable. Django cannot
prove (to itself) that no null rows will be generated, so it has to use
a left-outer join to avoid missing results. If you were writing the
query by hand, you might be able to use an inner join there, but only
because of knowledge you have that the database server and Django don't.
If you're in that sort of situation and using Django and it's going to
make a real difference, that's when you would  write custom SQL. Mostly,
though, this won't be required (such situations are pretty rare). So
don't overthink (or prematurely optimise this). Write the natural
queryset filters and you'll find the appropriate join type is used
automatically.

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



.pyc files not being created

2008-07-14 Thread blis102

Hey all,

On my Ubuntu server with Apache2 + mod_python, I cant seem to get
the .py files to compile like they should (I see no .pyc files in my
"src" folder like I do locally). I believe I have proper permissions
set (775), but am by no means an expert in this matter. What would
cause .pyc files to not compile other than the file permissions. Also
what is the recommended permissions settings for source folders/files,
and media folders/files?

Thanks a bunch
--~--~-~--~~~---~--~~
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: Setting the time on a datetimefield

2008-07-14 Thread Rajesh Dhawan



On Jul 14, 5:40 pm, Tim Sawyer <[EMAIL PROTECTED]> wrote:
> On Monday 14 Jul 2008, Rajesh Dhawan wrote:
>
> > The replace method here returns a new instance of a datetime object --
> > it's not an in-place replace. This should work:
>
> > self.datetime = self.datetime.replace(hour=23, minute=59)
>
> Hmm, that seemed to make sense to me too, though with my Java background I
> wasn't sure.  I get:
>
> Exception Value:        'hour' is an invalid keyword argument for this 
> function
>
> on
>
> self.datetime = self.datetime.replace(hour=23, minute=59)
>
> self.datetime is defined as:
>
> datetime = models.DateTimeField()

Strange...I just ran a few tests on a model field like that and it all
worked perfectly.

Can you dpaste your relevant code?

Also, if you print type(self.datetime), do you get the type as
datetime.datetime or something else?
--~--~-~--~~~---~--~~
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: Model inheritance problem in admin

2008-07-14 Thread David

Thanks, Malcolm. It was great to see inheritance in the first place,
and we'll just wait for newforms-admin to use an admin interface to
it.

On Jul 14, 5:51 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Mon, 2008-07-14 at 14:46 -0700, David wrote:
> > When I save objects from the admin pages, I get COPIES of what I'm
> > saving. When I save them through the API, I don't get the duplicates.
> > I'd like to know if I'm doing something wrong or misunderstanding
> > something.
>
> You're assuming that model inheritance is supported in the admin
> interface. It isn't. That would be the main problem here.
>
> It's just not worth doing all the work required to change existing admin
> when newforms-admin is arriving so soon. So you'll just have to wait a
> bit (or not use the admin for inherited models).
>
> 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: no more mail for ADMINS

2008-07-14 Thread EAMiller


On Jul 14, 11:57 am, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Drop into a shell (python manage.py shell) and send yourself a test
> message using:
>
> from django.core.mail import send_mail
>
> send_mail('Subject test', 'Message test', '[EMAIL PROTECTED]',
>     ['your_email_address_here'], fail_silently=False)
>
> With fail_silently=False, you will receive some kind of an error
> message if that email send is unsuccessful. Use that to investigate
> further.

Thanks Rajesh, good suggestion.

Now I (sortof) know my problem...

File "smtplib.py", line 296, in connect
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
gaierror: (-2, 'Name or service not known')

Not sure what this really means. Doesn't the fact that I can use
'mail' to send mail from the CLI mean my postfix setup is basically
OK? I will keep working on it.

Thanks again for the tip
--~--~-~--~~~---~--~~
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: .pyc files not being created

2008-07-14 Thread EAMiller

Hello...
What error message are you seeing? Or, what is failing as a result of
this problem? Also, you've set all files to 775? Or specific ones?

On Jul 14, 3:29 pm, blis102 <[EMAIL PROTECTED]> wrote:
> Hey all,
>
> On my Ubuntu server with Apache2 + mod_python, I cant seem to get
> the .py files to compile like they should (I see no .pyc files in my
> "src" folder like I do locally). I believe I have proper permissions
> set (775), but am by no means an expert in this matter. What would
> cause .pyc files to not compile other than the file permissions. Also
> what is the recommended permissions settings for source folders/files,
> and media folders/files?
>
> Thanks a bunch
--~--~-~--~~~---~--~~
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: .pyc files not being created

2008-07-14 Thread Dana

Hi EAMiller,

Im not seeing errors, Its just not compiling the python files (which
it should be).

I tried a few combinations, but I believe all I need to do is set the
chmod to 775 for the source folder (in this case "src")?

Thanks,
Dana

On Jul 14, 4:07 pm, EAMiller <[EMAIL PROTECTED]> wrote:
> Hello...
> What error message are you seeing? Or, what is failing as a result of
> this problem? Also, you've set all files to 775? Or specific ones?
>
> On Jul 14, 3:29 pm, blis102 <[EMAIL PROTECTED]> wrote:
>
> > Hey all,
>
> > On my Ubuntu server with Apache2 + mod_python, I cant seem to get
> > the .py files to compile like they should (I see no .pyc files in my
> > "src" folder like I do locally). I believe I have proper permissions
> > set (775), but am by no means an expert in this matter. What would
> > cause .pyc files to not compile other than the file permissions. Also
> > what is the recommended permissions settings for source folders/files,
> > and media folders/files?
>
> > Thanks a bunch
--~--~-~--~~~---~--~~
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 more mail for ADMINS

2008-07-14 Thread Malcolm Tredinnick


On Mon, 2008-07-14 at 16:02 -0700, EAMiller wrote:
[...]
> Not sure what this really means. Doesn't the fact that I can use
> 'mail' to send mail from the CLI mean my postfix setup is basically
> OK? I will keep working on it.

There are two ways that mail can be delivered to an MTA (sendmail,
postfix, ...) on a system: by connecting to a listening port (the
network-based method) and by starting a new process designed to accept a
single transaction / piece of email. When you use "mail" to send mail
from the command-line, it uses the second approach. When Django sends
mail it has to use the network-based approach, since the mail server
could be anywhere.

So if 'netstat -tl' doesn't show the mail server listening on a port,
you've found the problem.

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: .pyc files not being created

2008-07-14 Thread Malcolm Tredinnick


On Mon, 2008-07-14 at 16:09 -0700, Dana wrote:
> Hi EAMiller,
> 
> Im not seeing errors, Its just not compiling the python files (which
> it should be).
> 
> I tried a few combinations, but I believe all I need to do is set the
> chmod to 775 for the source folder (in this case "src")?

Permissions like "775" mean nothing on their own. Permissions are
relative to the user and group involved. When you're running things from
mod_python, the important question would be whether the webserver has
write permission to those directories in order to write the .pyc files.

However, that's only "important" in the sense that it's not really a
good idea to allow. Letting your web server only *read* from executable
file directories is really important for security reasons. For this
reason, Python ships with the 'compileall' module (which can also be
executed as a script from the command line). You run "compileall.py ..."
as somebody who does have permission to write the directory that holds
the executable files and compile them to .pyc files. Then your webserver
sees the benefit without opening up unneeded permissions. Read the
docstring at the top of the "compileall.py" file for instructions on how
to use it.

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: no more mail for ADMINS

2008-07-14 Thread Rajesh Dhawan



On Jul 14, 7:02 pm, EAMiller <[EMAIL PROTECTED]> wrote:
> On Jul 14, 11:57 am, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
>
> > Drop into a shell (python manage.py shell) and send yourself a test
> > message using:
>
> > from django.core.mail import send_mail
>
> > send_mail('Subject test', 'Message test', '[EMAIL PROTECTED]',
> >     ['your_email_address_here'], fail_silently=False)
>
> > With fail_silently=False, you will receive some kind of an error
> > message if that email send is unsuccessful. Use that to investigate
> > further.
>
> Thanks Rajesh, good suggestion.
>
> Now I (sortof) know my problem...
>
> File "smtplib.py", line 296, in connect
>     for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
> gaierror: (-2, 'Name or service not known')

This looks like some kind of a name server lookup failure.

>
> Not sure what this really means. Doesn't the fact that I can use
> 'mail' to send mail from the CLI mean my postfix setup is basically
> OK? I will keep working on it.

Yes, that would mean that your Postfix setup is OK. Try setting
EMAIL_HOST to '127.0.0.1' to see if that helps.

Otherwise, try this in a Python shell:

import socket
host = socket.gethostname()
print host
ip = socket.gethostbyname(host)
print ip

If that ip= line fails, it means your server's hostname doesn't
resolve to an IP address. Just add a 127.0.0.1 entry for it in your /
etc/hosts and that should take care of it.


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



Re: .pyc files not being created

2008-07-14 Thread Dana

Hi Malcom,

Thanks a lot for the detailed response.

Sorry if these are basic questions but, what user would my web server
be run under (Apache2)? Would it be my username, root, or something
else like "apache"?

Would I have to run compileall.py every time I change a source file
(it seems like I would have to)?

I couldn't get compileall.py to work on the command line... Tried
'compileall.py' and 'compileall'. What am I doing wrong?

Thanks a ton,
Dana


On Jul 14, 4:12 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Mon, 2008-07-14 at 16:09 -0700, Dana wrote:
> > Hi EAMiller,
>
> > Im not seeing errors, Its just not compiling the python files (which
> > it should be).
>
> > I tried a few combinations, but I believe all I need to do is set the
> > chmod to 775 for the source folder (in this case "src")?
>
> Permissions like "775" mean nothing on their own. Permissions are
> relative to the user and group involved. When you're running things from
> mod_python, the important question would be whether the webserver has
> write permission to those directories in order to write the .pyc files.
>
> However, that's only "important" in the sense that it's not really a
> good idea to allow. Letting your web server only *read* from executable
> file directories is really important for security reasons. For this
> reason, Python ships with the 'compileall' module (which can also be
> executed as a script from the command line). You run "compileall.py ..."
> as somebody who does have permission to write the directory that holds
> the executable files and compile them to .pyc files. Then your webserver
> sees the benefit without opening up unneeded permissions. Read the
> docstring at the top of the "compileall.py" file for instructions on how
> to use it.
>
> 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: Inquiry

2008-07-14 Thread Kadusale, Myles



I don't want to use cookies because they can be disabled by the user.



-Original Message-
From: django-users@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Jeff Anderson
Sent: Monday, July 14, 2008 11:10 PM
To: django-users@googlegroups.com
Subject: Re: Inquiry

Kadusale, Myles wrote:
> Good Day to All!
>
> I am new to Django and I was wondering if there is a sample
application
> that deals with sessions that is not using cookies.
>   
Django's session framework uses cookies. I don't know why you wouldn't 
want to do sessions without cookies, and I don't know of any projects 
that aim to do that. It wouldn't be difficult, however, to implement 
your own sessions that don't use cookies.
> Also is there a directory structure in an web app when using Django?
> Like in J2EE??
>   
If you are referring to Java namespaces, then yes: Python has them.
If you are asking about urls in Django, I suggest you read through the 
tutorial in the official Django documentation.

Good luck!


Jeff Anderson

PS - instead of replying to an existing thread and changing the subject,

it is better to start your own thread. Your message is in the middle of 
another thread. 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: Seperate project in a subdirectory (Apache 2.2 & mod_python)

2008-07-14 Thread Graham Dumpleton

What order are you including them in the Apache configuration?

Have you tried switching the order?

Graham

On Jul 15, 7:50 am, "Chris H." <[EMAIL PROTECTED]> wrote:
> Trying to run a separate Django project in a sub-directory while the
> main project runs in the root.  I'm using Apache 2.2 andmod_pythonon
> Windows.
>
> If my apache httpd.conf includes just the subdirectory I get things
> working correctly:
>
> 
>     SetHandler python-program
>     PythonPath "['C:/django-projects'] + sys.path"
>     PythonHandler django.core.handlers.modpython
>     SetEnv DJANGO_SETTINGS_MODULE testproject.settings
>     PythonDebug On
>     PythonInterpreter testproject
> 
>
> If I include the domain root, it will no longer hit the subdirectory:
>
> 
>     SetHandler python-program
>     PythonPath "['C:/django-projects'] + sys.path"
>     PythonHandler django.core.handlers.modpython
>     SetEnv DJANGO_SETTINGS_MODULE mainproject.settings
>     PythonInterpreter mainproject
>     PythonDebug Off
> 
>
> Basically, I need to make the second Location directive include
> everything except /testproject/ and that needs to hit the first
> directive.  The reason for this is testproject is running against
> django 0.96 while the main project is running against trunk.  Any
> thought on how to handle this?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Very high com_admin_commands with django/mysql

2008-07-14 Thread fordprefect

We have been optimizing our server (db and caching) since our recent
launch and one thing we've been looking at is our server status:

Total queries: 4,307,827
Com_admin_commands: 3,754,356
Com_insert: 37,790
Com_select: 1,354,134
Com_set_option: 172,319
Com_update: 52,759
Com_commit: 88,107

(this is approx over 10 hours uptime, 10K visitors/day).

Running Django trunk, mysql Ver 14.12 Distrib 5.0.32, python 2.5,
Debian.

The com_admin_commands seems extremely high. I have tested on another
machine with similar setup and can confirm that almost every SELECT
run through the Django ORM (and possibly INSERT/UPDATE/DELETE) is
running a com_admin_command. Running queries separately on MySQL or
through connection.cursor() do not cause this.

For example:
from django.contrib.auth.models import User
u = User.objects.get(pk=1)

will cause an increase in com_admin_commands but not

from django.db import connection
c=connection.cursor()
c.execute("select * from auth_user")

I have 3 questions:
1) Have other django/mysql developers encountered this?
2) Have they encountered perfomance issues as a result ?
3) Which command (if any) is being fired to cause an increase in
com_admin_commands ?



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



newbie help

2008-07-14 Thread Mario Zorz
Hello all,

I'm following the Django tutorial [1] I'm using windows xp, python 2.5 and 
SQLite. For some reason I found these 2 things not being appropiate as followed 
in the tutorial:

1) When tried "python manage.py sql polls" I got this 
TypeError: __init__() got an unexpected keyword argument 'max_length'. 

I could only run it successfully by changing the linea
question = models.CharField(max_length=200)
to
question = models.CharField(maxlength=200)
(stripped off the undrescore in "max_length")

2) Continuing down to the "Playing with the API" section, and once I saved some 
poll objects to the DB, etc I executed the following command as specified in 
the tutorial:

Poll.objects.all()

For some reason, the result I get from the shell is
>>> Poll.objects.all()
[]


Even when I inserted the __unicode__() method in models.py as follows:
class Poll(models.Model):
question = models.CharField(maxlength=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question

Anything I'm doing wrong?
Thanks a lot
regards
Mario

[1] http://www.djangoproject.com/documentation/tutorial01/



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



writing unit tests for views?

2008-07-14 Thread bshaurette

Writing tests for models has been a snap, but I'm having a lot harder
time with the views.

I'm trying to use the test client, something like this:


from django.test import Client, TestCase

class ViewTest(TestCase):
def setUp(self):
self.client = Client()

def test_view_profile(self):
response = self.client.get('/accounts/profile/', {'username':
'newuser1'})

# Check some response details
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'Profile View')


But I'm getting errors related to the project settings, most
specifically this one:

  File "/Users/bshaurette/Code/django_trunk/django/core/handlers/
base.py", line 126, in get_response
subject = 'Error (%s IP): %s' % ((request.META.get('REMOTE_ADDR')
in settings.INTERNAL_IPS and 'internal' or 'EXTERNAL'), request.path)
TypeError: 'in ' requires string as left operand

I tried setting an INTERNAL_IPS value to get around that, but there
are other settings errors that pop up.  Ultimately, it looks like the
test is having trouble reconciling paths between the project urls.py
and the app urls.py ... ?


DoesNotExist: Site matching query does not exist.


I'm not new to writing tests, just to unit testing in Django/Python -
what would *really* help is if I could see some other examples of view
testing.  I feel like I've been banging my head against a wall for a
few days now.  Has anyone got any recommendations?

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



Missing Records in Admin Interface [SOLVED]

2008-07-14 Thread Jashugan

I had an interesting problem today.

I had some records that were missing in the auto-admin list of one of
my models. The count was correct, but the records were simply not
displayed. When I did a select query from the command line they all
showed up just fine; some of them were simply missing from the auto-
admin list.

I finally isolated the problem to a missing record a couple of foreign
key hops away. For example...

Project1 <-- Product1 <-- Model1 (visible)
Project2 (not created) <-- Product2 <-- Model2 (missing)

So Model2 wasn't being displayed because Project2 didn't exist. I
think this had something to do with my unicode method on the Product
because I referenced the Project in it. It was probably throwing an
error, but for some reason Django was just ignoring it.

In any case, I hope this helps someone.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Cookie content string error

2008-07-14 Thread timjdavey

We've just switched production servers and broke them up into an app
server, db etc...

On the staging and my local, db sets the sessions fine, i.e.

Name: sessionid
Content: ded23886ca9fab500b0234a2671bd3ef
Host: .domain.com
Path: /
Expires: Tue, 29-Jul-2008 00:52:14 GMT

But on the new server it gives,

Name: sessionid
Content: "Set-Cookie: sessionid=ded23886ca9fab500b0234a2671bd3ef;
Domain=.domain.com; expires=Tue, 29-Jul-2008 00:52:14 GMT; Max-
Age=1209600; Path=/"
Host: domain.com
Expires: at end of session

So clearly the string isn't being evaluated somehow, but I don't have
a clue how / why. The django settings file is the same on both staging
and production servers.

Any ideas?

Thanks so much in advance,

- Tim
--~--~-~--~~~---~--~~
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: writing unit tests for views?

2008-07-14 Thread Russell Keith-Magee

On Tue, Jul 15, 2008 at 8:28 AM, bshaurette <[EMAIL PROTECTED]> wrote:
>
> Writing tests for models has been a snap, but I'm having a lot harder
> time with the views.
...
> I'm not new to writing tests, just to unit testing in Django/Python -
> what would *really* help is if I could see some other examples of view
> testing.  I feel like I've been banging my head against a wall for a
> few days now.  Has anyone got any recommendations?

The Django system tests contain a lot of examples of Django view
tests. In particular, modeltests/test_client and
regressiontests/test_client_regress show how to exercise most of the
features of the Django test system.

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: newbie help

2008-07-14 Thread Matt McClanahan

On Jul 14, 3:46 pm, Mario Zorz <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I'm following the Django tutorial [1] I'm using windows xp, python 2.5 and 
> SQLite. For some reason I found these 2 things not being appropiate as 
> followed in the tutorial:
>
> 1) When tried "python manage.py sql polls" I got this
> TypeError: __init__() got an unexpected keyword argument 'max_length'.

> 2) Continuing down to the "Playing with the API" section, and once I saved 
> some poll objects to the DB, etc I executed the following command as 
> specified in the tutorial:

You are attempting to use the tutorial that targets current
development code with one of the Django releases (0.95, 0.96..).  As
the tutorial notes in several places, there are differences between
the releases and current development.  In fact, both of the problems
you've encountered are specifically addressed in the document you
linked to.

You should either fetch the development version of Django, or use the
tutorial targeted for your Django version, which are linked at the top
of each documentation page.

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



Re: newbie help

2008-07-14 Thread Joshua Jonah
maxlength was changed in the trunk to max_length. You are probably using 
an older version of Django, the tutorial you were following refers to 
the latest version:
http://code.djangoproject.com/ticket/6457

As for the returning the text thing, same deal. If you go to this page: 
http://www.djangoproject.com/documentation/tutorial01/ and look at where 
it explains to do that, it has a little note below it explaining that 
this wil happen in the older version.

If i were you, I'd either upgrade your Django, or start following the 
0.96 tutorial from here.

Joshua

Mario Zorz wrote:
> Hello all,
>
> I'm following the Django tutorial [1] I'm using windows xp, python 2.5 
> and SQLite. For some reason I found these 2 things not being 
> appropiate as followed in the tutorial:
>
> 1) When tried "python manage.py sql polls" I got this
> TypeError: __init__() got an unexpected keyword argument 'max_length'.
>
> I could only run it successfully by changing the linea
> question = models.CharField(max_length=200)
> to
> question = models.CharField(maxlength=200)
> (stripped off the undrescore in "max_length")
>
> 2) Continuing down to the "Playing with the API" section, and once I 
> saved some poll objects to the DB, etc I executed the following 
> command as specified in the tutorial:
> Poll.objects.all()
>
>   
> For some reason, the result I get from the shell is
> >>> Poll.objects.all()
> []
>
>
> Even when I inserted the __unicode__() method in models.py as follows:
> class Poll(models.Model):
> question = models.CharField(maxlength=200)
> pub_date = models.DateTimeField('date published')
> def __unicode__(self):
> return self.question
>
> Anything I'm doing wrong?
> Thanks a lot
> regards
> Mario
>
> [1] http://www.djangoproject.com/documentation/tutorial01/
>
>
> >


--~--~-~--~~~---~--~~
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: .pyc files not being created

2008-07-14 Thread Joshua Jonah
Didn't know that, will remember, thanx

Malcolm Tredinnick wrote:
> On Mon, 2008-07-14 at 16:09 -0700, Dana wrote:
>   
>> Hi EAMiller,
>>
>> Im not seeing errors, Its just not compiling the python files (which
>> it should be).
>>
>> I tried a few combinations, but I believe all I need to do is set the
>> chmod to 775 for the source folder (in this case "src")?
>> 
>
> Permissions like "775" mean nothing on their own. Permissions are
> relative to the user and group involved. When you're running things from
> mod_python, the important question would be whether the webserver has
> write permission to those directories in order to write the .pyc files.
>
> However, that's only "important" in the sense that it's not really a
> good idea to allow. Letting your web server only *read* from executable
> file directories is really important for security reasons. For this
> reason, Python ships with the 'compileall' module (which can also be
> executed as a script from the command line). You run "compileall.py ..."
> as somebody who does have permission to write the directory that holds
> the executable files and compile them to .pyc files. Then your webserver
> sees the benefit without opening up unneeded permissions. Read the
> docstring at the top of the "compileall.py" file for instructions on how
> to use it.
>
> 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: newbie help

2008-07-14 Thread Joshua Jonah
Sorry, hadn't gotten new mail in a while :D

Joshua Jonah wrote:
> maxlength was changed in the trunk to max_length. You are probably 
> using an older version of Django, the tutorial you were following 
> refers to the latest version:
> http://code.djangoproject.com/ticket/6457
>
> As for the returning the text thing, same deal. If you go to this 
> page: http://www.djangoproject.com/documentation/tutorial01/ and look 
> at where it explains to do that, it has a little note below it 
> explaining that this wil happen in the older version.
>
> If i were you, I'd either upgrade your Django, or start following the 
> 0.96 tutorial from here.
>
> Joshua
>
> Mario Zorz wrote:
>> Hello all,
>>
>> I'm following the Django tutorial [1] I'm using windows xp, python 
>> 2.5 and SQLite. For some reason I found these 2 things not being 
>> appropiate as followed in the tutorial:
>>
>> 1) When tried "python manage.py sql polls" I got this
>> TypeError: __init__() got an unexpected keyword argument 'max_length'.
>>
>> I could only run it successfully by changing the linea
>> question = models.CharField(max_length=200)
>> to
>> question = models.CharField(maxlength=200)
>> (stripped off the undrescore in "max_length")
>>
>> 2) Continuing down to the "Playing with the API" section, and once I 
>> saved some poll objects to the DB, etc I executed the following 
>> command as specified in the tutorial:
>> Poll.objects.all()
>>
>>   
>> For some reason, the result I get from the shell is
>> >>> Poll.objects.all()
>> []
>>
>>
>> Even when I inserted the __unicode__() method in models.py as follows:
>> class Poll(models.Model):
>> question = models.CharField(maxlength=200)
>> pub_date = models.DateTimeField('date published')
>> def __unicode__(self):
>> return self.question
>>
>> Anything I'm doing wrong?
>> Thanks a lot
>> regards
>> Mario
>>
>> [1] http://www.djangoproject.com/documentation/tutorial01/
>>
>>
>>
>
>
> >


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



Thank you!

2008-07-14 Thread Bobby Roberts

Thanks to everyone for your pointers in the right direction and prompt
answers to my questions.  I was able to build the online bill payment
system for a client.  I hope to be able to contribute back to the
group as I get my Django legs stronger.
--~--~-~--~~~---~--~~
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: Very high com_admin_commands with django/mysql

2008-07-14 Thread Karen Tracey
On Mon, Jul 14, 2008 at 6:12 PM, fordprefect <[EMAIL PROTECTED]> wrote:

>
> We have been optimizing our server (db and caching) since our recent
> launch and one thing we've been looking at is our server status:
>
> Total queries: 4,307,827
> Com_admin_commands: 3,754,356
> Com_insert: 37,790
> Com_select: 1,354,134
> Com_set_option: 172,319
> Com_update: 52,759
> Com_commit: 88,107
>
> (this is approx over 10 hours uptime, 10K visitors/day).
>
> Running Django trunk, mysql Ver 14.12 Distrib 5.0.32, python 2.5,
> Debian.
>
> The com_admin_commands seems extremely high. I have tested on another
> machine with similar setup and can confirm that almost every SELECT
> run through the Django ORM (and possibly INSERT/UPDATE/DELETE) is
> running a com_admin_command. Running queries separately on MySQL or
> through connection.cursor() do not cause this.
>

com_admin_commands includes COM_PING, which is issued every time the MySQL
backend is called to retrieve a cursor for an existing connection.
Internally it looks like Django gets a cursor pretty much immediately before
executing any SQL.  So any hit to the database (after the connection is
first established) is probably incrementing con_admin_commands.


>
> For example:
> from django.contrib.auth.models import User
> u = User.objects.get(pk=1)
>
> will cause an increase in com_admin_commands but not
>
> from django.db import connection
> c=connection.cursor()
> c.execute("select * from auth_user")
>

If you try this 2nd sequence multiple times, you will see that the
connection.cursor() call causes an increment of com_admin_commands (it does
not the first time because during that call a connection is established).
Django internally does the connection.cursor() immediately before each
execute(), so com_admin_commands gets incremented a lot.


> I have 3 questions:
> 1) Have other django/mysql developers encountered this?
> 2) Have they encountered perfomance issues as a result ?
> 3) Which command (if any) is being fired to cause an increase in
> com_admin_commands ?
>

Yes, I see the same behavior.  Whether doing this ping before each SQL
execute is a significnat performance hit I don't know.  It seems a bit
wasteful, but the time involved could easily be just noise compared to the
time required for real work that has to get done for each SQL execute.
You'd need to get some profiling data or experiment with removing it to see
what its measurable cost is.

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



Multi-level template blocks

2008-07-14 Thread Gregg Lobdell

I'm new to Django, and I'm struggling with something that seems to be
do-able.  Maybe I'm thinking about the problem wrong.  Help?

I'm converting an application from hand-constructed Python that builds
a large web site to Django templates.  The site has multiple layers.
All pages share the same basic layout, header, footer, etc.  On each
intermediate layer, some features are added, but there are several
flavors of page within each layer.  I thought I could arrange it as
follows:

base.html
-

{{title}}

Header Stuff
{%block contents%}{%endblock%}
Footer Stuff

-

layer1.html
-
{%extends base.html%}
{%block contents%}
Layer One has cool {{noun}}.
{%block layer_special%}More layer specialization here, that will be
filled in later.{%endblock%}
Layer One closing stuff.
{%endblock%}
-

layer1-special1.html
-
{%extents layer1.html%}
{%block layer_specials%}
You need more than {{noun}}.  You can be special.  Sometime you gotta
{{verb}}.
{%endblock%}
-

In Python:
from django.template import Context, Template, loader
t = loader.get_template("layer1-special1.html")
c = Context( { "title":"Layer One Special One", "noun":"Stuff",
"verb":"Django" } )
print t.render(c)

should print:


Layer One Special One

Header Stuff

Layer One has cool Stuff.

You need more than Stuff.  You can be special.  Sometime you gotta
Django.

Layer One closing stuff.

Footer Stuff


But Django gets an error when it tries to parse the template.  The
error is "django.template.TemplateSyntaxError: Invalid block tag:
'endblock' ".

This is a simple sample, there are at least three different "layers",
and each layer has between 3 and 5 different "specializations".  At
each level there is significant added html and django code, and I'm a
big believer in only doing something once and not duplicating code.

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: .pyc files not being created

2008-07-14 Thread Evert

> Hi Malcom,
>
> Thanks a lot for the detailed response.
>
> Sorry if these are basic questions but, what user would my web server
> be run under (Apache2)? Would it be my username, root, or something
> else like "apache"?

Probably nobody or www. A simple way to try and find out is using 'ps
axu | grep httpd'; the first column should give you the user (I don't
have access to an Ubuntu distribution, otherwise I could tell you
straight away; but Google or the Ubuntu website can also tell you I
guess).
Of course, you can always use root to compile .py files, that'll
"bypass" permissions; but see Malcom's comments.

> Would I have to run compileall.py every time I change a source file
> (it seems like I would have to)?

Possibly, but you'd only want to serve files through apache +
mod_python that aren't going to change much (eg, Django, although that
should just live in the Python site-packages dir); every change also
involves restarting apache for example. Better to sort everything out
using the dev-server, then copy files and run compileall. You'd then
only run compileall for (major) upgrades; not for every single source
file change.

> I couldn't get compileall.py to work on the command line... Tried
> 'compileall.py' and 'compileall'. What am I doing wrong?

compileall comes with the Python source distribution, which is
probably hidden away in a tar file on your server, if anywhere at all.
If your database is working, try a 'locate compileall.py'
Otherwise, if it's not there, grep a Python source distribution
(preferably one that agrees with your Python version) and use the one
included with that.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



ANNOUNCE: Django search with Lucene.

2008-07-14 Thread Spike^ekipS

Hi, django users and developers.

I'm happy to let you know my django application, Django search with
Lucene(DSL). I try
to tighly integrate the Lucene with Django, so I find the way to use
lucene easily in Django.

Django search with Lucene(DSL) supports,
 * indexing object automatically when object is saved(update, delete
also applied in index)
 * search indexed document by django filtering expression
   >>> Person.objects_search.filter(name="spike", age=10)
 * indexing the existing object  like this,
   >>> Person.objects.filter(pk__gte=100).create_index()
 * etc.

Make a story short, this is examples,
===
person = Person.objects.create(
name_first="Spike",
name_last="Ekips",
)

person.name_first = "New Spike"
person.name_last = "New Ekips"
person.save()
>>> Person.objects.objects_search(name_first="Spike").exclude(name_last="ekips").order_by("-time_added")
>>> Person.objects_search(name_first__icontains="pike").order_by("-time_added")
>>> Person..objects_search(
time_added__lte=(datetime.datetime.now() -
datetime.timedelta(days=10))
)
>>> result = Person.objects_search(
time_added__lte=(datetime.datetime.now() -
datetime.timedelta(days=10))
)

>>> for i in result :
print i.get("name_first")
print i.name_first
print i.pk
print i.get("__uid__")
print i.get("name_last")
===
object automatically indexed when saved and analyzed and we can digg
the index db with django model filtering expression.

For more information, visit the project page, 
http://code.google.com/p/django-search-lucene/
or see the short document at 
http://django-search-lucene.googlecode.com/files/django-search-lucene.pdf
.

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



Modules Imported Multiple Times

2008-07-14 Thread django-m712

Hi,

I'm having a problem where Python modules are being imported multiple
times and I cannot figure out why.

I have a simple, standard set up created with the following commands:
django-admin.py startproject mytest
cd mytest
manage.py startapp app1

I would like to run some initialization code before manage.py runs
execute_manager() and some uninitialization after it is done:

if __name__ == "__main__":
import app1
app1.init()
execute_manager(settings)
app1.uninit()

Unfortunately, app1/__init__.py gets loaded both here with the "import
app1" line and also imported later when app1 is initialized by the
framework.

Has anyone else experienced this problem?

Is there a way to fix this?

Environment:
* Python 2.5.2
* Ubuntu 8.04
* Django 0.96.2

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



cant access non-django web page after deploy django on localhost

2008-07-14 Thread Pepsi330ml

Hi,

I deployed my Django Application onto the localhost using Apache.
Below are the changes i did in the httpd.conf


   ServerName localhost
   SetHandler python-program
   PythonHandler django.core.handlers.modpython
   PythonDebug On
   PythonPath "['/xxx/', '/xxx/yyy'] + sys.path"

   
  SetEnv DJANGO_SETTING_MODULE yyy.settings
  PythonInterpreter yyy
   


I am able to access my django application using:
http:/localhost/dispatcher/tasks

The problem now is, i am not able to access the phpPGadmin using:
http://localhost/phppgadmin

Based on my settings, what other ways can i gain access to non django
application that are deployed on localhost?

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



Re: ANNOUNCE: Django search with Lucene.

2008-07-14 Thread vicalloy
2008/7/15, Spike^ekipS <[EMAIL PROTECTED]>:
>
>
> Hi, django users and developers.
>
> I'm happy to let you know my django application, Django search with
> Lucene(DSL). I try
> to tighly integrate the Lucene with Django, so I find the way to use
> lucene easily in Django.
>
> Django search with Lucene(DSL) supports,
>   * indexing object automatically when object is saved(update, delete
> also applied in index)
>   * search indexed document by django filtering expression
>>>> Person.objects_search.filter(name="spike", age=10)
>   * indexing the existing object  like this,
>>>> Person.objects.filter(pk__gte=100).create_index()
>   * etc.
>
> Make a story short, this is examples,
> ===
> person = Person.objects.create(
> name_first="Spike",
> name_last="Ekips",
> )
>
> person.name_first = "New Spike"
> person.name_last = "New Ekips"
> person.save()
> >>>
> Person.objects.objects_search(name_first="Spike").exclude(name_last="ekips").order_by("-time_added")
> >>>
> Person.objects_search(name_first__icontains="pike").order_by("-time_added")
> >>> Person..objects_search(
> time_added__lte=(datetime.datetime.now() -
> datetime.timedelta(days=10))
> )
> >>> result = Person.objects_search(
> time_added__lte=(datetime.datetime.now() -
> datetime.timedelta(days=10))
> )
>
> >>> for i in result :
> print i.get("name_first")
> print i.name_first
> print i.pk
> print i.get("__uid__")
> print i.get("name_last")
> ===
> object automatically indexed when saved and analyzed and we can digg
> the index db with django model filtering expression.
>
> For more information, visit the project page,
> http://code.google.com/p/django-search-lucene/
> or see the short document at
> http://django-search-lucene.googlecode.com/files/django-search-lucene.pdf
> .
>
> Thanks.
>
> I try to integrated django with PyLucene before,and I find it could't work
with fcgi.
Pylucen in thread must
import PyLucene.PythonThread as thread。
have you test it for fcgi?

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



  1   2   >