Re: Calling model-functions in template

2006-12-03 Thread Ivan Sagalaev

Kai Kuehne wrote:
> models.py:
> def genres_title_list(self, separator=', '):
> return separator.join([x.title for x in self.genres])

If I reconstruct the case correctly and `genres` is a relation to child 
objects with ForeignKey to a Movie then `self.genres` by default should 
look like `self.genre_set.all()`. Otherwise it will raise an exception 
(because there is no `self.genres`) and the template system won't show 
anything there.

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



Re: Calling model-functions in template

2006-12-03 Thread Kai Kuehne

Hi,

On 12/3/06, Ivan Sagalaev <[EMAIL PROTECTED]> wrote:
> Kai Kuehne wrote:
> [model.py]
>
> If I reconstruct the case correctly and `genres` is a relation to child
> objects with ForeignKey to a Movie then `self.genres` by default should
> look like `self.genre_set.all()`. Otherwise it will raise an exception
> (because there is no `self.genres`) and the template system won't show
> anything there.

No no, this is ok. I have tested it in the shell.

Greetings
Kai

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



Right way to use this ForeignKey

2006-12-03 Thread phess

I'm stuck at what I think should have been one of the easiest steps of
building my magazines website: the models. :(
I really feel stupid for that, so please tell me the right way to do
this.

This is what I have: Magazines, with many Issues each, and articles,
which belong to only one Magazine, and therefore should only be allowed
to belong to the chosen Magazine's Issues.

myproj/myapp/models.py:

class Magazine(models.Model):
   ...
   name = models.CharField(...)

class Issue(models.Model):
   ...
   magazine = models.ForeignKey(Magazine)
   ...

class Article(models.Model):
   ...
   magazine = models.ForeignKey(Magazine)
   # Now I want to force the displaying of only the Issues that have
   # this same Magazine as their ForeignKey relation.
   # This is how I'm trying to do this:
   issue = models.ForeignKey(Issue,
limit_choices_to{'magazine__id__eq': magazine.id})

Django tells me that ForeignKey fields have no id attribute. Ok, I knew
that already, but there's *got* to be some way of limiting the choice
of issues to the ones that belong to the same Magazine the user chose.

So, my question here would be:
How can I access the attributes of a ForeignKey "target" when building
my model?

If this is not possible in the model definition steps, then how do I do
this limiting in the Admin page?

Any hint would be great.


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



Re: Right way to use this ForeignKey

2006-12-03 Thread Todd O'Bryan

So an article can be in more than one issue of a magazine?

My guess is that each article only appears in one issue. If that's the
case, you should only have the issue as a foreign key. The problem there
is that you may be annoyed that the issue is something like "June 2004".
Just override the issue's __str__() method to include the name of the
magazine that it should have as a foreign key in its string
representation and you should be able to see what's what.

Todd

On Sun, 2006-12-03 at 06:56 -0800, phess wrote:
> I'm stuck at what I think should have been one of the easiest steps of
> building my magazines website: the models. :(
> I really feel stupid for that, so please tell me the right way to do
> this.
> 
> This is what I have: Magazines, with many Issues each, and articles,
> which belong to only one Magazine, and therefore should only be allowed
> to belong to the chosen Magazine's Issues.
> 
> myproj/myapp/models.py:
> 
> class Magazine(models.Model):
>...
>name = models.CharField(...)
> 
> class Issue(models.Model):
>...
>magazine = models.ForeignKey(Magazine)
>...
> 
> class Article(models.Model):
>...
>magazine = models.ForeignKey(Magazine)
># Now I want to force the displaying of only the Issues that have
># this same Magazine as their ForeignKey relation.
># This is how I'm trying to do this:
>issue = models.ForeignKey(Issue,
> limit_choices_to{'magazine__id__eq': magazine.id})
> 
> Django tells me that ForeignKey fields have no id attribute. Ok, I knew
> that already, but there's *got* to be some way of limiting the choice
> of issues to the ones that belong to the same Magazine the user chose.
> 
> So, my question here would be:
> How can I access the attributes of a ForeignKey "target" when building
> my model?
> 
> If this is not possible in the model definition steps, then how do I do
> this limiting in the Admin page?
> 
> Any hint would be great.
> 
> 
> > 

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



Re: Right way to use this ForeignKey

2006-12-03 Thread phess

> So an article can be in more than one issue of a magazine?

Not at all. The Article belongs to only one Issue, which is what I want
the ForeignKey to mean.
I just want to limit the choices of Issues to the ones that make sense,
i.e. to the Issues that belong to the chosen Magazine.


> Just override the issue's __str__() method to include the name of the
> magazine that it should have as a foreign key in its string
> representation and you should be able to see what's what.

Yes, I'm already doing that, although I didn't show it. The issue's
__str__() returns '%s-%s' %(magazine, number)

Phess


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



Re: Right way to use this ForeignKey

2006-12-03 Thread Todd O'Bryan

If an issue belongs to only one magazine and an article belongs to only
one issue, then including both the magazine and the issue in the article
model is redundant, so if you can avoid it, I would.

On the other hand, I see your point that being able to quickly find the
right issue when you have every issue from every magazine as a choice
could be problematic. It'd be very hard to do in the admin, because you
want to limit the choices of issue to those that share the same
magazine. Unfortunately, when you create an article, it doesn't have a
magazine or an issue, so you can set the magazine, but the admin site
won't automatically update the issue choices for you, it will just
validate to make sure that you haven't picked an issue from a different
magazine than you picked. (As I said, redundancy which could lead to
problems.)

Is this something end users will need to get at? If so, I wouldn't
depend on the admin interface and would write my own view that would
allow someone to pick a magazine and then have another drop-down
(possibly updated using Ajax) that would be limited to its issues. When
you read the form, ignore the magazine and just record the issue.

If it's just you, add an ordering to issues that sorts by magazines and
dates (or whatever) and you can type the first few characters of the
magazine name to find yourself in the right general area.

Todd

On Sun, 2006-12-03 at 07:11 -0800, phess wrote:
> > So an article can be in more than one issue of a magazine?
> 
> Not at all. The Article belongs to only one Issue, which is what I want
> the ForeignKey to mean.
> I just want to limit the choices of Issues to the ones that make sense,
> i.e. to the Issues that belong to the chosen Magazine.
> 
> 
> > Just override the issue's __str__() method to include the name of the
> > magazine that it should have as a foreign key in its string
> > representation and you should be able to see what's what.
> 
> Yes, I'm already doing that, although I didn't show it. The issue's
> __str__() returns '%s-%s' %(magazine, number)
> 
> Phess


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



Re: Right way to use this ForeignKey

2006-12-03 Thread phess

Right, thanks a lot, Todd.
I guess I'm not *that* stupid after all... :) Phew! :D

I think I was actually using the wrong approach to building the
magazines. I mean, they should have been separate apps from the start.
Or else, every freaking article will be in a huge database table that
also houses articles from the other magazines. I think this is just
wrong.
The same would happen to sections: a long table of sections that aren't
really related to each other, because each of them belongs to a
different magazine.

By separating magazines into different apps, I get everything I wanted:
- separate database tables for each magazine
- the user chooses the magazine, and only the valid issues and sections
appear on the list


Anyway, as a reply to your last (extremely helpful) msg:

> If an issue belongs to only one magazine and an article belongs to only
> one issue, then including both the magazine and the issue in the article
> model is redundant, so if you can avoid it, I would.

The thing is, when I put in an article, I might not have its section
yet. Yes, I know, this is annoyingly complex and boring...

> Is this something end users will need to get at? If so, I wouldn't
> depend on the admin interface and would write my own view that would
> allow someone to pick a magazine and then have another drop-down
> (possibly updated using Ajax) that would be limited to its issues. When
> you read the form, ignore the magazine and just record the issue.

Yes, end users (the writing team) will use this Admin interface.
Emphasizing on the "with deadlines" part of Django's motto, I have to
be *really* *really* quick with this website. ;) So, no custom views
at this moment.

> If it's just you, add an ordering to issues that sorts by magazines and
> dates (or whatever) and you can type the first few characters of the
> magazine name to find yourself in the right general area.

That's what I'd been using, but it felt plain wrong.

Once again, thanks a lot!
Phess


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



Re: Fast fcgi on dreamhost --> shauwn of the dead, help me shoot zombies

2006-12-03 Thread Maciej Bliziński

coulix napisał(a):
> Any idea on how to fix these problems on dreamhost?

I'm not sure if what you're currently experiencing is the same problem
I had few days ago. I did notice zombie processes and my Django app on
Dreamhost was down every now and then. I've solved this problem by
renaming django.fcgi file to dispatch.fcgi and changing corresponding
lines in the .htaccess file. More details on my blog:
http://automatthias.wordpress.com/2006/12/01/django-on-dreamhost-incomplete-headers/

Cheers,
Maciej


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



DB Syncing Models

2006-12-03 Thread marksibly

Hi,

What's the 'right' way to update the database when you change a model?
For example, when you add a new field?

I initially thought 'manage.py syncdb' would detect and handle this for
you, but it doesn't appear to.

Currently, I'm using MySql to 'DROP TABLE' and then using 'manage.py
syncdb' again, but this seems a bit cumbersome.

Bye!
Mark


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



File downloads

2006-12-03 Thread marksibly

Hi,

I have a django 'files' app that simply maps 'virtual' file names to
physical files for downloading.

Currently, I'm getting the view to return a HttpResponseRedirect to a
'files' area, but I don't like this as it means the files are
'publicly' available and I'd like everything to go through the Django
view.

I couldn't find a 'HttpResponseStaticFile' class or anything, so what
other options do I have?

Can I just 'print' the file in the download script and return 'null'
from the view or something?

Another possiblity would be to bypass the Django url scheme and set up
apache to run the download script directly via mod_python and again
just 'print' the file, but I'd rather everything went through Django if
possible.

Also, how efficient would it be to send a file via python? I'm
currently doing this with php on another site and it works OK, but it
doesn't 'feel' right!

What I kind of need is something like a 'private redirect' - ie: I want
apache to do 'serve' the file, but I don't want the client to know
about the redirect.

Bye!
Mark


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



Re: Best way to run a seperate media server on same machine as Django?

2006-12-03 Thread Brandon Warren

Thanks for the replies!

Because another IP addr isn't available, I decided to run Lighty on
port 81. I don't need SSL, so that seemed like the best solution, and
it's working well for me.

-Brandon


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



Re: File downloads

2006-12-03 Thread Ivan Sagalaev

marksibly wrote:
> I couldn't find a 'HttpResponseStaticFile' class or anything, so what
> other options do I have?

You can pass an open file to a usual HttpResponse:

 f = open(filename, 'rb')
 return HttpResponse(f, mimetype='application/octet-stream')

> Also, how efficient would it be to send a file via python?

In general not efficient at all. Web servers are specifically optimized 
to give out static files and every solution involving loading and 
initializing code would be slower.

However it may still be acceptable depending on your needs.

> What I kind of need is something like a 'private redirect' - ie: I want
> apache to do 'serve' the file, but I don't want the client to know
> about the redirect.

With Apache and mod_python you can use Django for doing authorization 
and leave the actual file serving to Apache: 
http://www.djangoproject.com/documentation/apache_auth/

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



Re: File downloads

2006-12-03 Thread marksibly

Hi,

Thanks for that!

Another option I've found is to use mod_python's 'sendfile()' method in
req.

However, I'm having a problem using Django within a 'plain' mod_python
handler - I get the 'DJANGO_SETTINGS_MODULE' not found error as soon as
I try to import my models.

I've copied the apache  conf block (which includes the
SetEnv) that launches the django handler, and simply changed the
PythonHandler to my own so I don't know what's up...

