Re: Django critter helps us code at the speed of light.

2009-04-04 Thread Scott Lyons

Done and done, good sir.

http://www.flickr.com/photos/damagedgenius/3412982843/
and
http://www.flickr.com/photos/damagedgenius/3412982715/

On Mar 17, 2:33 pm, Eric Walstad  wrote:
> On Mar 16, 5:29 pm, Scott Lyons  wrote:> Based on 
> mrts' drawings, I made two backgrounds. I'm open to
> > suggestions or requests.
>
> >http://www.flickr.com/photos/damagedgenius/3361587194/
>
> > and
>
> >http://www.flickr.com/photos/damagedgenius/3361587300/in/photostream/
>
> Excellent!
> A version without the halo would be really nice, too.
>
> Thanks,
>
> Eric.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom validation in view?

2009-04-04 Thread Paddy Joy

Thanks Alex that's exactly what I was looking for!

Paddy

On Apr 5, 10:40 am, Alex Gaynor  wrote:
> On Sat, Apr 4, 2009 at 8:37 PM, Paddy Joy  wrote:
>
> > I need to validate some data from a form however I need access to the
> > request object as the data validation will be different depending on
> > the logged on user.
>
> > What is the preferred method for this type of validation? Can i
> > validate thee data in the view and manually set the form field errors?
>
> > Paddy
>
> Take a look at number 2 
> here:http://collingrady.wordpress.com/2008/07/24/useful-form-tricks-in-dja...
> basically you'll just store user on your form object and then you can use it
> in your clean_ methods.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom validation in view?

2009-04-04 Thread Alex Gaynor
On Sat, Apr 4, 2009 at 8:37 PM, Paddy Joy  wrote:

>
> I need to validate some data from a form however I need access to the
> request object as the data validation will be different depending on
> the logged on user.
>
> What is the preferred method for this type of validation? Can i
> validate thee data in the view and manually set the form field errors?
>
> Paddy
>
> >
>
Take a look at number 2 here:
http://collingrady.wordpress.com/2008/07/24/useful-form-tricks-in-django/
basically you'll just store user on your form object and then you can use it
in your clean_ methods.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

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



Re: django.contrib.auth user password decryption

2009-04-04 Thread Joshua Partogi



On Apr 4, 11:49 pm, Masklinn  wrote:
> On 4 Apr 2009, at 15:38 , Joshua Partogi wrote:
>
> > Dear all,
>
> > I already take a look at the django.contrib.auth.models but could not
> > find any methods for decrypting the user password.
>
> > Sometimes we need to get the real text password to be sent to user.
>
> > What is the best way to do this? Anybody has got an idea?
>
> > Thank you very much in advance!
>
> Django's passwords are salted[1] and hashed[2]. You cannot[3] retrieve  
> them, and that's exactly the intent (well the intent is not that *you*  
> cannot retrieve them, it's that nobody else can). If you need to send  
> users their passwords, you have to generate new (random) passwords and  
> send them that.
>
> Masklinn

Thanks for the explanation Masklinn. :-)

I'll find another way to send user their password.

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



Re: dev server vs. real server oddity

2009-04-04 Thread Reiner

This is intended behavior and documented in the generic view
documentation here: 
http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-date-based-archive-year
It states that this view raises a 404, when the queryset is empty, so
the resulting page basically is considered empty and therefore a 404
error is appropriate.

You need to take the optional argument 'allow_empty' into
consideration, I quote from the docs:

"allow_empty: A boolean specifying whether to display the page if no
objects are available. If this is False and no objects are available,
the view will raise a 404 instead of displaying an empty page. By
default, this is False."

So you might want to use allow_empty=True in your view to prevent
raising 404s on empty querysets.

Regards,
Reiner

On Apr 4, 4:20 pm, dls  wrote:
> Ok, it turns out that the "archive year" generic view throws a 404
> error if the querset commands result in an empty set. Through testing
> I discovered that my development server database works fine because
> the queryset returns values, but the live database throws a 404
> because it returns with an empty set. This is very strange because the
> live database is nothing more than the development db with more
> information in the fields - I don't see any reason why one should
> error out and not the other.
>
> For testing, I called these commands on both databases:
>
> key:
> 1 = development database (small, not many records)
> 2 = live database (larger, but still not huge - should be identical to
> the dev db)
>
> > python manage.py dbshell
> > select * from blog_post;
>
> results:
> db1: three blog entries are returned
> db2: seven blog entries are returned (as I have added four)
>
> > python manage.py shell
> > from blog.models import Post
> > temp = Post.objects.all()
> > temp #just to print
>
> results:
> db1: three blog entries are returned
> db2: an empty set [] is returned
>
> I understand that objects.all() is the same as "select * from
> blog_post", so the fact that one works while the other does not is
> further confusing.
>
> I would upload the databases, but google groups doesn't seem to
> provide that functionality. Any suggestions as to where I can upload
> files temporarily?
>
> Thanks!
>
> -dls
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Cascading Select Boxes in Admin?

