Re: QuerySet

2006-07-17 Thread sasha

i'm trying to access the last record to loop over the query set.
however somehow when i call on Something.objects.order_by("-id")[0] the
set is truncated and it starts to loop over just the first and last
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: QuerySet

2006-07-17 Thread Malcolm Tredinnick

On Tue, 2006-07-18 at 05:04 +, sasha wrote:
> Hi,
> 
> I must be missing something really obvious - QuerySets don't support
> negative notation, so what is then the right way of getting at the last
> item in the set?

Two possibilities:

(1) If you only want the last items and not the first items, then
reverse the ordering condition on your query set (exactly how to do this
depends upon how you're constructing the original query. You want to do
things like order by '-creation_time' instead of 'creation_time' and so
forth).

(2) If you need items at both ends of the query set, turn it into a list
(which will read all the results into memory) and then you can access
elements at random:

item = list(queryset)[-1]

Finally, for really huge result sets (tens of thousands of lines), if
reading it into memory might be a bad idea, you can write two queries:
one to get the early results and one ordered in the opposite direction
to get the later results. But this case will be rare. Normally one of
option (1) or (2) will suffice.

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



Re: How to get django to show me the sql it executed recently?

2006-07-17 Thread Adrian Holovaty

On 7/17/06, Scott Chapman <[EMAIL PROTECTED]> wrote:
> I recall there's a way to do this but can't remember what it is.  You could do
> something in the shell to get it.  Please help my ailing memory!

Hey Scott,

Check out the answer here:

http://www.djangoproject.com/documentation/faq/#how-can-i-see-the-raw-sql-queries-django-is-running

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.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
-~--~~~~--~~--~--~---



Re: QuerySet

2006-07-17 Thread Jacob Kaplan-Moss

On Jul 18, 2006, at 12:04 AM, sasha wrote:
> I must be missing something really obvious - QuerySets don't support
> negative notation, so what is then the right way of getting at the  
> last
> item in the set?

Just order in the "other" direction.

For example, to get the least expensive item in your store catalog,  
you could do::

StoreItem.objects.order_by("price")[0]

... and to get the most expensive item::

StoreItem.objects.order_by("-price")[0]

(More: http://www.djangoproject.com/documentation/db_api/#order-by- 
fields).

Jacob

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



QuerySet

2006-07-17 Thread sasha

Hi,

I must be missing something really obvious - QuerySets don't support
negative notation, so what is then the right way of getting at the last
item in the set?

Thanks,

Sasha


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



Re: "no module named admin", webfaction

2006-07-17 Thread rp