Bye!
Mark


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



Re: File downloads

2006-12-03 Thread marksibly

Found it in the FAQ;
[quote]
If you're using mod_python but not using Django's request handler,
you'll need to work around a mod_python bug related to the use of
SetEnv; before you import anything from Django you'll need to do the
following:

os.environ.update(req.subprocess_env)
[/quote]


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



Re: File downloads

2006-12-03 Thread Graham Dumpleton

marksibly wrote:
> Found it in the FAQ;
> [quote]
> If you're using mod_python but not using Django's request handler,
> you'll need to work around a mod_python bug related to the use of
> SetEnv; before you import anything from Django you'll need to do the
> following:
>
> os.environ.update(req.subprocess_env)
> [/quote]

The FAQ isn't really correct in saying that is a mod_python bug, it is
how Apache works and populating os.environ with the contents of
req.subprocess_env is wrong and could cause all sorts of problems,
especially in a multithreaded MPM and/or where there are multiple
Django installations running on the one Apache web server and distinct
Python interpreters instances are not used to separate applications
properly.

What the 'subprocess_env' table in the Apache 'request_rec' structure
is for, is to hold any environment variables which should be passed to
subprocesses which may be created for things like running CGI scripts.
Some values in the 'subprocess_env' table may be specific to the
current request being handled especially if req.add_common_vars() has
been called. Because of this, the variables are passed direct to the
exec call used to run the CGI script and are never pushed into the
normal Apache process environment variables as you are doing.