2009-04-04 Thread Alex Gaynor
On Sat, Apr 4, 2009 at 3:47 PM, JGAllen23  wrote:

>
> Is there any way to have cascading select boxes in the admin app?  The
> second select box depends on what was chosen in the first.
> >
>
There's no automated way to do this, you'd need to write some of your own
javascript to handle it.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

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



Re: Sqlite3 database fail

2009-04-04 Thread zayatzz

Thanks to both of you. worked just fine.

Alan

On Apr 4, 10:50 pm, dls  wrote:
> Yes, once you have executed the initial "python manage.py syncdb" your
> database will automatically be created by Django and you will be able
> to open in using SQLite. If you are starting a brand new project you
> should try "python manage.py startapp [appname]", which will create a
> new application in the existing Django project.
>
> I would recommend using the Django database browser instead of sqlite3
> - "python manage.py dbshell" is the command. This will open the
> appropriate database as per the name you have select in your
> settings.py file.
>
> -dls
>
> On Apr 4, 3:41 pm, zayatzz  wrote:
>
> > So i should just set the database file name in settings.py and stop
> > worring about it untill i hit syncdb?'
>
> > Alan.
>
> > On Apr 4, 10:38 pm, Alex Gaynor  wrote:
>
> > > On Sat, Apr 4, 2009 at 3:34 PM, alan.kesselm...@gmail.com <
>
> > > alan.kesselm...@gmail.com> wrote:
>
> > > > Hello
>
> > > > I decided to check out django and i finished tutorial and it was all
> > > > good. When i wanted to try something for myself and created another
> > > > app and proceeded to create new database for this project - i failed.
>
> > > > I installed sqlite3 on my computer (i use kubuntu 9.04) and when i run
> > > > sqlite3 insertdatabasenamehere - nothing happens. Well somethind
> > > > happens..
>
> > > > x...@xxx:~/Django/p2$ sqlite3 new.db
> > > > SQLite version 3.6.10
> > > > Enter ".help" for instructions
> > > > Enter SQL statements terminated with a ";"
> > > > sqlite>
>
> > > > i exit and there is no file named new.db:
>
> > > > sqlite> .exit
> > > > x...@xxx:~/Django/p2$ ls -l
> > > > total 12
> > > > -rw-r--r-- 1 xxx xxx    0 2009-04-04 13:31 __init__.py
> > > > -rw-r--r-- 1 xxx xxx  546 2009-04-04 13:31 manage.py
> > > > -rw-r--r-- 1 xxx xxx 2765 2009-04-04 13:31 settings.py
> > > > -rw-r--r-- 1 xxx xxx  529 2009-04-04 13:31 urls.py
> > > > x...@xxx:~/Django/p2$
>
> > > > Doest matter if i run it with sudo rights or not.
>
> > > > Alan
>
> > > You don't need to worry about creating the SQLite file, the Python 
> > > bindings
> > > automatically create the file if it doesn't exist.
>
> > > Alex
>
> > > --
> > > "I disapprove of what you say, but I will defend to the death your right 
> > > to
> > > say it." --Voltaire
> > > "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Sqlite3 database fail

2009-04-04 Thread dls

Yes, once you have executed the initial "python manage.py syncdb" your
database will automatically be created by Django and you will be able
to open in using SQLite. If you are starting a brand new project you
should try "python manage.py startapp [appname]", which will create a
new application in the existing Django project.

I would recommend using the Django database browser instead of sqlite3
- "python manage.py dbshell" is the command. This will open the
appropriate database as per the name you have select in your
settings.py file.

-dls