Harish Mallipeddi wrote:
> Hi,
>
> Did you enable Admin in the project settings file? You need to enable it
> before you can start using it. Read the Django documentation to find out
> more info on this.
>
> Cheers,
> Harish
>
> On 7/18/06, Raman Prasad <[EMAIL PROTECTED]> wrote:
> >
> >
> > Hi,
> >
> > I have an admin setup question (I think I'm missing a basic step)
> >
> > I have some basic django code running on my laptop (local)
> > which works fine but I'm having trouble moving it to a webfaction
> > account.
> >
> > I used the screencast, etc but I'm getting a "no module named admin"
> > error when trying
> > to show the admin screen.  http:// . . ./admin/
> >
> > I have the same error at the command line--the trace from the command
> > line is:
> >
> > Python 2.4 (#1, Jul 24 2005, 05:05:49)
> > >>> import django
> > >>> from django.conf.urls.defaults import *
> > >>> import django.contrib.admin.urls.admin
> > Traceback (most recent call last):
> >   File "", line 1, in ?
> > ImportError: No module named admin
> > >>>
> >
> > The trace from a webpage is:
> >
> > Traceback (most recent call last):
> > File
> > "/home2/prasad06511/lib/python2.4/django/core/handlers/base.py"
> > in get_response
> >   65. callback, callback_args, callback_kwargs = resolver.resolve
> > (path)
> > File
> > "/home2/prasad06511/lib/python2.4/django/core/urlresolvers.py"
> > in resolve
> >   147. sub_match = pattern.resolve(new_path)
> > File
> > "/home2/prasad06511/lib/python2.4/django/core/urlresolvers.py"
> > in resolve
> >   145. for pattern in self.urlconf_module.urlpatterns:
> > File
> > "/home2/prasad06511/lib/python2.4/django/core/urlresolvers.py"
> > in _get_urlconf_module
> >   163. self._urlconf_module = __import__(self.urlconf_name, '',
> > '',
> > [''])
> >
> >   ImportError at /admin/
> >   No module named admin
> >
> > Thanks for any help!
> >
> > -raman
> >
> > >
> >
>
>
> --
> Harish Mallipeddi
> http://poundbang.in/
>
> --=_Part_64290_28522370.1153189128453
> Content-Type: text/html; charset=ISO-8859-1
> X-Google-AttachSize: 3291
>
> Hi,Did you enable Admin in the project settings file? You need to 
> enable it before you can start using it. Read the Django documentation to 
> find out more info on this.Cheers,Harish class="gmail_quote">

Hi Harish,

Thanks for the note.  The admin was enabled in the setting file . . .
but I spotted another inconsistency and it's working fine.

thanks again,
-raman


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



Re: How to get django to show me the sql it executed recently?

2006-07-17 Thread Ian Holsman


http://zilbo.com/@perfmon captures this kind of information on a per- 
request basis.


On 18/07/2006, at 12:06 PM, Malcolm Tredinnick wrote:

>
> On Mon, 2006-07-17 at 18:44 -0700, Scott Chapman wrote:
> [...]
>> p.s. Any chance this could be added to the Admin interface.  It's the
>> intuitive place for such things.
>
> Not a good idea. It's a security hole. You would be able to see every
> query people run just because you can log into admin -- and those two
> access levels are not equivalent. If you want to view queries from the
> command line, you already have permission to connect to the database
> (since you are allowed to run a terminal and execute the django app  
> and
> read the settings file, so the database access permissions follow).
>
> Also, the query cache is per-request, not forever. So it gets cleaned
> out between web page requests (otherwise you wouldn't just see one or
> two people noticing massive memory usage; we'd all see it after  
> testing
> for an hour or two).
>
> 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
-~--~~~~--~~--~--~---



Re: "no module named admin", webfaction

2006-07-17 Thread Harish Mallipeddi
Hi,Did you enable Admin in the project settings file? You need to enable it before you can start using it. Read the Django documentation to find out more info on this.Cheers,Harish
On 7/18/06, Raman Prasad <[EMAIL PROTECTED]> wrote:
Hi,I have an admin setup question (I think I'm missing a basic step)I have some basic django code running on my laptop (local)which works fine but I'm having trouble moving it to a webfactionaccount.
I used the screencast, etc but I'm getting a "no module named admin"error when tryingto show the admin screen.  http:// . . ./admin/I have the same error at the command line--the trace from the command
line is:Python 2.4 (#1, Jul 24 2005, 05:05:49)>>> import django>>> from django.conf.urls.defaults import *>>> import django.contrib.admin.urls.admin
Traceback (most recent call last):  File "", line 1, in ?ImportError: No module named admin>>>The trace from a webpage is:Traceback (most recent call last):
File "/home2/prasad06511/lib/python2.4/django/core/handlers/base.py"in get_response  65. callback, callback_args, callback_kwargs = resolver.resolve(path)File "/home2/prasad06511/lib/python2.4/django/core/urlresolvers.py"
in resolve  147. sub_match = pattern.resolve(new_path)File "/home2/prasad06511/lib/python2.4/django/core/urlresolvers.py"in resolve  145. for pattern in self.urlconf_module.urlpatterns:
File "/home2/prasad06511/lib/python2.4/django/core/urlresolvers.py"in _get_urlconf_module  163. self._urlconf_module = __import__(self.urlconf_name, '', '',[''])  ImportError at /admin/
  No module named adminThanks for any help!-raman-- Harish Mallipeddihttp://poundbang.in/

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


Re: logged-in user id as default value on ForeignKey relation

2006-07-17 Thread Patrick J. Anderson

Malcolm Tredinnick wrote:
> On Mon, 2006-07-17 at 09:41 -0700, Patrick J. Anderson wrote:
>> Sorry, but would you be able to explain this in detail? I was thinking
>> about acomplishing this in model classes, not in views, so I'm not sure
>> if I understand what you mean.
> 
> You have to pass the information through from a view, though, because
> the models have no concept of "logged in user" or "current user" or
> anything like that: those are view-level concepts. There is no way for a
> model, on its own, to be able to work out which "user" (whatever that
> may mean) is performing the action. There are many ways to access models
> and views are only one way.
> 
> Still, just to prove that nothing is impossible if you're prepared to be
> sufficiently devious: if you were really, really determined to do this,
> you could hook into the pre-save signal on a model, walk back up the
> Python calling stack to the view function (use the tracback module. You
> would need a list somewhere detailing what are the view functions so
> that you knew when had arrived) and then extract the request object from
> the function's locals and look for the user that way. However, if you
> use that method, you are not allowed to ever mention my name as having
> suggested it. I am evil, but I don't want people to know that.
> 
> Regards,
> Malcolm
> 
> 
> > 
> 
Thanks, Malcolm!

Whether I use your method or not, I'll keep your name safe and secret :)


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



Re: ImportError: No module named django

2006-07-17 Thread Malcolm Tredinnick

On Mon, 2006-07-17 at 18:58 -0700, markguy wrote:
> I've got my output at least resembling yours now, thanks to your
> explanation about the difference between URL config and apps.
> 
> I'm using this for urlpatterns:
> ( r'^$' , 'django.views.generic.simple.direct_to_template' , {
> 'template' : 'index.html' } ) ,
> 
> However, there's a new wrinkle. While trying to figure out what I was
> doing/not doing, I wiped the db and rm'd the apps in the project.
> Loading http://127.0.0.1 now says:
> Exception Value:  (1146, "Table 'bbg.django_session' doesn't exist")
> 
> No worries, I thought. I'll just stick a basic app in there and load up
> the tables before carrying on.
> ./manage.py startapp goods
> ./manage.py sql goods
> 
> The second line spits this back:
> django.core.exceptions.ImproperlyConfigured: App with label goods could
> not be found
> 
> There is, to be clear, a /goods directory with all expected files
> sitting in it.

Hint: is it also in your INSTALLED_APPS list? 

Also, you will need to run syncdb again, because the database is telling
you that (not surprisingly) you also nuked a bunch of tables for
Django's other applications (in this case, the Session middleware).

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



Re: ImportError: No module named django

2006-07-17 Thread markguy

Okay, ./manage.py syncdb before ./manage.py sql goods is apparently a
good idea.

So, I've now got a very basic index page loading up as expected.

I'm off for a couple drinks to see if I can wrap my head around how
Django compartmentalizes things and then will endeavor to not bring
many more problems to your attention.

Thanks very much for all the assistance!


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



Re: How to get django to show me the sql it executed recently?

2006-07-17 Thread Malcolm Tredinnick

On Mon, 2006-07-17 at 18:44 -0700, Scott Chapman wrote:
[...]
> p.s. Any chance this could be added to the Admin interface.  It's the 
> intuitive place for such things.

Not a good idea. It's a security hole. You would be able to see every
query people run just because you can log into admin -- and those two
access levels are not equivalent. If you want to view queries from the
command line, you already have permission to connect to the database
(since you are allowed to run a terminal and execute the django app and
read the settings file, so the database access permissions follow).

Also, the query cache is per-request, not forever. So it gets cleaned
out between web page requests (otherwise you wouldn't just see one or
two people noticing massive memory usage; we'd all see it after testing
for an hour or two).

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



Re: ImportError: No module named django

2006-07-17 Thread markguy

I've got my output at least resembling yours now, thanks to your
explanation about the difference between URL config and apps.

I'm using this for urlpatterns:
( r'^$' , 'django.views.generic.simple.direct_to_template' , {
'template' : 'index.html' } ) ,

However, there's a new wrinkle. While trying to figure out what I was
doing/not doing, I wiped the db and rm'd the apps in the project.
Loading http://127.0.0.1 now says:
Exception Value:(1146, "Table 'bbg.django_session' doesn't exist")

No worries, I thought. I'll just stick a basic app in there and load up
the tables before carrying on.
./manage.py startapp goods
./manage.py sql goods

The second line spits this back:
django.core.exceptions.ImproperlyConfigured: App with label goods could
not be found

There is, to be clear, a /goods directory with all expected files
sitting in 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
-~--~~~~--~~--~--~---



How to get django to show me the sql it executed recently?

2006-07-17 Thread Scott Chapman

I recall there's a way to do this but can't remember what it is.  You could do 
something in the shell to get it.  Please help my ailing memory!

Scott
p.s. Any chance this could be added to the Admin interface.  It's the 
intuitive place for such things.


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



Re: logged-in user id as default value on ForeignKey relation

2006-07-17 Thread Malcolm Tredinnick

On Mon, 2006-07-17 at 09:41 -0700, Patrick J. Anderson wrote:
> Sorry, but would you be able to explain this in detail? I was thinking
> about acomplishing this in model classes, not in views, so I'm not sure
> if I understand what you mean.

You have to pass the information through from a view, though, because
the models have no concept of "logged in user" or "current user" or
anything like that: those are view-level concepts. There is no way for a
model, on its own, to be able to work out which "user" (whatever that
may mean) is performing the action. There are many ways to access models
and views are only one way.

Still, just to prove that nothing is impossible if you're prepared to be
sufficiently devious: if you were really, really determined to do this,
you could hook into the pre-save signal on a model, walk back up the
Python calling stack to the view function (use the tracback module. You
would need a list somewhere detailing what are the view functions so
that you knew when had arrived) and then extract the request object from
the function's locals and look for the user that way. However, if you
use that method, you are not allowed to ever mention my name as having
suggested it. I am evil, but I don't want people to know that.

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



Re: ImportError: No module named django

2006-07-17 Thread Malcolm Tredinnick

On Mon, 2006-07-17 at 08:22 -0700, markguy wrote:
> Changing bbg.goods to bbg.goods.url throws the same exception as
> bbg.goods.

So inside your project directory, try something like the following (I am
pasting a terminal session using one of my own projects just to show
what sort of output I see):

.-([EMAIL PROTECTED] 10:40:16) ~/Programming/website
`--> ./manage.py shell

Python 2.4.3 (#1, Jun 13 2006, 11:46:22)
[GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)

>>> from weblog import urls

>>> urls.urlpatterns
[,
,
,
,
,
,
,
]

>>> dir(urls)
['__builtins__', '__doc__', '__file__', '__name__', 'feeds',
'handler404', 'handler500', 'include', 'patterns', 'urlpatterns']

>>>

In this example, my main urls.py file has an include('weblog.urls') line
and the above example shows that I can import weblog.urls correctly and
access the urlpatterns. I suspect you will see some sort of error there.

Best wishes,
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
-~--~~~~--~~--~--~---



Re: ImportError: No module named django

2006-07-17 Thread Malcolm Tredinnick

On Mon, 2006-07-17 at 07:34 -0700, markguy wrote:
> 
> Malcolm Tredinnick wrote:
> 
> > That should be easy enough to diagnose. My initial guess would be that
> > bbg is in django_projects/, rather than django_src/, just from the way
> > you named your directories. Remember that .bash_profile is obviously not
> > going to be run by Apache (it's not bash, after all) and your PYTHONPATH
> > settings there were broader than your mod_python config settings.
> 
> Hrm. bbg is my project and it is in django_projects/ . The tutorial
> suggests you can stick your project directory anywhere you like, with
> the caveat of staying out of docroot. That suggests that I've done
> something silly with the httpd.conf. PYTHONPATH has to include
> /django_src. And I just realized I don't ever see where
> /django_projects is made known to the server, which must be what you
> mean by "broader than your mod_python config settings." So, let me
> toddle off and try to change that.
> 
> >
> > >
> > > I'll investigate on my own, but thanks for editorial wizardry! :)
> > >
> > > re: import django: Yes, it returns literally nothing. I was trying to
> > > establish that I could load django in the shell at least.
> > >
> > > The bbg/urls.py looks like this:
> > > urlpatterns = patterns('',
> > >   ( r'^admin/' , include( 'django.contrib.admin.urls' ) ) ,
> > >   ( r'' , include( 'bbg.goods' ) ) ,
> > > )
> > >
> > > I was trying to tie /bbg to the top level. Is there a better, official
> > > way to do this?
> >
> > I have many questions at this point. Firstly, is it correct to assume
> > your project is called bbg/ ? So bbg.urls is the value of the
> > ROOT_URLCONF setting in your appropriate settings.py?
> 
> Yes, /bbg is project. ROOT_URLCONF = 'bbg.urls', yes.
> 
> > If so, the "include ('bbg.goods')" line looks suspicious. Is "goods.py"
> > a URL configuration file? Or did you mean that to be bbg.goods.url?
> 
> Huh. I was following the example in the tutorial, so while I *thought*
> I meant to use bbg.goods, it may very well be I was mistaken. Tutorial
> shows:
> 
> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'mysite.polls'
> )
> 

The tutorial does indeed say that, for INSTALLED_APPS. But you are
working on your URL configuration, which has nothing to do with this
section. The above are import paths under which Django will look to
import models. The include(...) paths in the URL configuration are
modules to import inside which Django will look for a urlpatterns
variable. They are different.

The examples in [1] might be more useful for you to use as a reference.

[1] http://www.djangoproject.com/documentation/url_dispatch/#id1

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



Re: Disable autoreload to allow single thread debugging

2006-07-17 Thread gjiro

Hi,

Changeset 3348, adds the '--noreload' option for django_admin.py.

"Added command line flag to disable use of auto-reloader on development
server."

Check http://code.djangoproject.com/changeset/3348

gjiro


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



Re: cherokee server and django - fast-cgi/scgi rumble

2006-07-17 Thread [EMAIL PROTECTED]

I'll have to play with it a bit longer. Cherokee isn't that nicely
documented ;) but SCGI works.

Some experiments: http://www.cms.rk.edu.pl/benchmark_scgi.html


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



Re: A few questions from a newbie.

2006-07-17 Thread Scott McCracken

Christian Wattengård wrote:
> 1. What is this SLUG thingy in every sourcecode I read?

In response to your first question, a "slug" is a term taken from the
newspaper industry, but in this case it means the final part of your
URL - a clean and easy was to access your page.

If your blog post was called "Learning Django", then your slug would
probably be "learning-django" and you could access it via your blog at
"http://mydomain.com/blog/learning-django;

The great thing about Django is it makes it easy to populate your slug
from another field. For example:

class Story(models.Model):
title = models.CharField(maxlength=200)
slug = models.SlugField(prepopulate_from=('title',))


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



Re: Graphviz Model Diagrams

2006-07-17 Thread Jeremy Dunck

On 7/17/06, Andrew <[EMAIL PROTECTED]> wrote:
> I started a simple little app to display a Graphviz diagram based off
> the Django models.
>
> It's simple and not so purty, but it's a start.  It also requires
> graphviz to be installed and in the path.

You might a settings option to specify the graphviz path.  Fall back
to assuming it's already there if the setting isn't available.

Sorta like JING_PATH:
http://www.djangoproject.com/documentation/settings/#jing-path

If you're intending for this to be used outside of development, stash
the results of dot generation in cache.  Maybe have a url parm that
invalidates the cache for the rare non-dev model changes.

Anyway, nice.  :)

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



Extending User, inlining in Admin

2006-07-17 Thread pydj

Hi All

I'm having a problem with extending User to include a couple of
additional fields, and allowing them to be edited in the Admin module.
I've followed the debate on
http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model,
and have the following model:

class UserProfile (models.Model):
#user  = models.OneToOneField (User,
edit_inline=models.TABULAR, core=True)
user  = models.ForeignKey (User, core=True,
edit_inline=models.TABULAR, max_num_in_admin=1, min_num_in_admin=1,
num_in_admin=1, num_extra_on_change=0, unique=True)
activeprofile = models.BooleanField ()
banned= models.BooleanField ()
mobile= models.CharField (maxlength=255, blank=True)

If I use OneToOneField, I get 'UserProfile matching query does not
exist.'
If I use ForeignKey, I get no errors, but the UserProfile table never
gets updated

If I enable the UserProfile class in Admin, I can add data manually,
and it links OK. But inlining them just doesn't work.

I'm running the latest svn checkout, with MySQL 5.0.19 on OS X 10.4.7.
The tables are UTF8 MyISAM tables.

Any help would be greatly appreciated.

regards...

Ulf


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



psycopg2

2006-07-17 Thread [EMAIL PROTECTED]

Hi all,

using django 0.9.5 on Windows with Python 2.4 with psycopg2

I'm receiving the following error:

C:\www\myproject>python manage.py sql user
Traceback (most recent call last):
  File "manage.py", line 11, in ?
execute_manager(settings)
  File
"c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core\management.py",
line 1302, in execute_manager
execute_from_command_line(action_mapping, argv)
  File
"c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core\management.py",
line 1258, in execute_from_command_line
from django.db import models
  File
"c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\db\__init__.py",
line 11, in ?
backend = __import__('django.db.backends.%s.base' %
settings.DATABASE_ENGINE, '', '', [''])
  File
"c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\db\backends\postgresql\base.py",
line 12, in ?
raise ImproperlyConfigured, "Error loading psycopg module: %s" % e
django.core.exceptions.ImproperlyConfigured: Error loading psycopg
module: No module named psycopg

though the code reads like this:
from django.db.backends import util
try:
import psycopg2 as Database

Thanks,
Lorenzo


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



Compilation of 30 Django tutorials

2006-07-17 Thread [EMAIL PROTECTED]

Hi all,

I put together a compilation of 30 Django tutorials. They're mostly
from the community page but I think it's nice to have them in a concise
list. I also posted it onto digg so go digg it!

Thanks to all the writers of the tuts. They've been and are really
helpful to me.

Direct link.
http://blixtra.org/blog/2006/07/17/top-30-django-tutorials-and-articles/

Digg link.
http://digg.com/programming/Top_30_Django_Tutorials_and_Articles

The Rails list that spurred me to write it.
http://digg.com/programming/TOP_30_Ruby_on_Rails_Tutorials

Chris


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



Re: Pre-processing Request Info in Generic View Wrapper

2006-07-17 Thread Paul Childs

Of course seconds after the post I ran across this...
http://www.pointy-stick.com/blog/2006/06/29/django-tips-extending-generic-views/
Thanks go out to Malcolm Tredinnick.

and this...
http://code.djangoproject.com/browser/django/trunk/django/views/generic/list_detail.py

Sorry to bother everyone.

Cheers.


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



Pre-processing Request Info in Generic View Wrapper

2006-07-17 Thread Paul Childs

I have written a wrapper around the object_list generic view. I would
like to do some pre-processing before sending the information to the
view.

Here is my wrapper...

##
from django.views.generic.list_detail import object_list

def change_status(*args, **kwargs):

print args

# code happens

return object_list(*args,**kwargs)
##

I did a dump of the args to the console (as seen above) and got this...

##
,
POST:,
COOKIES:{'sessionid': 'f9fa0106252f77a7583dfbe24148c08f'},
META:{'ALLUSERSPROFILE': 'C:\\Documents and Settings\\All Users',
 'APPDATA': 'C:\\Documents and Settings\\Paul\\Application Data',
 'CLASSPATH': 'C:\\Program
Files\\Java\\jre1.5.0_06\\lib\\ext\\QTJava.zip',
 'COMMONPROGRAMFILES': 'C:\\Program Files\\Common Files',
 'COMPUTERNAME': 'Archie',

 # removed for brevity ...

 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}>
##

How do I get access to the POST values without having to resort to
changing the signature of my view? I can see them in the dump but for
the life of me I can't figure out how to get at them.

Am I going about this backwards?

Should I change the view signature to
def change_status(request):
and then build the args? I so, how would I build the args? Something
like this?

return
object_list(request.GET,request.POST,request.COOKIES,request.META,**kwargs)


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



Javascript image preloading problems from tempates

2006-07-17 Thread Iain Duncan

Hello fellow djangoers. I've been doing a gallery site that is too image
heavy for it's own good ( yes, I'm subcontracted by a graphic designer
... ), and am trying to find good ways to control image loading so that
the user will wait and then see all the numerous and large images at the
same time instead of seeing them pop up one at a time. I managed to get
this to work ok on the first page using a javascript loaded in the head
that preloads hard full paths to the images and delays the rest of the
page load until images will be done. However, I can't get the same
things to work properly in the rest of the site when I use dhango
templates to preload. Is there perhaps some weirdness about combing
django templates with javascript preloads that I don't know about? Any
tips on how I should go about this?

The old home page is at:
http://bmg.webfactional.com
The load controlled version that is working is at:
http://bmg.webfactional.com/test
The page that doesn't work the way I want is if you go from the above to
the artists section.

If any one has tips for this javascript newby, many thanks!
Iain

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



Re: cherokee server and django - fast-cgi/scgi rumble

2006-07-17 Thread Ivan Sagalaev

[EMAIL PROTECTED] wrote:
> if settings.APPEND_SLASH and (old_url[1][-1] != '/') and ('.' not
> in old_url[1].split('/')[-1]):
> IndexError: string index out of range
> --
> and in the browse flup shows a simillar bigger... What am I doing
> wrong? :)

The same thing happens in nginx http server. This is because web server 
doesn't pass all the needed environment (query strings, path, etc) to 
your app. In nginx you should pass necessary vars manually:

 fastcgi_param PATH_INFO $fastcgi_script_name;
 fastcgi_param REQUEST_METHOD $request_method;
 fastcgi_param QUERY_STRING $query_string;
 fastcgi_param CONTENT_TYPE $content_type;
 fastcgi_param CONTENT_LENGTH $content_length;
 fastcgi_pass_header Authorization;

All these $vars are nginx specific. Search cherokee docs how these 
values can be accessed.

P.S. First 5 vars are pretty much essential for working with web and 
Authorization is needed if you want to handle HTTP Auth manually in your 
code.

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



Re: user registration

2006-07-17 Thread patrickk

thanks, I did use do_html2python ... but for the wrong manipulator  
(which, of course, is like not using it) ...

patrick

Am 17.07.2006 um 18:30 schrieb Aidas Bendoraitis:

>
> The problem is that you don't use manipulator.do_html2python(new_data)
> which transforms strings to appropriate values.
>
> In your case, you should write something like:
> new_user_data['date_joined'] = datetime.now()
>
> Aidas Bendoraitis [aka Archatas]
>
> On 7/17/06, patrickk <[EMAIL PROTECTED]> wrote:
>>
>> you´re right - I only sent half of the code - will send a full
>> example once I´m finished.
>>
>> I tried to use some of your code:
>> now = datetime.now()
>> new_user_data['date_joined_date'] = now.strftime("%Y-%m-%d")
>> new_user_data['date_joined_time'] = now.strftime("%H:%M:%S")
>>
>> but got the error:
>> combine() argument 1 must be datetime.date, not str
>>
>> any ideas?
>>
>>
>> Am 17.07.2006 um 16:42 schrieb Aidas Bendoraitis:
>>
>>>
>>> It seems that you are missing the escaping/converting of the  got 
>>> (ten)
>>>  values. Don't you need something like
>>> manipulator.do_html2python(new_data) before saving the user? I think
>>> there is a risk of SQL injection[1]  in your example.
>>>
>>> [1] http://en.wikipedia.org/wiki/Sql_injection
>>>
>>> Aidas Bendoraitis [aka Archatas]
>>>
>>>
>>>
>>> On 7/17/06, patrickk <[EMAIL PROTECTED]> wrote:

 here´s the registration I´ve come up with. I´m using a Custom
 Manipulator, because I´ve added some fields to the User Model and
 need specific validation. I´ve also added a confirmation mail:

 def registration(request):

  manipulator = RegistrationManipulator()

  if request.POST:
  new_data = request.POST.copy()
  errors = manipulator.get_validation_errors(new_data)
  if not errors:

 ### Send MAIL
  date= new_data['date_joined_date'] + " " +
 new_data['date_joined_time']
  confirmhash = set_hash(new_data 
 ['password'],
 date)
  link = "http://mysite.com/confirm/?; +
 confirmhash
  content = "something in here" + link
  toMail = new_data['email']
  send_mail('[mysite.com] Registration:
 confirm', content, '[EMAIL PROTECTED]', [toMail],  
 fail_silently=False)

 ### SAVE USER
  pw_hash = set_password(new_data 
 ['password'])
  user = User.objects.create_user(new_data
 ['username'], new_data['email'], pw_hash)
  user.save()
  return HttpResponseRedirect("/")

  else:
  errors = new_data = {}

  ...


 Am 17.07.2006 um 13:35 schrieb Aidas Bendoraitis:

>
> A few weeks ago I browsed through Django core code to get a basic
> understanding how to create a user registration or any other form
> using generic manipulators and how to fill in some values (such as
> last_login) behind the scene.
>
> I was following the guidelines about manipulators at:
> http://www.djangoproject.com/documentation/forms/
>
> To create a user you should do something like that:
>
> def add_profile(request):
> from datetime import datetime
> user_manipulator = User.AddManipulator()
>
> if request.POST:
> new_user_data = request.POST.copy()
>
> # fields that have to be left unmodified
> #new_user_data['username'] = user.username
> new_user_data['password'] = new_password_data
> ['new_password']
> now = datetime.now()
> new_user_data['date_joined_date'] = now.strftime("%Y-%m- 
> %d")
> new_user_data['date_joined_time'] = now.strftime("%H:%M: 
> %S")
> new_user_data['last_login_date'] = "1900-01-01"
> new_user_data['last_login_time'] = "00:00:00"
> new_user_data['is_active'] = 'on'
> new_user_data['is_superuser'] = 'off'
> new_user_data['is_staff'] = 'off'
> user_errors = user_manipulator.get_validation_errors
> (new_user_data)
> if not user_errors:
> user_manipulator.do_html2python(new_user_data)
> user = user_manipulator.save(new_user_data)
> #user = User.objects.create_user(
> #new_user_data['username'],
> #new_user_data['email'],
> #new_user_data['password']
> #)
> user.set_password(new_user_data['password'])
> user.save()
> ...
>
> I hope this will help you. And if somebody has a better  
> solution how
> to manage filling fields with 

Troubles migrating from old server

2006-07-17 Thread Elcio Ferreira

Hi, all,

Excuse my bad english.

I developed an application with Django some time ago. I was using svn
code, rev. 1893.

Now I need to migrate to a new server. On my old server I was using
python 2.3.5 and mod_python 3.1.3. On my new server, with another
ditro, I have python 2.4.2 and mod_python 3.1.3.

I coppied my old django directory to my new server, and it doesn't
work. I got a blank screen. In lynx i got: "Alert!: Unexpected network
read error; connection aborted."

On apache2 error.log i have:
[Mon Jul 17 13:24:14 2006] [notice] mod_python: (Re)importing module
'django.core.handlers.modpython'
[Mon Jul 17 13:24:15 2006] [notice] child pid 10092 exit signal
Segmentation fault (11)
[Mon Jul 17 13:34:25 2006] [notice] mod_python: (Re)importing module
'django.core.handlers.modpython'
[Mon Jul 17 13:34:28 2006] [notice] child pid 10087 exit signal
Segmentation fault (11)
[Mon Jul 17 13:34:37 2006] [notice] mod_python: (Re)importing module
'django.core.handlers.modpython'
[Mon Jul 17 13:34:40 2006] [notice] mod_python: (Re)importing module
'django.core.handlers.modpython'
[Mon Jul 17 13:34:40 2006] [notice] child pid 10089 exit signal
Segmentation fault (11)

If i try to use the ultimate svn code, then django works. But I have a
big project, with a lot of code wrote before the "magic removal"
branch. I think adjusting all my code to work with new django versions
will take a long, long time.

Is there a simple way to put my code to work on my new server? Am I
forgetting something?

Thank you.

-- 

Elcio
http://visie.com.br/
http://elcio.com.br/
http://www.tableless.com.br/

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



cherokee server and django - fast-cgi/scgi rumble

2006-07-17 Thread [EMAIL PROTECTED]

I found a small and nice web server called cherokee which supporst
fast-cgi and scgi and I'm trying to run django on it. Server page:
http://www.0x50.org/

##
SCGI is working
--
1. get djang-scgi.py from here:
https://simon.bofh.ms/cgi-bin/trac-django-projects.cgi/file/stuff/trunk/bin/django-scgi.py
2. put it in a folder where you keep your project
--
Example
/var/www
/var/www/djn <- a django project, put djang-scgi.py in it
--
3. run:
python django-scgi.py --projects=/var/www/ --settings=djn.settings
--host=localhost --port=8080

where djn.settins are the project settings (projectname.settings)
4. edit cherokee.conf and add:
---
Directory / {
   Handler scgi {
  Server localhost:8080
   }
}
---
Where localhost and 8080 is host/port of the running django scgi.
5. start cherokee. It should work. The urls should be the same like
http://localhost/page should work also on cherkokee :) I need to play
with it.
More on scgi here:
http://simon.bofh.ms/cgi-bin/trac-django-projects.cgi/wiki/DjangoScgi
##
##
Fast-CGI - problems here

1. I've added to cherokee.conf:
-
Directory / {
   Handler fcgi {
  Server localhost:8080
   }
}
-
2. from a django project I've run:
python manage.py runfcgi method=threaded host=localhost port=8080
3. I've started cherokee. When I go to http://localhost/test (I have a
working view on /test) i get a big error.

>From terminal:

handler_fcgi.c:118: Traceback (most recent call last):
  File
"/usr/lib/python2.4/site-packages/flup-0.5-py2.4.egg/flup/server/fcgi_base.py",
line 558, in run
protocolStatus, appStatus = self.server.handler(self)
  File
"/usr/lib/python2.4/site-packages/flup-0.5-py2.4.egg/flup/server/fcgi_base.py",
line , in handler
result = self.application(environ, start_response)
  File
"/home/piotr/nowe/python/django_src/django/core/handlers/wsgi.py", line
146, in __call__
response = self.get_response(request.path, request)
  File
"/home/piotr/nowe/python/django_src/django/core/handlers/base.py", line
59, in get_response
response = middleware_method(request)
  File
"/home/piotr/nowe/python/django_src/django/middleware/common.py", line
40, in process_request
if settings.APPEND_SLASH and (old_url[1][-1] != '/') and ('.' not
in old_url[1].split('/')[-1]):
IndexError: string index out of range
--
and in the browse flup shows a simillar bigger... What am I doing
wrong? :)


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



Re: logged-in user id as default value on ForeignKey relation

2006-07-17 Thread Patrick J. Anderson

Sorry, but would you be able to explain this in detail? I was thinking
about acomplishing this in model classes, not in views, so I'm not sure
if I understand what you mean.


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



Re: user registration

2006-07-17 Thread Aidas Bendoraitis

The problem is that you don't use manipulator.do_html2python(new_data)
which transforms strings to appropriate values.

In your case, you should write something like:
new_user_data['date_joined'] = datetime.now()

Aidas Bendoraitis [aka Archatas]

On 7/17/06, patrickk <[EMAIL PROTECTED]> wrote:
>
> you´re right - I only sent half of the code - will send a full
> example once I´m finished.
>
> I tried to use some of your code:
> now = datetime.now()
> new_user_data['date_joined_date'] = now.strftime("%Y-%m-%d")
> new_user_data['date_joined_time'] = now.strftime("%H:%M:%S")
>
> but got the error:
> combine() argument 1 must be datetime.date, not str
>
> any ideas?
>
>
> Am 17.07.2006 um 16:42 schrieb Aidas Bendoraitis:
>
> >
> > It seems that you are missing the escaping/converting of the  got(ten)
> >  values. Don't you need something like
> > manipulator.do_html2python(new_data) before saving the user? I think
> > there is a risk of SQL injection[1]  in your example.
> >
> > [1] http://en.wikipedia.org/wiki/Sql_injection
> >
> > Aidas Bendoraitis [aka Archatas]
> >
> >
> >
> > On 7/17/06, patrickk <[EMAIL PROTECTED]> wrote:
> >>
> >> here´s the registration I´ve come up with. I´m using a Custom
> >> Manipulator, because I´ve added some fields to the User Model and
> >> need specific validation. I´ve also added a confirmation mail:
> >>
> >> def registration(request):
> >>
> >>  manipulator = RegistrationManipulator()
> >>
> >>  if request.POST:
> >>  new_data = request.POST.copy()
> >>  errors = manipulator.get_validation_errors(new_data)
> >>  if not errors:
> >>
> >> ### Send MAIL
> >>  date= new_data['date_joined_date'] + " " +
> >> new_data['date_joined_time']
> >>  confirmhash = set_hash(new_data['password'],
> >> date)
> >>  link = "http://mysite.com/confirm/?; +
> >> confirmhash
> >>  content = "something in here" + link
> >>  toMail = new_data['email']
> >>  send_mail('[mysite.com] Registration:
> >> confirm', content, '[EMAIL PROTECTED]', [toMail], fail_silently=False)
> >>
> >> ### SAVE USER
> >>  pw_hash = set_password(new_data['password'])
> >>  user = User.objects.create_user(new_data
> >> ['username'], new_data['email'], pw_hash)
> >>  user.save()
> >>  return HttpResponseRedirect("/")
> >>
> >>  else:
> >>  errors = new_data = {}
> >>
> >>  ...
> >>
> >>
> >> Am 17.07.2006 um 13:35 schrieb Aidas Bendoraitis:
> >>
> >>>
> >>> A few weeks ago I browsed through Django core code to get a basic
> >>> understanding how to create a user registration or any other form
> >>> using generic manipulators and how to fill in some values (such as
> >>> last_login) behind the scene.
> >>>
> >>> I was following the guidelines about manipulators at:
> >>> http://www.djangoproject.com/documentation/forms/
> >>>
> >>> To create a user you should do something like that:
> >>>
> >>> def add_profile(request):
> >>> from datetime import datetime
> >>> user_manipulator = User.AddManipulator()
> >>>
> >>> if request.POST:
> >>> new_user_data = request.POST.copy()
> >>>
> >>> # fields that have to be left unmodified
> >>> #new_user_data['username'] = user.username
> >>> new_user_data['password'] = new_password_data
> >>> ['new_password']
> >>> now = datetime.now()
> >>> new_user_data['date_joined_date'] = now.strftime("%Y-%m-%d")
> >>> new_user_data['date_joined_time'] = now.strftime("%H:%M:%S")
> >>> new_user_data['last_login_date'] = "1900-01-01"
> >>> new_user_data['last_login_time'] = "00:00:00"
> >>> new_user_data['is_active'] = 'on'
> >>> new_user_data['is_superuser'] = 'off'
> >>> new_user_data['is_staff'] = 'off'
> >>> user_errors = user_manipulator.get_validation_errors
> >>> (new_user_data)
> >>> if not user_errors:
> >>> user_manipulator.do_html2python(new_user_data)
> >>> user = user_manipulator.save(new_user_data)
> >>> #user = User.objects.create_user(
> >>> #new_user_data['username'],
> >>> #new_user_data['email'],
> >>> #new_user_data['password']
> >>> #)
> >>> user.set_password(new_user_data['password'])
> >>> user.save()
> >>> ...
> >>>
> >>> I hope this will help you. And if somebody has a better solution how
> >>> to manage filling fields with values automagically, please share
> >>> that
> >>> wwith everybody.
> >>>
> >>> Good luck!
> >>> Aidas Bendoraitis [aka Archatas]
> >>>
> >>>
> >>> On 7/16/06, patrickk <[EMAIL PROTECTED]> wrote:
> 
>  nice. didn´t see that.
> 
>  Am 15.07.2006 um 

Re: logged-in user id as default value on ForeignKey relation

2006-07-17 Thread Grigory Fateyev

Hello Patrick J. Anderson!
On Mon, 17 Jul 2006 10:25:25 -0500 you wrote:

> 
> In my model I'd like to keep track of who added/updated a particular
> record.
> 
> class Entry(models.Model):
>  ...
>  time_added = models.DateTimeField(auto_now_add = True, editable
> = False)
>  user_added = models.ForeignKey(User, default = ?, editable =
> False) time_updated = models.DateTimeField(auto_now = True, editable
> = False) user_updated = models.ForeignKey(user, default = ?, editable
> = False)
> 
> How could I add a currently logged in (to admin interface) user id 
> automatically as a value for that field? Is it possible to do that 
> without writing extra class methods? Any helpful suggestions or tips
> are appreciated.

In our project we use such constractions, and we have common manipulator
views:
[...]
if obj and obj.createuser:
new_data['createuser'] = obj.createuser.id
new_data['modifyuser'] = str(request.user.id)
else:
new_data['createuser'] = str(request.user.id)
new_data['modifyuser'] = str(request.user.id)
[...]
and fields createuser and modifyuser alwas has data, if create new
object or modify present one.

Hope that helps you.

-- 
÷ÓÅÇÏ ÎÁÉÌÕÞÛÅÇÏ!
greg [at] anastasia [dot] ru çÒÉÇÏÒÉÊ.

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



logged-in user id as default value on ForeignKey relation

2006-07-17 Thread Patrick J. Anderson

In my model I'd like to keep track of who added/updated a particular record.

class Entry(models.Model):
 ...
 time_added = models.DateTimeField(auto_now_add = True, editable = 
False)
 user_added = models.ForeignKey(User, default = ?, editable = False)
 time_updated = models.DateTimeField(auto_now = True, editable = False)
 user_updated = models.ForeignKey(user, default = ?, editable = False)

How could I add a currently logged in (to admin interface) user id 
automatically as a value for that field? Is it possible to do that 
without writing extra class methods? Any helpful suggestions or tips are 
appreciated.


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



Re: Using admin as the user interface

2006-07-17 Thread Akatemik

> i find it is easier to roll your own in a view rather than hack
> admin. Since i use the same django for multiple sites, i like to
> leave django stuff alone as i wouldnt want a separate dajngo for each
> site

Is there an easy way to have admin-like widgets? I'm especially fond of
the collapsing groups and many-to-many selector (basic forms are
trivial to make).


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



Re: user registration

2006-07-17 Thread patrickk

you´re right - I only sent half of the code - will send a full  
example once I´m finished.

I tried to use some of your code:
now = datetime.now()
new_user_data['date_joined_date'] = now.strftime("%Y-%m-%d")
new_user_data['date_joined_time'] = now.strftime("%H:%M:%S")

but got the error:
combine() argument 1 must be datetime.date, not str

any ideas?


Am 17.07.2006 um 16:42 schrieb Aidas Bendoraitis:

>
> It seems that you are missing the escaping/converting of the  got(ten)
>  values. Don't you need something like
> manipulator.do_html2python(new_data) before saving the user? I think
> there is a risk of SQL injection[1]  in your example.
>
> [1] http://en.wikipedia.org/wiki/Sql_injection
>
> Aidas Bendoraitis [aka Archatas]
>
>
>
> On 7/17/06, patrickk <[EMAIL PROTECTED]> wrote:
>>
>> here´s the registration I´ve come up with. I´m using a Custom
>> Manipulator, because I´ve added some fields to the User Model and
>> need specific validation. I´ve also added a confirmation mail:
>>
>> def registration(request):
>>
>>  manipulator = RegistrationManipulator()
>>
>>  if request.POST:
>>  new_data = request.POST.copy()
>>  errors = manipulator.get_validation_errors(new_data)
>>  if not errors:
>>
>> ### Send MAIL
>>  date= new_data['date_joined_date'] + " " +
>> new_data['date_joined_time']
>>  confirmhash = set_hash(new_data['password'],
>> date)
>>  link = "http://mysite.com/confirm/?; +
>> confirmhash
>>  content = "something in here" + link
>>  toMail = new_data['email']
>>  send_mail('[mysite.com] Registration:
>> confirm', content, '[EMAIL PROTECTED]', [toMail], fail_silently=False)
>>
>> ### SAVE USER
>>  pw_hash = set_password(new_data['password'])
>>  user = User.objects.create_user(new_data
>> ['username'], new_data['email'], pw_hash)
>>  user.save()
>>  return HttpResponseRedirect("/")
>>
>>  else:
>>  errors = new_data = {}
>>
>>  ...
>>
>>
>> Am 17.07.2006 um 13:35 schrieb Aidas Bendoraitis:
>>
>>>
>>> A few weeks ago I browsed through Django core code to get a basic
>>> understanding how to create a user registration or any other form
>>> using generic manipulators and how to fill in some values (such as
>>> last_login) behind the scene.
>>>
>>> I was following the guidelines about manipulators at:
>>> http://www.djangoproject.com/documentation/forms/
>>>
>>> To create a user you should do something like that:
>>>
>>> def add_profile(request):
>>> from datetime import datetime
>>> user_manipulator = User.AddManipulator()
>>>
>>> if request.POST:
>>> new_user_data = request.POST.copy()
>>>
>>> # fields that have to be left unmodified
>>> #new_user_data['username'] = user.username
>>> new_user_data['password'] = new_password_data 
>>> ['new_password']
>>> now = datetime.now()
>>> new_user_data['date_joined_date'] = now.strftime("%Y-%m-%d")
>>> new_user_data['date_joined_time'] = now.strftime("%H:%M:%S")
>>> new_user_data['last_login_date'] = "1900-01-01"
>>> new_user_data['last_login_time'] = "00:00:00"
>>> new_user_data['is_active'] = 'on'
>>> new_user_data['is_superuser'] = 'off'
>>> new_user_data['is_staff'] = 'off'
>>> user_errors = user_manipulator.get_validation_errors
>>> (new_user_data)
>>> if not user_errors:
>>> user_manipulator.do_html2python(new_user_data)
>>> user = user_manipulator.save(new_user_data)
>>> #user = User.objects.create_user(
>>> #new_user_data['username'],
>>> #new_user_data['email'],
>>> #new_user_data['password']
>>> #)
>>> user.set_password(new_user_data['password'])
>>> user.save()
>>> ...
>>>
>>> I hope this will help you. And if somebody has a better solution how
>>> to manage filling fields with values automagically, please share  
>>> that
>>> wwith everybody.
>>>
>>> Good luck!
>>> Aidas Bendoraitis [aka Archatas]
>>>
>>>
>>> On 7/16/06, patrickk <[EMAIL PROTECTED]> wrote:

 nice. didn´t see that.

 Am 15.07.2006 um 18:29 schrieb [EMAIL PROTECTED]:

>
> There is:
> http://code.djangoproject.com/wiki/FormField
>
> Chris
>
>
>>


>

>>>

>>
>>
>>>
>>
>
> >


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

Re: Multiple block levels failing?

2006-07-17 Thread Adrian Holovaty

On 7/16/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> The thing is, when I take the level2 block out of the ifequal loop,
> everything works fine. So, it looks to me that it can have only so many
> if's around a block statement or something... Is this a bug or am I
> doing something wrong?

I believe the problem in your case is that you're defining a {% block
%} in a for loop. Blocks aren't meant to be filled multiple times by
multiple child templates -- you can only have one block with a given
name in a given template.

BTW, your {% extends %} lines shouldn't be hard-coding the filesystem
location of the templates -- they should contain the location of the
templates *relative* to your template directory (as specified in
TEMPLATE_DIRS).

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.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
-~--~~~~--~~--~--~---



Re: ImportError: No module named django

2006-07-17 Thread markguy

So, what you were *really* suggesting was that PYTHONPATH should
include the project directory, not the django_src directory? I saw that
while skimming through the docs.

I changed PYTHONPATH to reflect that (apparently, adding both
directories in a fit of crankiness doesn't help matters):

PythonPath  "[ '/home/mark/django_projects' ] + sys.path"

Viewing http://127.0.0.1/ now shows:

Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):

  File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
287, in HandlerDispatch
log=debug)

  File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
454, in import_module
f, p, d = imp.find_module(parts[i], path)

ImportError: No module named django

That suggests that mod_python has lost sight of django. So, clearly I
don't understand how to  setup httpd.conf. :|


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



display_name for FormFields

2006-07-17 Thread Todd O'Bryan

Would anyone object to a patch for FormFields that would allow a (by- 
default None) keyword argument for display_name. Validator error  
messages would be updated to use the display_name if it's defined, or  
the field_name, if not.

I think this would be completely backward-compatible, but would allow  
people to use the default error messages and provide more meaningful  
feedback to users.

If no one objects, I'll get started.

Todd

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



Re: user registration

2006-07-17 Thread Aidas Bendoraitis

It seems that you are missing the escaping/converting of the  got(ten)
 values. Don't you need something like
manipulator.do_html2python(new_data) before saving the user? I think
there is a risk of SQL injection[1]  in your example.

[1] http://en.wikipedia.org/wiki/Sql_injection

Aidas Bendoraitis [aka Archatas]



On 7/17/06, patrickk <[EMAIL PROTECTED]> wrote:
>
> here´s the registration I´ve come up with. I´m using a Custom
> Manipulator, because I´ve added some fields to the User Model and
> need specific validation. I´ve also added a confirmation mail:
>
> def registration(request):
>
>  manipulator = RegistrationManipulator()
>
>  if request.POST:
>  new_data = request.POST.copy()
>  errors = manipulator.get_validation_errors(new_data)
>  if not errors:
>
> ### Send MAIL
>  date= new_data['date_joined_date'] + " " +
> new_data['date_joined_time']
>  confirmhash = set_hash(new_data['password'],
> date)
>  link = "http://mysite.com/confirm/?; +
> confirmhash
>  content = "something in here" + link
>  toMail = new_data['email']
>  send_mail('[mysite.com] Registration:
> confirm', content, '[EMAIL PROTECTED]', [toMail], fail_silently=False)
>
> ### SAVE USER
>  pw_hash = set_password(new_data['password'])
>  user = User.objects.create_user(new_data
> ['username'], new_data['email'], pw_hash)
>  user.save()
>  return HttpResponseRedirect("/")
>
>  else:
>  errors = new_data = {}
>
>  ...
>
>
> Am 17.07.2006 um 13:35 schrieb Aidas Bendoraitis:
>
> >
> > A few weeks ago I browsed through Django core code to get a basic
> > understanding how to create a user registration or any other form
> > using generic manipulators and how to fill in some values (such as
> > last_login) behind the scene.
> >
> > I was following the guidelines about manipulators at:
> > http://www.djangoproject.com/documentation/forms/
> >
> > To create a user you should do something like that:
> >
> > def add_profile(request):
> > from datetime import datetime
> > user_manipulator = User.AddManipulator()
> >
> > if request.POST:
> > new_user_data = request.POST.copy()
> >
> > # fields that have to be left unmodified
> > #new_user_data['username'] = user.username
> > new_user_data['password'] = new_password_data['new_password']
> > now = datetime.now()
> > new_user_data['date_joined_date'] = now.strftime("%Y-%m-%d")
> > new_user_data['date_joined_time'] = now.strftime("%H:%M:%S")
> > new_user_data['last_login_date'] = "1900-01-01"
> > new_user_data['last_login_time'] = "00:00:00"
> > new_user_data['is_active'] = 'on'
> > new_user_data['is_superuser'] = 'off'
> > new_user_data['is_staff'] = 'off'
> > user_errors = user_manipulator.get_validation_errors
> > (new_user_data)
> > if not user_errors:
> > user_manipulator.do_html2python(new_user_data)
> > user = user_manipulator.save(new_user_data)
> > #user = User.objects.create_user(
> > #new_user_data['username'],
> > #new_user_data['email'],
> > #new_user_data['password']
> > #)
> > user.set_password(new_user_data['password'])
> > user.save()
> > ...
> >
> > I hope this will help you. And if somebody has a better solution how
> > to manage filling fields with values automagically, please share that
> > wwith everybody.
> >
> > Good luck!
> > Aidas Bendoraitis [aka Archatas]
> >
> >
> > On 7/16/06, patrickk <[EMAIL PROTECTED]> wrote:
> >>
> >> nice. didn´t see that.
> >>
> >> Am 15.07.2006 um 18:29 schrieb [EMAIL PROTECTED]:
> >>
> >>>
> >>> There is:
> >>> http://code.djangoproject.com/wiki/FormField
> >>>
> >>> Chris
> >>>
> >>>
> 
> >>
> >>
> >>>
> >>
> >
> > >
>
>
> >
>

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



Re: ImportError: No module named django

2006-07-17 Thread markguy


Malcolm Tredinnick wrote:

> That should be easy enough to diagnose. My initial guess would be that
> bbg is in django_projects/, rather than django_src/, just from the way
> you named your directories. Remember that .bash_profile is obviously not
> going to be run by Apache (it's not bash, after all) and your PYTHONPATH
> settings there were broader than your mod_python config settings.

Hrm. bbg is my project and it is in django_projects/ . The tutorial
suggests you can stick your project directory anywhere you like, with
the caveat of staying out of docroot. That suggests that I've done
something silly with the httpd.conf. PYTHONPATH has to include
/django_src. And I just realized I don't ever see where
/django_projects is made known to the server, which must be what you
mean by "broader than your mod_python config settings." So, let me
toddle off and try to change that.

>
> >
> > I'll investigate on my own, but thanks for editorial wizardry! :)
> >
> > re: import django: Yes, it returns literally nothing. I was trying to
> > establish that I could load django in the shell at least.
> >
> > The bbg/urls.py looks like this:
> > urlpatterns = patterns('',
> > ( r'^admin/' , include( 'django.contrib.admin.urls' ) ) ,
> > ( r'' , include( 'bbg.goods' ) ) ,
> > )
> >
> > I was trying to tie /bbg to the top level. Is there a better, official
> > way to do this?
>
> I have many questions at this point. Firstly, is it correct to assume
> your project is called bbg/ ? So bbg.urls is the value of the
> ROOT_URLCONF setting in your appropriate settings.py?

Yes, /bbg is project. ROOT_URLCONF = 'bbg.urls', yes.

> If so, the "include ('bbg.goods')" line looks suspicious. Is "goods.py"
> a URL configuration file? Or did you mean that to be bbg.goods.url?

Huh. I was following the example in the tutorial, so while I *thought*
I meant to use bbg.goods, it may very well be I was mistaken. Tutorial
shows:

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'mysite.polls'
)


> The previous error you posted was saying there was something wrong with
> the construction of your root URL conf (bbg/urls.py, presumably), so
> investigate that file carefully. For example, comment out both lines:
> does runserver start? Can you view http://localhost:8000/ (it will give
> you a pretty error page)? No uncomment the admin line. Rinse, wash,
> repeat.

Commenting both out netted me the "Congrats, it worked" page. Re-adding
the admin spit a 404 back for / and the admin login for /admin.
Commenting admin out and re-adding bbg gives me the same AttributeError
exception. Interestingly, /admin still shows a login, although when I
log in, it dumps the same AttributeError exception.

Once again, thanks for your help!


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



Re: Django and Threading

2006-07-17 Thread Jeremy Dunck

On 7/15/06, David Blewett <[EMAIL PROTECTED]> wrote:
> I'm starting to work on a webmail app in Django. I came across an
> improved version of
> imaplib1 that uses threads for some of the calls to the IMAP server.
> Will this cause
> problems in a Django / mod-python / Apache scenario? Or should I stick
> to plain imaplib?

  I think the answer probably depends on whether there's a way to join
all the threads of the library before the response is completed.
Otherwise, I imagine django processes could be recycled which would
rudely cut off threads.

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



Re: Not sure how to do this (many to many problem)

2006-07-17 Thread Carlos Yoder

> I'd do it the "classic" way.

Thank you Javier, that did it.

Little thing remains though. My admin console for a Car is quite
large, and it's organized neatly using Admin.fields. However, the
SpecialPrices table (linked here using edit_inline=True), always
appear at the end of the page.

Do you know of a way to configure and alter this behaviour?

Mil gracias,


-- 
Carlos Yoder
http://carlitosyoder.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
-~--~~~~--~~--~--~---



Re: user registration

2006-07-17 Thread patrickk

here´s the registration I´ve come up with. I´m using a Custom  
Manipulator, because I´ve added some fields to the User Model and  
need specific validation. I´ve also added a confirmation mail:

def registration(request):

 manipulator = RegistrationManipulator()

 if request.POST:
 new_data = request.POST.copy()
 errors = manipulator.get_validation_errors(new_data)
 if not errors:

### Send MAIL
 date= new_data['date_joined_date'] + " " +  
new_data['date_joined_time']
 confirmhash = set_hash(new_data['password'],  
date)
 link = "http://mysite.com/confirm/?; +  
confirmhash
 content = "something in here" + link
 toMail = new_data['email']
 send_mail('[mysite.com] Registration:  
confirm', content, '[EMAIL PROTECTED]', [toMail], fail_silently=False)

### SAVE USER
 pw_hash = set_password(new_data['password'])
 user = User.objects.create_user(new_data 
['username'], new_data['email'], pw_hash)
 user.save()
 return HttpResponseRedirect("/")

 else:
 errors = new_data = {}

 ...


Am 17.07.2006 um 13:35 schrieb Aidas Bendoraitis:

>
> A few weeks ago I browsed through Django core code to get a basic
> understanding how to create a user registration or any other form
> using generic manipulators and how to fill in some values (such as
> last_login) behind the scene.
>
> I was following the guidelines about manipulators at:
> http://www.djangoproject.com/documentation/forms/
>
> To create a user you should do something like that:
>
> def add_profile(request):
> from datetime import datetime
> user_manipulator = User.AddManipulator()
>
> if request.POST:
> new_user_data = request.POST.copy()
>
> # fields that have to be left unmodified
> #new_user_data['username'] = user.username
> new_user_data['password'] = new_password_data['new_password']
> now = datetime.now()
> new_user_data['date_joined_date'] = now.strftime("%Y-%m-%d")
> new_user_data['date_joined_time'] = now.strftime("%H:%M:%S")
> new_user_data['last_login_date'] = "1900-01-01"
> new_user_data['last_login_time'] = "00:00:00"
> new_user_data['is_active'] = 'on'
> new_user_data['is_superuser'] = 'off'
> new_user_data['is_staff'] = 'off'
> user_errors = user_manipulator.get_validation_errors 
> (new_user_data)
> if not user_errors:
> user_manipulator.do_html2python(new_user_data)
> user = user_manipulator.save(new_user_data)
> #user = User.objects.create_user(
> #new_user_data['username'],
> #new_user_data['email'],
> #new_user_data['password']
> #)
> user.set_password(new_user_data['password'])
> user.save()
> ...
>
> I hope this will help you. And if somebody has a better solution how
> to manage filling fields with values automagically, please share that
> wwith everybody.
>
> Good luck!
> Aidas Bendoraitis [aka Archatas]
>
>
> On 7/16/06, patrickk <[EMAIL PROTECTED]> wrote:
>>
>> nice. didn´t see that.
>>
>> Am 15.07.2006 um 18:29 schrieb [EMAIL PROTECTED]:
>>
>>>
>>> There is:
>>> http://code.djangoproject.com/wiki/FormField
>>>
>>> Chris
>>>
>>>

>>
>>
>>>
>>
>
> >


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



Re: Not sure how to do this (many to many problem)

2006-07-17 Thread Javier Rivera

Carlos Yoder escribió:
> The problem is, I don't know how to do this in Django. I tried doing:

Well, I'm new to django, but I don't believe that the ManytoMany field 
could be used this way. It can for sure relate both tables (user and 
car), but I don't know how to add a third value.

I'd do it the "classic" way.

  class Car(models.Model):
  #...

  class SpecialPrice(models.Model):
""" A price for a special user (company)"""
user= models.ForeignKey(User)
car = models.ForeignKey(Car)
special_price = models.FloatField("Custom Price", max_digits=9,
  decimal_places=2)

But maybe there is some better way.

> Mil gracias,

De nada ;).

Javier.


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



Re: Registration Form - Manipulators

2006-07-17 Thread Aidas Bendoraitis

What I do to create a view that includes both -- the User and the
UserProfile -- is following the documentation of forms and
manipulators
http://www.djangoproject.com/documentation/forms/
and writing something like this:

def add_profile(request):
from datetime import datetime
user_manipulator = User.AddManipulator()
profile_manipulator = UserProfile.AddManipulator()
if request.POST:
new_user_data = request.POST.copy()
new_profile_data = request.POST.copy()
new_profile_data.update(request.FILES) # if you are using any
file uploads...
now = datetime.now()
new_user_data['date_joined_date'] = now.strftime("%Y-%m-%d")
new_user_data['date_joined_time'] = now.strftime("%H:%M:%S")
new_user_data['last_login_date'] = "1900-01-01"
new_user_data['last_login_time'] = "00:00:00"
new_user_data['is_active'] = 'on'
new_user_data['is_superuser'] = 'off'
new_user_data['is_staff'] = 'off'
new_profile_data['user'] = 1 # temporary, just for validation
user_errors = user_manipulator.get_validation_errors(new_user_data)
profile_errors =
profile_manipulator.get_validation_errors(new_profile_data)
if not user_errors and not profile_errors:
user_manipulator.do_html2python(new_user_data)
user = user_manipulator.save(new_user_data)
#user = User.objects.create_user(
#new_user_data['username'],
#new_user_data['email'],
#new_user_data['password']
#)
user.set_password(new_user_data['password'])
user.save()

new_profile_data['user'] = user.id
profile_manipulator.do_html2python(new_profile_data)
profile = profile_manipulator.save(new_profile_data)
...

I hope this will be helpful to you.

Good luck!
Aidas Bendoraitis [aka Archatas]

On 7/17/06, spako <[EMAIL PROTECTED]> wrote:
>
> Hi
>
> i'm using django's built in User for web registered users, to add extra
> fields to these users i've created a UserProfile model and linked it to
> User using a OneToOneField.
>
> Now when someone goes to the site to register I want them to see a form
> with fields from User and some from UserProfile. I'm looking into using
> custom/generic manipulators to do this, i'd like to know if there is a
> certain method of doing this or if anyone else has done this before?
>
>
> >
>

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



Re: ImportError: No module named django

2006-07-17 Thread Malcolm Tredinnick

On Mon, 2006-07-17 at 04:43 -0700, markguy wrote:
> I'm covering all the bases. Or trying to.
> 
> re: django_source: Wow. Uh, thanks. I have no idea why I typed that out
> fully in httpd.conf. Fixing that leads to a new error:
> 
> EnvironmentError: Could not import settings 'bbg.settings' (Is it on
> sys.path? Does it have syntax errors?): No module named bbg.settings

That should be easy enough to diagnose. My initial guess would be that
bbg is in django_projects/, rather than django_src/, just from the way
you named your directories. Remember that .bash_profile is obviously not
going to be run by Apache (it's not bash, after all) and your PYTHONPATH
settings there were broader than your mod_python config settings.

> 
> I'll investigate on my own, but thanks for editorial wizardry! :)
> 
> re: import django: Yes, it returns literally nothing. I was trying to
> establish that I could load django in the shell at least.
> 
> The bbg/urls.py looks like this:
> urlpatterns = patterns('',
>   ( r'^admin/' , include( 'django.contrib.admin.urls' ) ) ,
>   ( r'' , include( 'bbg.goods' ) ) ,
> )
> 
> I was trying to tie /bbg to the top level. Is there a better, official
> way to do this?

I have many questions at this point. Firstly, is it correct to assume
your project is called bbg/ ? So bbg.urls is the value of the
ROOT_URLCONF setting in your appropriate settings.py?

If so, the "include ('bbg.goods')" line looks suspicious. Is "goods.py"
a URL configuration file? Or did you mean that to be bbg.goods.url?

The previous error you posted was saying there was something wrong with
the construction of your root URL conf (bbg/urls.py, presumably), so
investigate that file carefully. For example, comment out both lines:
does runserver start? Can you view http://localhost:8000/ (it will give
you a pretty error page)? No uncomment the admin line. Rinse, wash,
repeat.

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



Re: Not sure how to do this (many to many problem)

2006-07-17 Thread Carlos Yoder

I guess I found a lead at tests\modeltests\m2m_intermediary\

if anyone knows if that's correct (or wrong as hell), please let me know :-)



On 7/17/06, Carlos Yoder <[EMAIL PROTECTED]> wrote:
> Hello!
>
> I'm building a sort of b2b app that lists a car catalogue. A car can
> have multiple 'special prices', linked to groups of wholesalers. So
> when wholesaler W logs into the app, he should  see a 'special price
> just for you' control, displaying the proper price.
>
> In a custom app I'd have a 'modified' m2m relationship, sort of like this:
>
> SpecialPrices
> idCars (int FK)
> idWholesalers (int FK)
> Price (float)
>
> The problem is, I don't know how to do this in Django. I tried doing:
>
> class SpecialPrice(models.Model):
> """ A price for a special user (company)"""
> user= models.ForeignKey(User)
> special_price = models.FloatField("Custom Price", max_digits=9,
> decimal_places=2)
>
> class Car(models.Model):
> #...
> special_prices = models.ManyToManyField(SpecialPrice,
> filter_interface=models.HORIZONTAL)
>
>
> ... but that's not what I mean. I need the special prices to be unique
> to Car and Wholesaler.
>
>
> Could anyone be so kind as to shed some light on how to do this, the Django 
> way?
>
> Mil gracias,
>
> --
> Carlos Yoder
> http://carlitosyoder.blogspot.com
>


-- 
Carlos Yoder
http://carlitosyoder.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
-~--~~~~--~~--~--~---



Re: ImportError: No module named django

2006-07-17 Thread markguy

I'm covering all the bases. Or trying to.

re: django_source: Wow. Uh, thanks. I have no idea why I typed that out
fully in httpd.conf. Fixing that leads to a new error:

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

I'll investigate on my own, but thanks for editorial wizardry! :)

re: import django: Yes, it returns literally nothing. I was trying to
establish that I could load django in the shell at least.

The bbg/urls.py looks like this:
urlpatterns = patterns('',
( r'^admin/' , include( 'django.contrib.admin.urls' ) ) ,
( r'' , include( 'bbg.goods' ) ) ,
)

I was trying to tie /bbg to the top level. Is there a better, official
way to do this?

Thanks for the 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
-~--~~~~--~~--~--~---



Re: user registration

2006-07-17 Thread Aidas Bendoraitis

A few weeks ago I browsed through Django core code to get a basic
understanding how to create a user registration or any other form
using generic manipulators and how to fill in some values (such as
last_login) behind the scene.

I was following the guidelines about manipulators at:
http://www.djangoproject.com/documentation/forms/

To create a user you should do something like that:

def add_profile(request):
from datetime import datetime
user_manipulator = User.AddManipulator()

if request.POST:
new_user_data = request.POST.copy()

# fields that have to be left unmodified
#new_user_data['username'] = user.username
new_user_data['password'] = new_password_data['new_password']
now = datetime.now()
new_user_data['date_joined_date'] = now.strftime("%Y-%m-%d")
new_user_data['date_joined_time'] = now.strftime("%H:%M:%S")
new_user_data['last_login_date'] = "1900-01-01"
new_user_data['last_login_time'] = "00:00:00"
new_user_data['is_active'] = 'on'
new_user_data['is_superuser'] = 'off'
new_user_data['is_staff'] = 'off'
user_errors = user_manipulator.get_validation_errors(new_user_data)
if not user_errors:
user_manipulator.do_html2python(new_user_data)
user = user_manipulator.save(new_user_data)
#user = User.objects.create_user(
#new_user_data['username'],
#new_user_data['email'],
#new_user_data['password']
#)
user.set_password(new_user_data['password'])
user.save()
...

I hope this will help you. And if somebody has a better solution how
to manage filling fields with values automagically, please share that
wwith everybody.

Good luck!
Aidas Bendoraitis [aka Archatas]


On 7/16/06, patrickk <[EMAIL PROTECTED]> wrote:
>
> nice. didn´t see that.
>
> Am 15.07.2006 um 18:29 schrieb [EMAIL PROTECTED]:
>
> >
> > There is:
> > http://code.djangoproject.com/wiki/FormField
> >
> > Chris
> >
> >
> > >
>
>
> >
>

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



Not sure how to do this (many to many problem)

2006-07-17 Thread Carlos Yoder

Hello!

I'm building a sort of b2b app that lists a car catalogue. A car can
have multiple 'special prices', linked to groups of wholesalers. So
when wholesaler W logs into the app, he should  see a 'special price
just for you' control, displaying the proper price.

In a custom app I'd have a 'modified' m2m relationship, sort of like this:

SpecialPrices
idCars (int FK)
idWholesalers (int FK)
Price (float)

The problem is, I don't know how to do this in Django. I tried doing:

class SpecialPrice(models.Model):
""" A price for a special user (company)"""
user= models.ForeignKey(User)
special_price = models.FloatField("Custom Price", max_digits=9,
decimal_places=2)

class Car(models.Model):
#...
special_prices = models.ManyToManyField(SpecialPrice,
filter_interface=models.HORIZONTAL)


... but that's not what I mean. I need the special prices to be unique
to Car and Wholesaler.


Could anyone be so kind as to shed some light on how to do this, the Django way?

Mil gracias,

-- 
Carlos Yoder
http://carlitosyoder.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
-~--~~~~--~~--~--~---



Registration Form - Manipulators

2006-07-17 Thread spako

Hi

i'm using django's built in User for web registered users, to add extra
fields to these users i've created a UserProfile model and linked it to
User using a OneToOneField.

Now when someone goes to the site to register I want them to see a form
with fields from User and some from UserProfile. I'm looking into using
custom/generic manipulators to do this, i'd like to know if there is a
certain method of doing this or if anyone else has done this before?


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



Re: ImportError: No module named django

2006-07-17 Thread Malcolm Tredinnick

On Mon, 2006-07-17 at 03:57 -0700, markguy wrote:
> I have poked around looking for an answer to this and none of the
> suggestions/fixes I found did the trick.
> 
> Ubuntu 6.06/Python
> 2.4.3/Apache2.0.55/mod_python3.1.4/mySQL5.0.22/Django0.95
> 
> Relevant bits to follow
> httpd.conf:
> 
>   SetHandler  mod_python
>   PythonHandler   django.core.handlers.modpython
>   SetEnv  DJANGO_SETTINGS_MODULE  bbg.settings
>   PythonPath  "['/home/mark/django_source/'] + sys.path"
>   PythonDebug On
> 

This isn't relevant for anything you subsequently posted. Are you just
covering all bases or are you trying to work out a mod_python problem? 

Also, if you have cut-and-pasted here, then you have spelt the final
directory "django_source" in the above, but "django_src" everywhere else
in your email. You'd be amazed at how much that sort of typo can screw
up your day.

> .bash_profile (although weirdly, I have to source this after I boot up
> the box to be able to get them to echo):
> export PATH=$PATH:$HOME/django_src/django/bin
> export PYTHONPATH=$PYTHONPATH:$HOME/django_src:$HOME/django_projects
> 
> python shell:
> >>import sys
> >>sys.path
> 
> returns:
> ['', '/etc/apache2', '/home/mark/django_src',
> '/home/mark/django_projects', '/usr/lib/python24.zip',
> '/usr/lib/python2.4', '/usr/lib/python2.4/plat-linux2',
> '/usr/lib/python2.4/lib-tk', '/usr/lib/python2.4/lib-dynload',
> '/usr/local/lib/python2.4/site-packages',
> '/usr/lib/python2.4/site-packages',
> '/usr/lib/python2.4/site-packages/HTMLgen',
> '/usr/lib/python2.4/site-packages/Numeric',
> '/usr/lib/python2.4/site-packages/PIL',
> '/usr/lib/python2.4/site-packages/cairo',
> '/usr/lib/python2.4/site-packages/gst-0.10',
> '/usr/lib/python2.4/site-packages/gtk-2.0']
> 
> >>import django
> returns nothing.

Do you mean it literally returns nothing, or it returns an error? If it
returns nothing that means it worked.

> 
> I can run the server from ./manage.py runserver ... err, actually, I
> can't. I could last night!
> Request URL:  http://127.0.0.1:8000/
> Exception Type:   AttributeError
> Exception Value:  'module' object has no attribute 'urlpatterns'
> Exception Location:   /home/mark/django_src/django/core/urlresolvers.py
> in resolve, line 145

It sounds like your URL configuration file is missing the "urlpatterns"
variable. Is your urls.py file correctly set up?

If your problem is just the final exception, check your URL
configuration. If that isn't the only problem you're seeing, can you
clarify?

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



Re: Everyone should read the tests directory (was Re: Loose coupling of objects.)

2006-07-17 Thread Malcolm Tredinnick

On Mon, 2006-07-17 at 10:57 +, Paul wrote:
> 
> [EMAIL PROTECTED] wrote:
> > The core version was built using Luke Plant's work and Ian Holsman's
> > work, kind of the best of both worlds.
> 
> Yeah, once I started looking at the code I saw the commit logs that
> said the same thing. Good to see things growing that quickly.
> 
> It's nice to think I was having ideas about solving it in a similar
> way. I must be starting to think Django, but I'd have had no clue about
> implementing it
> 
> Can I just say thanks again to Malcolm for pointing me at the unit
> tests. 

You're welcome. :-)

> I'd never realized they were there and they're a great resource
> for learning how to use particular features, especially in the database
> API. A number of things which don't appear to be documented in the
> normal documentation have tests with good explanations as to how they
> work.

The tests are used to generate the examples on the Django website:
http://www.djangoproject.com/documentation/models/ . There is one line
in the model-api.txt file that points you to them, too (since they are
on the website, but otherwise hidden in the distribution). However, it
wouldn't be too hard to miss that reference if you were in a rush.

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



Re: Filter on count of ManyToManyField

2006-07-17 Thread Carlos Yoder

I had a similar problem, and just used custom SQL. It's easy:


from django.db import connection
cursor = connection.cursor()
cursor.execute("""
SELECT cars_model.id, cars_model.opis,
cars_znamka.id, cars_znamka.opis,
COUNT(*)
FROM cars_model, cars_vozilo, cars_znamka
WHERE cars_model.id=cars_vozilo.model_id
AND cars_znamka.id = cars_model.znamka_id
GROUP BY cars_model.id, cars_model.opis, cars_znamka.id, 
cars_znamka.opis
HAVING COUNT(*)>0
""")
result_list = []
for row in cursor.fetchall():
# create the dictionary object, that you'll pass to your 
template.
 dict_obj = {
"id" : row[0],
"opis" : "%s %s" % (row[3], row[1]),
"cars_count":row[4]
 }
 result_list.append(dict_obj)

# template expects "model_list"
model_list = result_list


Hope this helps,

Carlos

On 7/16/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi.
>
> This is probably trivial, but I've not managed to find the solution.
> How do I filter objects based on the count of a ManyToManyField?
>
> My example:
>
> I have two classes -- Blog and Submission:
>
> class Blog( models.Model ):
> entries = models.ManyToManyField( Submission )
>
> class Submission( models.Model ):
>   [... whatever ]
>
> I want to fetch a list of all Blog instances which have at least one
> Submission , i.e. entries.count() > 0. Changing the model is not an
> option.
>
> I've been trying all kinds of permutations of filter, entries, count,
> gt, etc, such as:
> Blog.objects.filter(entries__count__gt = 0)
>
> No luck so far.
>
> Can somebody please help me?
>
> Thanks,
> Daniel
>
>
> >
>


-- 
Carlos Yoder
http://carlitosyoder.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
-~--~~~~--~~--~--~---



Everyone should read the tests directory (was Re: Loose coupling of objects.)

2006-07-17 Thread Paul


[EMAIL PROTECTED] wrote:
> The core version was built using Luke Plant's work and Ian Holsman's
> work, kind of the best of both worlds.

Yeah, once I started looking at the code I saw the commit logs that
said the same thing. Good to see things growing that quickly.

It's nice to think I was having ideas about solving it in a similar
way. I must be starting to think Django, but I'd have had no clue about
implementing it

Can I just say thanks again to Malcolm for pointing me at the unit
tests. I'd never realized they were there and they're a great resource
for learning how to use particular features, especially in the database
API. A number of things which don't appear to be documented in the
normal documentation have tests with good explanations as to how they
work.

I've worked out how to do a number of things I was unclear on from
looking at those.

http://code.djangoproject.com/browser/django/trunk/tests/


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



Velicity Von Titfuck

2006-07-17 Thread carlito556

Velicity Von Titfuck

at http://www.rosapink.net

Tell your friends it's free !!


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



ifequal template problem

2006-07-17 Thread Carlos Yoder

Hello there,

I'm using a object_detail generic view to display some data. One of
the object's fields is an IntegerField, with choices limited to
MONTHS, a tuple of tuples mapping the values.

Now, on the template I want to expand the stored values to the
'human_readable' val, using somehting like:


Prva registracija:

{% for data in MONTHS.items %}
{% ifequal data.0 object.prva_registracija_mm %}
{{ data.1 }}
{% else%}
debug: {{ data.0}} is not equal to {{ 
object.prva_registracija_mm }} 
{% endifequal %}
{% endfor %}
{{ object.prva_registracija_mm}}.{{ object.prva_registracija_}}


The dictionary arrives correctly at the template via this code:

(r'^(?P\d+)/$',
'django.views.generic.list_detail.object_detail',
dict(info_dict, extra_context={'MONTHS': dict(MONTHS) })),

...and everything seems to be fine. When I run the template on the
browser, the stored value (an integer 2) never matches what I suppose
is a string '2'.

How should I convert this to same datatypes? I'm sure this is a very
common task (expanding admin choices), isn't it?

Best regards and big thanks,

-- 
Carlos Yoder
http://carlitosyoder.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
-~--~~~~--~~--~--~---



Re: Web Developer Training

2006-07-17 Thread Kenneth Gonsalves


On 17-Jul-06, at 8:03 AM, Leon wrote:

> i meant non-programmers as in people who are programming literate, but
> don't consider themselves the programmer or spend their life in code

that would be an edge case, but unless they are willing to spend some  
of their life in code, django will not be of much use to them

-- 

regards
kg
http://lawgon.livejournal.com
http://avsap.org.in



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



Re: How to use lighttpd error-handler-404 handler to serve django?

2006-07-17 Thread wlt008

thank u. In lighttpd, it is difficult to use conditional statments
combined with  url rewrite.
So my solution is do a hack on django. Just use a monkey patch on
xxx.fcgi(the fast cgi handler) in order to make error-handler-404 work:
Below is my django.fcgi:

--- django.fcgi -
#!/usr/bin/python
import sys, os

# Add a custom Python path.
cwd = os.getcwd()
sys.path.insert(0, cwd)

# Switch to the directory of your project. (Optional.)
os.chdir(cwd)

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

# start monkey patch
from django.core.handlers.wsgi import WSGIHandler
WSGIHandler_old__call__ = WSGIHandler.__call__
def WSGIHandler_proxy__call__(self, environ, start_response):
if environ['PATH_INFO'] == '':
environ['PATH_INFO'] = environ['REQUEST_URI']
return WSGIHandler_old__call__(self, environ, start_response)
WSGIHandler.__call__ = WSGIHandler_proxy__call__
# end monkey patch

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


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