If you do push them into os.environ (even if in Python os.environ is
local to the Python interpreter and doesn't actually change the process
environment) and something is relying on reading the values from there,
the problem you will have is that in a multithreaded MPM where requests
can be serviced in parallel, a distinct request, possibly against a
distinct Django application, could update the values of the environment
variables to something different between the time that the first
request handler set them and subsequently went to use them. This could
result in things like a request being processed wrongly where it
depends on an environment variable sourced from os.environ.

So, if the FAQ does say that it should be changed as it is not strictly
correct. If Django relies on getting configuration through environment
variables or values stuffed into os.environ, then I would suggest it is
possibly broken. At least now I can finally see why the
mod_python/Django documentation might say that the worker MPM should
not be used. I have queried in the past why the worker MPM could not be
used but no one could give an answer as no one really knew where that
statement originated and what the basis for it was. Some people would
say it worked okay and some would say it wouldn't. I wander if the
people for who it didn't work had a setup where they were relying on
updating os.environ with a fiddle like the FAQ describes.

FWIW, I have never seen anyone who has identified themselves as being
involved with Django development on the mod_python mailing lists. I
have never been able to understand this. To me, if you are going to
provide support for running Django on top of mod_python, a good
understanding of how mod_python and Apache works should be a
requirement. :-/