On Apr 4, 3:41 pm, zayatzz  wrote:
> So i should just set the database file name in settings.py and stop
> worring about it untill i hit syncdb?'
>
> Alan.
>
> On Apr 4, 10:38 pm, Alex Gaynor  wrote:
>
> > On Sat, Apr 4, 2009 at 3:34 PM, alan.kesselm...@gmail.com <
>
> > alan.kesselm...@gmail.com> wrote:
>
> > > Hello
>
> > > I decided to check out django and i finished tutorial and it was all
> > > good. When i wanted to try something for myself and created another
> > > app and proceeded to create new database for this project - i failed.
>
> > > I installed sqlite3 on my computer (i use kubuntu 9.04) and when i run
> > > sqlite3 insertdatabasenamehere - nothing happens. Well somethind
> > > happens..
>
> > > x...@xxx:~/Django/p2$ sqlite3 new.db
> > > SQLite version 3.6.10
> > > Enter ".help" for instructions
> > > Enter SQL statements terminated with a ";"
> > > sqlite>
>
> > > i exit and there is no file named new.db:
>
> > > sqlite> .exit
> > > x...@xxx:~/Django/p2$ ls -l
> > > total 12
> > > -rw-r--r-- 1 xxx xxx    0 2009-04-04 13:31 __init__.py
> > > -rw-r--r-- 1 xxx xxx  546 2009-04-04 13:31 manage.py
> > > -rw-r--r-- 1 xxx xxx 2765 2009-04-04 13:31 settings.py
> > > -rw-r--r-- 1 xxx xxx  529 2009-04-04 13:31 urls.py
> > > x...@xxx:~/Django/p2$
>
> > > Doest matter if i run it with sudo rights or not.
>
> > > Alan
>
> > You don't need to worry about creating the SQLite file, the Python bindings
> > automatically create the file if it doesn't exist.
>
> > Alex
>
> > --
> > "I disapprove of what you say, but I will defend to the death your right to
> > say it." --Voltaire
> > "The people's good is the highest law."--Cicero
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Cascading Select Boxes in Admin?

2009-04-04 Thread JGAllen23

Is there any way to have cascading select boxes in the admin app?  The
second select box depends on what was chosen in the first.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Sqlite3 database fail

2009-04-04 Thread zayatzz

So i should just set the database file name in settings.py and stop
worring about it untill i hit syncdb?'

Alan.

On Apr 4, 10:38 pm, Alex Gaynor  wrote:
> On Sat, Apr 4, 2009 at 3:34 PM, alan.kesselm...@gmail.com <
>
>
>
> alan.kesselm...@gmail.com> wrote:
>
> > Hello
>
> > I decided to check out django and i finished tutorial and it was all
> > good. When i wanted to try something for myself and created another
> > app and proceeded to create new database for this project - i failed.
>
> > I installed sqlite3 on my computer (i use kubuntu 9.04) and when i run
> > sqlite3 insertdatabasenamehere - nothing happens. Well somethind
> > happens..
>
> > x...@xxx:~/Django/p2$ sqlite3 new.db
> > SQLite version 3.6.10
> > Enter ".help" for instructions
> > Enter SQL statements terminated with a ";"
> > sqlite>
>
> > i exit and there is no file named new.db:
>
> > sqlite> .exit
> > x...@xxx:~/Django/p2$ ls -l
> > total 12
> > -rw-r--r-- 1 xxx xxx    0 2009-04-04 13:31 __init__.py
> > -rw-r--r-- 1 xxx xxx  546 2009-04-04 13:31 manage.py
> > -rw-r--r-- 1 xxx xxx 2765 2009-04-04 13:31 settings.py
> > -rw-r--r-- 1 xxx xxx  529 2009-04-04 13:31 urls.py
> > x...@xxx:~/Django/p2$
>
> > Doest matter if i run it with sudo rights or not.
>
> > Alan
>
> You don't need to worry about creating the SQLite file, the Python bindings
> automatically create the file if it doesn't exist.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Sqlite3 database fail

2009-04-04 Thread alan.kesselm...@gmail.com

Hello

I decided to check out django and i finished tutorial and it was all
good. When i wanted to try something for myself and created another
app and proceeded to create new database for this project - i failed.

I installed sqlite3 on my computer (i use kubuntu 9.04) and when i run
sqlite3 insertdatabasenamehere - nothing happens. Well somethind
happens..

x...@xxx:~/Django/p2$ sqlite3 new.db
SQLite version 3.6.10
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

i exit and there is no file named new.db:

sqlite> .exit
x...@xxx:~/Django/p2$ ls -l
total 12
-rw-r--r-- 1 xxx xxx0 2009-04-04 13:31 __init__.py
-rw-r--r-- 1 xxx xxx  546 2009-04-04 13:31 manage.py
-rw-r--r-- 1 xxx xxx 2765 2009-04-04 13:31 settings.py
-rw-r--r-- 1 xxx xxx  529 2009-04-04 13:31 urls.py
x...@xxx:~/Django/p2$

Doest matter if i run it with sudo rights or not.

Alan

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



Re: Reacting to browser closing the socket

2009-04-04 Thread Marcus Weseloh

On Sat, 4 Apr 2009 00:53:31 -0700 (PDT)
Graham Dumpleton  wrote:

> There have been discussions about detection of client connection
> closing on the mod_wsgi list before. It is a far from simple problem.
> This is because it can only be detected at certain points,
> specifically when either reading data from client, or attempting to
> write it. If your code is some sort of blocking state, such as waiting
> for back end command to do something, this isn't a way you can get a
> notification that client has closed connection. Thus the command would
> have to do what it needs to first, and only when trying to write back
> data would you know. I think the threads on mod_wsgi list about this
> are:

That is actually a problem. My external command could spend a
considerable time without producing any output, so my approach fails to
detect a closed socket until data is actually being returned to the
client. I thought about trickling some sort of "heartbeat data" down
the line to the client while the external command is processing, but I
guess that won't work becuause of socket and/or apache buffers sitting
inbetween my webapp and the client.

Oh well... back to the drawing board. :-)

Thank you Graham and Malcom for your detailed answers! 

Cheers,

Marcus
I 


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



How to keep the translations for the templates from different applications separately?

2009-04-04 Thread Valery

Hi

How could one keep the translations for the templates from different
apps separately? According to Django docs (http://www.djangobook.com/
en/2.0/chapter19/) one could put the application's translations in a
correspondent application folder, but it has a few to do with
templates whereas the very templates carry the larger part of texts to
be translated. I am puzzled.

there are two ways that look for me somewhat feasible:

1. keep all applications outside of project tree and try to attach
them in some "pluggable" way, e.g. like middleware (sounds odd to me)