Graham


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



Re: Session problems

2006-12-03 Thread Graham Dumpleton


Jakub Labath wrote:
> Hi All,
>
> Sorry for being quiet for a while just got back from a vacation.
>
> >
> > Hi Jakub,
> >
> > Do you have any updates on this problem? Was it a mod_python bug?
> >
> > Adrian
> >
>
> No the problem persists and I noticed that my coworkers have not
> resolved this in my absence. I'm still not sure what the problem is,
> as I mentioned to Jacob and on modpython list my next move is building
> a tool that simulates bunch of users log-in and out of admin and
> seeing if two different users get send the same cookie. This should
> give me more reliable way to reproduce the problem quickly ... then
> I'll take it from there.
> Should I find something I will contact one of the core devs directly,
> but so far I don't even know what is going on all I really know is
> that it is happening.
>
> As for trying fcgi instead of modpython that is definitively on a to
> do list but two weeks ago I spent ridiculous amount of time switching
> our production server from debian to gentoo hoping to solve the
> problem quickly by using more recent software - that did not happen.
> At this point I really need a tool to reproduce the problem quickly
> and then debug the hell out of everything.

One question for you about this, are you using Apache with a
multithreaded MPM? In other words, is Apache compiled with the 'worker'
MPM for UNIX?

I ask as a separate thread on the list describes pushing data into
os.environ in order to communicate information to Django from a custom
mod_python wrapper handler. To me though, doing such a thing could
cause problems and makes me wander how much Django may depend on
sourcing configuration from os.environ as doing this in a multithreaded
MPM may not work as distinct requests could interfere with each other
due to using what is effectively global data with no thread protection
and no way to stop a distinct thread from changing values before the
first thread got to use them.

Graham


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



Question concerning generic views or date based views in general

2006-12-03 Thread Oliver Andrich
Hi,

I am currently developing a small Django application for my personal use.
Now I like to have a date based archive page, and I thought that this
finally is a good thing to look into generic views. My requirements are,
that I can display the actually database item on the page and in a side bar
a list of years, which link to year based archives, and a list of months in
the current year. From reading the documentation about generic views, I
think I have understood, that I can have either a list of years or a list of
months, but not both. Is this correct?

And besides generic views, I can also create the view myself. Is there a way
to select the years with entries from the database using the ORM? I can of
course use SQL, but I want to stick to the ORM and I want to learn a little
more about it, besides the basics I have used so far.

Best regards, Oliver

-- 
Oliver Andrich <[EMAIL PROTECTED]> ---
http://roughbook.wordpress.com/


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


Re: DB Syncing Models

2006-12-03 Thread Russell Keith-Magee
On 12/4/06, marksibly <[EMAIL PROTECTED]> wrote:
>
>
> I initially thought 'manage.py syncdb' would detect and handle this for
> you, but it doesn't appear to.


No - Syncdb will add any completely new model, but will not alter any
existing model.

The behaviour you are seeking is under development in the schema evolution
branch. I don't know the status of this branch for certain; it was the
subject of a Google 'summer of code' project, and I believe that the
engineering work is complete, but requires feedback and review before it is
committed to the trunk (I could be wrong on this - anybody in the loop on
this stream care to comment?)

Anyway - the wiki describes what was intended for this stream:

http://code.djangoproject.com/wiki/SchemaEvolution

Currently, I'm using MySql to 'DROP TABLE' and then using 'manage.py
> syncdb' again, but this seems a bit cumbersome.


As an alternate to DROP TABLE, you can use ./manage.py reset [appname] -
this will execute the required DROP TABLE calls on the database. Yes, it is
cumbersome, but its the best we can offer at the moment.

Yours,
Russ Magee %-)


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


Re: Fast fcgi on dreamhost --> shauwn of the dead, help me shoot zombies

2006-12-03 Thread [EMAIL PROTECTED]

I just got fed up and fired Dreamhost. They're FCGI implementation is
just too flakey for a production site.

To their credit, they try to warn people about using Django, but being
on the list of friendly hosts and kinda-sorta supporting it give
another impression.

Personally, I think they should either support it, and do it well, or
just say to hell with it tell everyone it won't work acceptably.


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



Re: Multithreading inside django

2006-12-03 Thread Wolfram Kriesing

Btw I found the problem ...
details are here
http://wolfram.kriesing.de/blog/index.php/2006/multithreading-with-mysqldb-and-weakrefs

On 12/2/06, Wolfram Kriesing <[EMAIL PROTECTED]> wrote:
> django/db/__init__.py contains
> dispatcher.connect(connection.close, signal=signals.request_finished)
>
> and that closes the connection and causes the exception below,
> the only thing i dont know is why the main thread doesnt closes it
> right away but instead lets the thread run a while and just the next incoming
> request closes it ...
> but i will also find that out :)
>
> On 12/1/06, Wolfram Kriesing <[EMAIL PROTECTED]> wrote:
> > I think I found out that the connection is the same for both threads,
> > I think that causes the problem. I will try some more but I am not
> > sure if I am on the right path at all :-)
> >
> > On 11/30/06, Wolfram Kriesing <[EMAIL PROTECTED]> wrote:
> > > From the frontend I trigger via AJAX a view that again starts a thread
> > > that does some import work, that might take quite a while. This
> > > enables the user to keep going and have the import run without
> > > interrupting him/her. Every once in a while an asynch call checks on
> > > the state of the import.
> > >
> > > And here lies the problem: while the thread is running and busy like a
> > > bee adding data in the DB the asynch call to check on the state also
> > > tries to run a query and that causes the following exception:
> > >
> > > Traceback (most recent call last):
> > >   File 
> > > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/threading.py",
> > > line 442, in __bootstrap
> > > self.run()
> > >   File "/Users/cain/programming/pms/trunk/pm/../pm/core/views/pic.py",
> > > line 204, in run
> > > self._save(kwargs, sizes, thumbnail_url)
> > >   File "/Users/cain/programming/pms/trunk/pm/../pm/core/views/pic.py",
> > > line 211, in _save
> > > picimport.save()
> > >   File "/Users/cain/programming/django/trunk/django/db/models/base.py",
> > > line 184, in save
> > > db_values + [pk_val])
> > >   File "/Users/cain/programming/django/trunk/django/db/backends/util.py",
> > > line 12, in execute
> > > return self.cursor.execute(sql, params)
> > >   File 
> > > "/Users/cain/programming/django/trunk/django/db/backends/mysql/base.py",
> > > line 42, in execute
> > > return self.cursor.execute(sql, params)
> > >   File 
> > > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/MySQLdb/cursors.py",
> > > line 137, in execute
> > > self.errorhandler(self, exc, value)
> > >   File 
> > > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/MySQLdb/connections.py",
> > > line 33, in defaulterrorhandler
> > > raise errorclass, errorvalue
> > > ReferenceError: weakly-referenced object no longer exists
> > >
> > > I had found the ticket http://code.djangoproject.com/ticket/1442 which
> > > looks like it did solve my problem. So where does my problem come
> > > from?
> > > Is the problem caused by using multiple cursors (as I would guess from
> > > the traceback)? Any ideas?
> > >
> > > Thanks in advance
> > >
> > > --
> > > cu
> > >
> > >
> > > Wolfram
> > >
> >
> >
> > --
> > cu
> >
> > Wolfram
> >
>
>
> --
> cu
>
> Wolfram
>


-- 
cu

Wolfram

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



Pagination variable problem with generic list and limited queryset

2006-12-03 Thread Silas

I have a problem with generic.list_detail.object_list, a limiting
queryset, and pagination variables.

For some reason when I use the code below, results are restricted to
the sliced 100, but all the pagination variables show results as if the
slice wasn't there.

Example:

{{ pages }} = 12 (not the max 5)
{{ has_next }} will be true on page 5

Dictionary and URL Pattern:

info_dict = {
'queryset': Test.objects.all().order_by('-id')[:100],
'paginate_by': 20,
}

(r'^test/$', 'django.views.generic.list_detail.object_list',
info_dict),

Template:

{{ page }} - {{ pages }}

{% if has_next %}Next{% endif %}


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



Hiding Referrer URL

2006-12-03 Thread Siah

Hi,

I need to hide referrer url on HttpResponseRedirect. I was expecting to
find something like ReferrerURL in HttpResponseRedirect.headers, but
did not. I was hopping to change the header information right before
HttpResponseRedirect sends the user to the other server to hide the
referrer URL, or even change it to somethings else.

How can I accomplish that?

Thanks,
Sia


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



High Load

2006-12-03 Thread [EMAIL PROTECTED]

We're trying to launch our Django site, and we're coming into severe
load issues.

The site right now has 2 SQL servers, clustered, and 3 web servers all
running with 4 cores and 4 gigs of memory.

Our biggest problem is everything seems ok on the development site,
load times are ok, the SQL queries are quick, and there doesn't seem to
be any slow down. We use caching *everywhere* that it hits the db and
have tested both memcached and disk caching.