2. use LOCALE_PATHS to point to myproject/templates/application-N/
locale/ where the translations are stored (this didn't work for me)

P.S. In fact I have cross-posted this question from pinax-user group

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



Re: multiple django versions in mod_python

2009-04-04 Thread Karen Tracey
On Sat, Apr 4, 2009 at 10:57 AM, pault  wrote:

>
>  I have one version 1.02 installed in /var/lib/python-support/
> python2.5/django/ (i am on a debian machine)
>  and one version 0.96 in the folder of my project.


Specifics of exactly where you have Django 0.96 installed would have been
helpful here.  Without such specifics people are forced to guess whether
you've got exactly the right paths specified in your PythonPath directive.


>
> I read the post from Graham but it doesn't seem to work for me it uses
> the 1.02 version.
>
> http://groups.google.com/group/django-users/browse_thread/thread/1c5c461a49c28e41/5c61b32e99325dde?lnk=gst=multiple+versions#5c61b32e99325dde
>
> 
> PythonInterpreter django.blabla
> SetHandler python- program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE blabla.settings
> PythonDebug On
> PythonPath "['/home/paul','/home/paul/blabla/django'] + sys.path"
> 
>
> How can I get my old sites working through mod_python


Given what you have specified, an import like: "from django import models"
is going to look for:

/home/paul/django/__init__.py
/home/paul/blabla/django/django/__init__.py
continue with same pattern for all of sys.path

I'm guessing the /django you have on the end of the 'blabla' entry is the
problem, since I suspect that is introducing a 2nd '/django' in the path,
but since I'm not entirely sure where your 0.96 install is I'm not 100% sure
of that.

Also be sure that the Apache process has permissions to read the directories
involved here.

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



Re: multiple django versions in mod_python

2009-04-04 Thread Antoni Aloy

2009/4/4 pault :
>
>  I have one version 1.02 installed in /var/lib/python-support/
> python2.5/django/ (i am on a debian machine)
>  and one version 0.96 in the folder of my project.
>
> I read the post from Graham but it doesn't seem to work for me it uses
> the 1.02 version.
> http://groups.google.com/group/django-users/browse_thread/thread/1c5c461a49c28e41/5c61b32e99325dde?lnk=gst=multiple+versions#5c61b32e99325dde
>
>  "/">
> PythonInterpreter
> django.blabla
> SetHandler python-
> program
> PythonHandler
> django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE
> blabla.settings
> PythonDebug
> On
> PythonPath "['/home/paul','/home/paul/blabla/django'] +
> sys.path"
> 
>
> How can I get my old sites working through mod_python

we use virtualenv for that
http://blog.ianbicking.org/2007/10/10/workingenv-is-dead-long-live-virtualenv/,
that allows us to mantain diferent versons of applications with their
own dependencies.

Best regards,


-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

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



Re: Problem with syncr and picasa - not displaying large images, mostly

2009-04-04 Thread Bas van Oostveen

As far as i know, Google makes the large images available on demand.
So unless you view these images through picasa first they are available,
but at some later date or without going through picasa first they might
not be.

Or as another random internet comment says: "This is because original
images in picasa web albums are restricted to be used only in Google own
service. When you show them in other place, you only could use small
versions, at most 800px in width."

Making picasaweb/gdata as a way to externalize photo albums irritating
to say the least. 

-bas

On Sat, 2009-04-04 at 05:49 -0700, phoebebright wrote:
> Rajesh,
> 
> That make perfect sense.  Thank you so much.
> 
> Phoebe.
> 
> On Apr 3, 8:18 pm, Rajesh D  wrote:
> > On Apr 3, 12:59 pm, phoebebright  wrote:
> >
> > > I implemented syncr (http://code.google.com/p/django-syncr/) quickly
> > > and easily but have one strange problem.  I can display thumbnails but
> > > not the full size image.  But if I copy the URL in the src tag into
> > > the browser, I see the image perfectly!!  How is this possible?
> >
> > > For example, this is fine:http://dunmanway.pighaswings.com/gallery/3/
> >
> > > But click on any of the images and you get a 404, image not found.
> >
> > > But paste this link into the browser and you should see a 
> > > church:http://lh6.ggpht.com/_qN3t6LkRhaI/SZM3Weft1dI/AG8/Bzb8roA4lUA...
> >
> > > Any suggestions very welcome as this is supposed to go live today and
> > > I am baffled!!!
> >
> > It's most likely because the server at ggpht.com forbids these images
> > by HTTP_REFERER i.e. it prevents them from being embedded into
> > external sites (probably to prevent bandwidth abuse). If you control
> > the account at ggpht.com, see if there's a setting that allows linking
> > of photos from external sites/blogs, etc.
> >
> > -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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Unique Field Combinations

2009-04-04 Thread Daniel Roseman

On Apr 4, 2:06 pm, Chris  wrote:
> How would you enforce a unique column constraint on a combination of
> fields?
>
> For example, say I have the model:
>
> class Company(models.Model):
>     name = models.CharField(unique=True)
>
> class Article(models.Model):
>     company = models.ForeignKey(Company)
>     title = models.CharField(max_length=500)
>
> In the Article model, I'd want to make the combination of company
> +title unique. In other words, one Company could be associated with
> many Articles, and one Article title could be associated with many
> Comanies, but no one company should be associated with the same
> Article title more than once. Is that possible?

http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together
--
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



multiple django versions in mod_python

2009-04-04 Thread pault

 I have one version 1.02 installed in /var/lib/python-support/
python2.5/django/ (i am on a debian machine)
 and one version 0.96 in the folder of my project.

I read the post from Graham but it doesn't seem to work for me it uses
the 1.02 version.
http://groups.google.com/group/django-users/browse_thread/thread/1c5c461a49c28e41/5c61b32e99325dde?lnk=gst=multiple+versions#5c61b32e99325dde


PythonInterpreter
django.blabla
SetHandler python-
program
PythonHandler
django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE
blabla.settings
PythonDebug
On
PythonPath "['/home/paul','/home/paul/blabla/django'] +
sys.path"


How can I get my old sites working through mod_python
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: dev server vs. real server oddity

2009-04-04 Thread dls

Ok, it turns out that the "archive year" generic view throws a 404
error if the querset commands result in an empty set. Through testing
I discovered that my development server database works fine because
the queryset returns values, but the live database throws a 404
because it returns with an empty set. This is very strange because the
live database is nothing more than the development db with more
information in the fields - I don't see any reason why one should
error out and not the other.

For testing, I called these commands on both databases:

key:
1 = development database (small, not many records)
2 = live database (larger, but still not huge - should be identical to
the dev db)

> python manage.py dbshell
> select * from blog_post;

results:
db1: three blog entries are returned
db2: seven blog entries are returned (as I have added four)

> python manage.py shell
> from blog.models import Post
> temp = Post.objects.all()
> temp #just to print

results:
db1: three blog entries are returned
db2: an empty set [] is returned

I understand that objects.all() is the same as "select * from
blog_post", so the fact that one works while the other does not is
further confusing.

I would upload the databases, but google groups doesn't seem to
provide that functionality. Any suggestions as to where I can upload
files temporarily?

Thanks!

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



Re: django.contrib.auth user password decryption

2009-04-04 Thread Masklinn

On 4 Apr 2009, at 15:38 , Joshua Partogi wrote:
> Dear all,
>
> I already take a look at the django.contrib.auth.models but could not
> find any methods for decrypting the user password.
>
> Sometimes we need to get the real text password to be sent to user.
>
> What is the best way to do this? Anybody has got an idea?
>
> Thank you very much in advance!

Django's passwords are salted[1] and hashed[2]. You cannot[3] retrieve  
them, and that's exactly the intent (well the intent is not that *you*  
cannot retrieve them, it's that nobody else can). If you need to send  
users their passwords, you have to generate new (random) passwords and  
send them that.

Masklinn

[1] http://en.wikipedia.org/wiki/Salt_(cryptography)
[2] http://en.wikipedia.org/wiki/Cryptographic_hash
[3] you can probably bruteforce them if you have a lot of time and  
computing power to waste, and future SHA-1 breakages might help you  
further, but that's all.

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



django.contrib.auth user password decryption

2009-04-04 Thread Joshua Partogi

Dear all,

I already take a look at the django.contrib.auth.models but could not
find any methods for decrypting the user password.

Sometimes we need to get the real text password to be sent to user.

What is the best way to do this? Anybody has got an idea?

Thank you very much in advance!

-- 
If you can't believe in God the chances are your God is too small.

Read my blog: http://joshuajava.wordpress.com/
Follow me on twitter: http://twitter.com/jpartogi

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



model gets inconsistent after I delete some objects using object.delete() method

2009-04-04 Thread TTear1943

Many days ago, I deleted some object with object.delete() method.
Today I found that my model Product is inconsistent now. Here is the
strange result.

>>> allproduct=Product.objects.all()
>>> allproduct
[, ]
#Here shows no product with id=7

>>> for ap in allproduct:
...   print ap.id
...
4
5
#print allproduct's id, no id =7

But in the following:
>>> funny_p7=Product.objects.get(id=7)
>>> funny_p7

>>>

What is up??? So strange. Is it because the django forget to update
when I delete objects?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Unique Field Combinations

2009-04-04 Thread Chris

How would you enforce a unique column constraint on a combination of
fields?

For example, say I have the model:

class Company(models.Model):
name = models.CharField(unique=True)

class Article(models.Model):
company = models.ForeignKey(Company)
title = models.CharField(max_length=500)

In the Article model, I'd want to make the combination of company
+title unique. In other words, one Company could be associated with
many Articles, and one Article title could be associated with many
Comanies, but no one company should be associated with the same
Article title more than once. Is that possible?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem in Model inheritance after some objects are deleted

2009-04-04 Thread TTear1943

Now I have revise the code as follow:
The as_leaf_class():
def as_leaf_class(self):
content_type = self.content_type
model = content_type.model_class()
if (model == Product):
return self
try:
obj = model.objects.get(id=self.id)
return obj
except:
return None
#return model.objects.get(id=self.id)
The __iter__() and __getitem__():
def __getitem__(self, k):
result = super(SubclassingQuerySet, self).__getitem__(k)
if isinstance(result, models.Model):
alc = result.as_leaf_class()
if alc:
   return alc
#return result.as_leaf_class()
else:
return result

def __iter__(self):
for item in super(SubclassingQuerySet, self).__iter__():
alc = item.as_leaf_class()
if alc:
yield item.as_leaf_class()

Is this solution correct?

On Apr 4, 8:19 pm, TTear1943 <1943@gmail.com> wrote:
> I use a snippet inhttp://www.djangosnippets.org/snippets/1034/for my
> Model inheritance. It works fine at the first.However, after I delete
> some elements in database, the code works wrong.
> As I debug, I found that the problem resides in the method:
> as_leaf_class.
> In the following code:
>     def as_leaf_class(self):
>         content_type = self.content_type
>         model = content_type.model_class()
>  (1*)       if(model == Contact):
>             return self
> (2*)        return model.objects.get(id=self.id)
> when query a deleted object, line (1*) will be False, So it tries to
> run line (2*) which raise an exception from get()
> Anyone could give a solution for this?
>
> The snippets I use is following:
> Model inheritance with content type and inheritance-aware manager
> from django.db import models
> from django.contrib.contenttypes.models import ContentType
> from django.db.models.query import QuerySet
>
> class SubclassingQuerySet(QuerySet):
>     def __getitem__(self, k):
>         result = super(SubclassingQuerySet, self).__getitem__(k)
>         if isinstance(result, models.Model) :
>             return result.as_leaf_class()
>         else :
>             return result
>     def __iter__(self):
>         for item in super(SubclassingQuerySet, self).__iter__():
>             yield item.as_leaf_class()
>
> class MealManager(models.Manager):
>     def get_query_set(self):
>         return SubclassingQuerySet(self.model)
>
> class Meal (models.Model) :
>     name = models.TextField(max_length=100)
>     content_type = models.ForeignKey
> (ContentType,editable=False,null=True)
>     objects = MealManager()
>
>     def save(self, *args, **kwargs):
>         if(not self.content_type):
>             self.content_type = ContentType.objects.get_for_model
> (self.__class__)
>             super(Meal, self).save(*args, **kwargs)
>
>     def as_leaf_class(self):
>         content_type = self.content_type
>         model = content_type.model_class()
>         if (model == Meal):
>             return self
>         return model.objects.get(id=self.id)
>
> class Salad (Meal) :
>     too_leafy = models.BooleanField(default=False)
>     objects = MealManager()
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with syncr and picasa - not displaying large images, mostly

2009-04-04 Thread phoebebright

Rajesh,

That make perfect sense.  Thank you so much.

Phoebe.

On Apr 3, 8:18 pm, Rajesh D  wrote:
> On Apr 3, 12:59 pm, phoebebright  wrote:
>
> > I implemented syncr (http://code.google.com/p/django-syncr/) quickly
> > and easily but have one strange problem.  I can display thumbnails but
> > not the full size image.  But if I copy the URL in the src tag into
> > the browser, I see the image perfectly!!  How is this possible?
>
> > For example, this is fine:http://dunmanway.pighaswings.com/gallery/3/
>
> > But click on any of the images and you get a 404, image not found.
>
> > But paste this link into the browser and you should see a 
> > church:http://lh6.ggpht.com/_qN3t6LkRhaI/SZM3Weft1dI/AG8/Bzb8roA4lUA...
>
> > Any suggestions very welcome as this is supposed to go live today and
> > I am baffled!!!
>
> It's most likely because the server at ggpht.com forbids these images
> by HTTP_REFERER i.e. it prevents them from being embedded into
> external sites (probably to prevent bandwidth abuse). If you control
> the account at ggpht.com, see if there's a setting that allows linking
> of photos from external sites/blogs, etc.
>
> -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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problem in Model inheritance after some objects are deleted

2009-04-04 Thread TTear1943

I use a snippet in http://www.djangosnippets.org/snippets/1034/ for my
Model inheritance. It works fine at the first.However, after I delete
some elements in database, the code works wrong.
As I debug, I found that the problem resides in the method:
as_leaf_class.
In the following code:
def as_leaf_class(self):
content_type = self.content_type
model = content_type.model_class()
 (1*)   if(model == Contact):
return self
(2*)return model.objects.get(id=self.id)
when query a deleted object, line (1*) will be False, So it tries to
run line (2*) which raise an exception from get()
Anyone could give a solution for this?


The snippets I use is following:
Model inheritance with content type and inheritance-aware manager
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.db.models.query import QuerySet

class SubclassingQuerySet(QuerySet):
def __getitem__(self, k):
result = super(SubclassingQuerySet, self).__getitem__(k)
if isinstance(result, models.Model) :
return result.as_leaf_class()
else :
return result
def __iter__(self):
for item in super(SubclassingQuerySet, self).__iter__():
yield item.as_leaf_class()

class MealManager(models.Manager):
def get_query_set(self):
return SubclassingQuerySet(self.model)

class Meal (models.Model) :
name = models.TextField(max_length=100)
content_type = models.ForeignKey
(ContentType,editable=False,null=True)
objects = MealManager()

def save(self, *args, **kwargs):
if(not self.content_type):
self.content_type = ContentType.objects.get_for_model
(self.__class__)
super(Meal, self).save(*args, **kwargs)

def as_leaf_class(self):
content_type = self.content_type
model = content_type.model_class()
if (model == Meal):
return self
return model.objects.get(id=self.id)

class Salad (Meal) :
too_leafy = models.BooleanField(default=False)
objects = MealManager()

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



Re: What is the best way to extend the User Model

2009-04-04 Thread James Bennett

On Fri, Apr 3, 2009 at 1:17 PM, Dave Fowler  wrote:
> Great, thanks guys!  Just wanted to make sure I wasn't missing
> anything.

If some new 'official' method appeared, the documentation would update
to reflect that:

http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users


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

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



Form wizard - previous step

2009-04-04 Thread eli

Hi,

What is the best way to add button "previous step" to multi-steps
form ?

Thank You.

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



Re: Reacting to browser closing the socket

2009-04-04 Thread Graham Dumpleton



On Apr 4, 4:44 pm, Marcus Weseloh  wrote:
> Hi Malcom,
>
> thanks for your response!
>
> On Sat, 04 Apr 2009 12:21:11 +1100
>
> Malcolm Tredinnick  wrote:
> > You're not really trying to solve a valid problem here. The
> > development server isn't intended for streaming data or anything like
> > that. It's a very simplistic server for basic stuff. So if you're
> > trying to do streaming, you should be using a real web server more or
> > less immediately. During single-person testing/development with the
> > dev server, the periodic EPIPE error is harmless and not worth doing
> > anything about.
>
> It's not really the EPIPE error I'm worried about, I'm just trying to
> utilize that error to prevent my external command from wasting cpu
> cycles by finishing the task, even though the client has already gone
> away.
>
> > Then you'll discover that it's not really a problem you have to worry
> > about. Firstly, because there are a few things inside Django that
> > prevent streaming content from working smoothly and we don't guarantee
> > that sending an iterator to the HttpResponse's __init__ method won't
> > consume the iterator immediately, rather than streaming it.
>
> Ah, ok. Maybe I should explain my ultimate goal: I want to build a very
> simple web service that reacts to GET requests and translates them
> into command-line arguments for the external command. The external
> command does some very heavy lifting and returns a lot of data. I
> would like to stream the returned data to the client and have the
> external command terminate immediately, if the client connection dies.
>
> So do I understand you correctly that I would need to skip Django and
> write my own request handling code to interface with the command?
>
> Bear in mind that I don't need middleware or any of the other niceties
> of Django (like ORM, Admin Interface, templates etc) at this point,
> just the request-view-response code. I just wanted to use Django to
> kick-start the development a bit.

There have been discussions about detection of client connection
closing on the mod_wsgi list before. It is a far from simple problem.
This is because it can only be detected at certain points,
specifically when either reading data from client, or attempting to
write it. If your code is some sort of blocking state, such as waiting
for back end command to do something, this isn't a way you can get a
notification that client has closed connection. Thus the command would
have to do what it needs to first, and only when trying to write back
data would you know. I think the threads on mod_wsgi list about this
are:

  
http://groups.google.com/group/modwsgi/browse_frm/thread/c8fc824e939de1f9/83526a2c3a26f65d
  
http://groups.google.com/group/modwsgi/browse_frm/thread/8ebd9aca9d317ac9/4029bfc8c40dd242

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



Re: Using variable attribute as attribute to another variable

2009-04-04 Thread Briel

Hi I don't believe you can use variables within variables. What you
can do is use/make a template tag that will look up in the list.
Or you could make if forloop.counter == statements.
Or you can make a dictionary and fx make the day_list keys
And the table_list values and iterate over the key, value pair

~Jakob

On Apr 4, 7:47 am, Travis  wrote:
> I am trying to use a 'dotted variable' (forloop.counter in this case)
> as an index to a list, but without success so far.
>
> I have a list of strings called 'table_string' and the following code:
> {% for d in day_list %}
>      {{d}}{{table_string.forloop.counter}}
> {% endfor %}
>
> What I'm trying to do is render the table_string item (indexed 1-7)
> for the appropriate day using the forloop.counter variable, but I am
> getting no result (or at least the TEMPLATE_STRING_IF_INVALID).
>
> Can someone please suggest what I need to do to use a variable
> attribute as the attribute to another variable?
>
> Travis
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---