Once we push it to the live server, immediately all web servers end up
averaging 10-20 load. We should be able to handle this on 1, maybe 2
servers, the 3rd server was to handle *any* kind of load we would have
within the next few months, we've been able to handle peak traffic days
with just the 2 servers using PHP/MySQL.

We are running lighttpd with fastcgi in prefork mode. We tried using
threaded but django spits out an error about a weakly-referenced
object, related to sessions I believe, no longer existing. Yes I
submitted this as a ticket and as far as I know it still exists.

If anyone has any experience with debugging this kind of problem it'd
be a great help.


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



Sort by related table

2006-12-03 Thread fvk

There are my two models:

class Messages(models.Model):
sender = models.ForeignKey(UserProfile)
to = models.ForeignKey(UserProfile)
body = models.TextField()
sent_date = models.DateTimeField()

class UserProfile(models.Model):
  contactlist = models.ManyToManyField('self')

I can get user's contact list:
contact_list = profile.contactlist.all()

May I sort contact_list by date of related messages?

P.S Sorry, I did not find it in docs..


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



Setting checkbox to check as default value

2006-12-03 Thread jeffhg58

I have a custom manipulator and I am trying to set the checkbox default
to checked.

For example, my field name is:

forms.CheckboxField(field_name="current"),

Not sure how you to do it. I tried putting the attribute after the
field name which did not work.

I also tried right before the formwrapper call as such

# No POST, so we want a brand new form without any data or errors.
errors = {}
new_data['current'] = "checked='checked'"

Thanks,
Jeff


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



Help with Django Admin and models - editing multiple related tables "inline" on one form

2006-12-03 Thread dmlee

Hi All,

I'm creating an application to track field-trial results for hounds.
Does anyone know of an easy way to edit multiple related tables inline
on one form in the Admin app?

Ideally, I want the hound "Groupings" edited inline with trials (which
works as expected), but I also want the "Standings" to be edited inline
with the "Groupings" (as they are added)... all on the same form. This
is where I have hit the wall.

Currently the admin gives me one or the other, but not both. If I come
in at the "Trial" level in admin, I can specify the groupings just fine
using the edit_inline argument. Likewise, if I come it at the
"Grouping" level in admin, I can add the standings just fine. Ideally,
I would like to edit everything on the same form to avoid binding the
standings manually to the trial in the admin.

In short, is there a way to edit_inline all three objects/tables from
one form?

Thanks in advance
Darin Lee

- - - -

Here is a shortened version of my model:

class Trial (models.Model):
location = models.ForeignKey(Club, help_text='Select the hosting
club')
common_name = models.CharField('Event Name', maxlength=100,
blank=True)
start_date_time = models.DateTimeField('Starting Date and Time')
end_date_time = models.DateTimeField('Ending Date and Time')
presiding_secretary = models.ForeignKey(Beagler,
verbose_name="Secretary")
class Admin: pass

class Grouping (models.Model):
trial = models.ForeignKey(Trial)
type = models.CharField(maxlength=12, choices=CLASS_TYPES,
core=True)
num_entries = models.IntegerField('Entries in Class', core=True)
num_starters = models.IntegerField('Actual Starters in Class',
core=True)
class Admin: pass

class Standing (models.Model):
trialclass = models.ForeignKey(Grouping,
edit_inline=models.TABULAR, num_in_admin=5)
rank = models.IntegerField(core=True, choices=RANK)
hound = models.ForeignKey(Hound,core=True)
handler = models.ForeignKey(Beagler, core=True)
awarded_points = models.IntegerField(core=True, editable=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?hl=en
-~--~~~~--~~--~--~---



Validation 3 steep complicate form

2006-12-03 Thread GvaderTh

Hello All. I read django documentation about forms, had seek internet
and didn't found solution for situation like this: I have order form
divided to 3 steeps, after every step should be validation and if
validation is succesfull, user can fill form for next-step. Form for
every step  doesn't map to database table, or object, I think that only
filled succesfully 3 step, the result will be a new object. What is the
best way to do this? At the beggining I thought that after every step,
value after validation I will hold in session and at the end I made
final object. But for now I don't know how to write template for this
task, and how to do validation for this. Any help? Please
Thanks 
G.


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



email not going to bulkfolder

2006-12-03 Thread John

hi guys
i have added a few viral features such as email friends, refer, share
item etc...

but the problem is the email gets delivered to bulk folder by gym...
please tell me how to ensure that emails dont get delivered to bulk
folder
thanks
John


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



How to default checkboxfield in customer manipulator

2006-12-03 Thread jeffhg58

I am trying to set the checkboxfield default value to checked but not
sure how you do it.

Here is my formfield for the checkbox

forms.CheckboxField(field_name="current"),

I tried ading checked="checked" but that did not work.

Thanks,
Jeff


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



Run your Django app with the CherryPy server

2006-12-03 Thread Loïc (titoo)

Hello,

For interested people, I have wrapped the WSGI CherryPy server to be
used with Django. With the same wrapper you can start several django
projects (one cherrypy instance per project) with a configuration file
for each project. You can ask it to serve the Django admin media files
or not, it can run as daemon or not. An example of /etc/init.d start
script is given.

Download: http://xhtml.net/scripts/Django-CherryPy-server-DjangoCerise

For a small historical presentation. I wanted a low memory
footprint/low CPU approach because my sever is a small fanless system.
So I contacted David Pratt[1], but he saddly had not the time to
maintain his stuff for a broad use. So I went to do it myself. When
CherryPy announced that they had renamed their WSGI server
implementation to be easier to use it, I motivate myself to "release"
my script with this updated version.

Enjoy! And of course, feedback is welcome.

Loïc d'Anterroches

PS: It powers http://www.equilibreforet.fr/carnet/ behind NGINX.

[1]
http://groups.google.com/group/django-developers/browse_thread/thread/7037d0dc1f9354df/bff630d839fad7a5#bff630d839fad7a5


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



no-database models?

2006-12-03 Thread [EMAIL PROTECTED]

 Hi,

 Is there a way to use regular home-spun python models in such a
way that they'll relate with Django's ORM models?
 What I'd like to do is something like this:

  class MyDay:
  def __init__(self, date):
  self.id = date.toordinal()
  self.date = date

  class Concert(models.Model):
  title = models.CharField(maxlength=50)
  description = models.CharField(maxlength=50)
  date = models.ForeignKey(MyDay)

  class Meeting(models.Model):
  title = models.CharField(maxlength=50)
  description = models.CharField(maxlength=50)
  date = models.ForeignKey(MyDay)

  So that I can do something like this in my templates:

{% for concert in myday %}
{{ concert.title}} {{ concert.description }}
{% endfor %}
{% for meeting in myday %}
{{ meeting.title}} {{ meeting.description }}
{% endfor %}

  Of course, I could just run out 10 years worth of days in a
database table to get the same effect, but that seems like a kludge. As
does every other method of tackling this particular problem that I've
been able to come up with.
  Ideas?


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



Re: no-database models?

2006-12-03 Thread Russell Keith-Magee
On 12/4/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>   Of course, I could just run out 10 years worth of days in a
> database table to get the same effect, but that seems like a kludge. As
> does every other method of tackling this particular problem that I've
> been able to come up with.


Is there any particular reason that you have defined a 'day' model instance,
rather than just using a DateField on the Concert and Meeting models?

Yours,
Russ Magee %-)


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


Re: no-database models?

2006-12-03 Thread [EMAIL PROTECTED]

 Russ,

 Because it seems like the cleanest way of pulling together a wide
variety of content that all pertains to a particular day, or list of
days.
 The alternative, it seems to me, is running seperate queries on
Concerts, Meetings, DrinkSpecials, BallGames, etc., then passing all of
those to the template. And things get stickier still if I'm talking
about several days. If I could employ a one-to-many relationship
between the Day instance and all these other models, that's just one
queryset, and it's easier to slice and sort.
  Or am I being obtuse?

  Thanks, 

  Hank


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



Re: email not going to bulkfolder

2006-12-03 Thread James Bennett

On 12/3/06, John <[EMAIL PROTECTED]> wrote:
> but the problem is the email gets delivered to bulk folder by gym...
> please tell me how to ensure that emails dont get delivered to bulk
> folder

There isn't, really. Whether an email provider filters your messages
into a user's "bulk" or "spam" folder is entirely up to the email
provider, and there's absolutely nothing you can do about it.

AOL in particular is bad about that.

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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



Re: no-database models?

2006-12-03 Thread [EMAIL PROTECTED]

  The other part, which I forgot to mention, is that I'd like to be
able to have an easy many-to-many relationship between days and, say,
meetings. A particular meeting can happen every other Tuesday, and it
seems a waste to have to enter a new record for it twice a month.

 Hank


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



Re: no-database models?

2006-12-03 Thread Russell Keith-Magee
On 12/4/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>  Russ,
>
>  Because it seems like the cleanest way of pulling together a wide
> variety of content that all pertains to a particular day, or list of
> days.
>  The alternative, it seems to me, is running seperate queries on
> Concerts, Meetings, DrinkSpecials, BallGames, etc., then passing all of
> those to the template. And things get stickier still if I'm talking
> about several days. If I could employ a one-to-many relationship
> between the Day instance and all these other models, that's just one
> queryset, and it's easier to slice and sort.


Ok; so you want to use a template context of:

context = TemplateContext({
   'myday' : Day.objects.get(date=date.today())
})

with a template of:

{% for concert in myday %}
{{ concert.title}} {{ concert.description }}
{% endfor %}
{% for meeting in myday %}
{{ meeting.title}} {{ meeting.description }}
{% endfor %}

The alternative is using a context of:

context = TemplateContext({
  'todaysConcerts': Concerts.objects.filter(date=date.today()),
  'todaysMeetings':  Meetings.objects.filter(date=date.today())
})

with a template of
{% for concert in todaysConcerts %}
{{ concert.title}} {{ concert.description }}
{% endfor %}
{% for meeting in todaysMeetings %}
{{ meeting.title}} {{ meeting.description }}
{% endfor %}

I don't see why the former is in any way preferable to the latter,
especially if you have to mess around with optimizing the Date model.

If your problem is the repeated query clause in the context, remember all
the fancy things you can do with dictionaries and the ** operator:

query = {
   'date':date.today()
}
context = TemplateContext({
   'todaysConcerts': Concerts.objects.filter(**query),
   'todaysMeetings': Meetings.objects.filter(**query)
})

You could even go completely dynamic:

context = TemplateContext(
dict([('todays'+model.name, model.objects.filter(date=date.today())) for
model in [Concerts, Meetings]])
)

Yours,
Russ Magee %-)


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


Re: no-database models?

2006-12-03 Thread Russell Keith-Magee
On 12/4/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>   The other part, which I forgot to mention, is that I'd like to be
> able to have an easy many-to-many relationship between days and, say,
> meetings. A particular meeting can happen every other Tuesday, and it
> seems a waste to have to enter a new record for it twice a month.


I would argue that it if there are two meetings, there are two distinct
database entities that need to be recorded separately. If attendance at the
two meetings are different, or if you wanted to store the minutes of each
individual meeting, there is no way in your model to distinguish which
meeting had which attendance, or which set of minutes.

Yours,
Russ Magee %-)


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


Re: no-database models?

2006-12-03 Thread [EMAIL PROTECTED]

> context = TemplateContext(
> dict([('todays'+model.name, model.objects.filter(date=date.today())) for
> model in [Concerts, Meetings]])

 That's some awesome smart list-comprehension mojo, and I'll
definitely be ripping it off.
 But I guess it doesn't quite answer my wish for a many-to-many
relationship between days and events. Any ideas?
  
 Thanks so much,

 Hank


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



Re: no-database models?

2006-12-03 Thread [EMAIL PROTECTED]

 We're driving right past each other on the information
superhighway.
 Thanks for your advice, Russ. It still seems to me that a
many-to-many relationship between days and events would be desirable,
for the same reasons that all many-to-many relationships are desirable.

 In my case, I don't want to record minutes at a particular meeting
(for example) -- I just want to be able to publish the fact that the
meeting is happening tonight, as it does every third Saturday at 7 p.m.
For my purposes, it seems very unDRY to have to put a new record in the
database every time that third Saturday rolls around.

 Very best,

 Hank Sims


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



Re: Hiding Referrer URL

2006-12-03 Thread Jacob Kaplan-Moss

On 12/2/06 6:01 PM, Siah wrote:
> How can I accomplish that?

You can't; the Referer header gets set by the browser, not by the web server.

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?hl=en
-~--~~~~--~~--~--~---



Re: using manipulators without defining fields again

2006-12-03 Thread Milan Andric

On Dec 1, 1:31 pm, Ivan Sagalaev <[EMAIL PROTECTED]> wrote:
> To not invent an artificial example could you describe your task in more
> detail?

Sure,

I have a long application form for a workshop (name, employment,
resume, ... 65 fields).  The user logs in to the site via
django.contrib.auth.view.login, standard django fare.  Then the user is
allowed to apply for workshop xyz.  If the user clicks save but does
not complete the form, errors are shown and the user gets a message
explaining the incomplete state of the form, but the form data is also
saved in the database, just flagged with complete = 0.  Only when the
form validates does Application.complete field get set to 1 so
reviewers know to look at it.

This process allows the applicant to continue their application at a
later time without completing the form.  I'm currently doing this
without AutomaticManipulator but I might have the need to override
things later.  Not sure yet.  Originally I thought to use the same
technique as in the RegistrationForm and write the manipulator, wrote
my original mail, but it wasn't necessary just to skip validation.  So
I came up with this newbie approach.  http://dpaste.com/3435/

One thing that worries me is, if skipping validation renders the data
insecure?  Since I haven't peeked much at the internals I'm not sure
where string escaping and other types of form data checking takes place
either.

What other problems might I run into by disregarding
manipulator.get_validation_errors and saving anyway?

Thanks for you reply!


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