session intermittently disappears just after login

2009-10-01 Thread Jeff Gentry
Hi there ... (this is also posted to stackoverflow: http://stackoverflow.com/questions/1504537/django-session-intermittently-disappears-just-after-login) In my django app, I handle login in the following manner. Users go to a gateway page (index.html) - if they are not currently logged in,

Efficiently searching a tree of FKs

2009-09-22 Thread Jeff Gentry
Hello ... I have a tree like structure created out of models using ForeignKey linkages. As an example: Model Person: name = CharField Model Book: name = CharField author = FK(Person) Model Movie: name = CharField director = FK(Person) Model Album: name = CharField

Re: Editors of choice

2009-09-08 Thread Jeff Gentry
On Mon, Sep 7, 2009 at 2:55 PM, Samuel Hopkins wrote: > Anyhow, the purpose of this email was just to ask the community what > editor(s) they preferred to use with Django. Emacs --~--~-~--~~~---~--~~ You received this message because

Re: mod_python: "No module named django"

2009-04-02 Thread Jeff Gentry
Err, sorry, I meant to cancel and sent this instead. I believe I found my problem while preparing to email about this (wasn't looking close enough at the error message, and it looks like apache was looking in the wrong python's site-packages) On Thu, 2 Apr 2009, Jeff Gentry wrote: > >

mod_python: "No module named django"

2009-04-02 Thread Jeff Gentry
Ok, so I've managed to get django running using mod_python on some other machines, but today I'm being stymied: --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Optimizing my ORM query

2009-03-06 Thread Jeff Gentry
Sorry for the self-followup, but I got the right bits of extra. My actual case was a bit more complicated than my example below (it involved a fourth model), but it's working now - and much quicker than w/ the IN directive. Thanks. On Fri, 6 Mar 2009, Jeff Gentry wrote: > On Fri, 6 Mar 2

Re: Optimizing my ORM query

2009-03-06 Thread Jeff Gentry
On Fri, 6 Mar 2009, Malcolm Tredinnick wrote: > > Bob.objects.filter(foo=myFoo).filter(blah__in=myBlahs) > Seems like the best (and obvious) way to me. Gotcha. > Yes it does. As written, your models have no ordering requirements. That > complete lack of constraint is preserved perfectly. :-)

Optimizing my ORM query

2009-03-05 Thread Jeff Gentry
Suppose I have three models (in pseudocode): class Foo: asdf = models.CharField() class Blah: qwerty = models.CharField() class Bob: foo = models.ForeignKey(Foo) blah = models.ForeignKey(Blah) Given a Foo and a list of Blahs (where the length of the list might be very small (0-10)

Best practices: generating large dynamic files

2009-03-04 Thread Jeff Gentry
In my project I have a need to generate CSV output files for download. Some of these files aren't overly large - 1-20MB or so, but they can get quite big (currently the largest are several hundred MB and this could grow with time). This would appear to be a case where there's no magic bullet,

Re: Dealing with multiple M2Ms

2009-02-25 Thread Jeff Gentry
> and suppose "obj_a" is your given A instance. Then I suspect this is the > type of queryset you're after: > C.objects.filter(Q(to_a=obj_a) | Q(to_b__to_a=obj_a)) This did the trick Malcolm, thanks. I'm not sure what was hanging me up as I could swear I had tried this one already, but

Re: Views triggering twice

2008-11-17 Thread Jeff Gentry
> you've used the value "#fff", that will be interpreted by the browser as > a reference to the current page (#fff being an anchor, and not passed to > the server). Ergo, a second request is made. Wow, thanks. Just reading through your step by step taught me some things I didn't know :) > The

Re: Views triggering twice

2008-11-14 Thread Jeff Gentry
> Quoting from the book of "if you hear hoofbeats, think horses, not > zebras": This obviously isn't normal Django behaviour and since calling > views is easily the most common operation in Django, it's safe to assume > that any breakage here in Django would have been noticed by other > people.

Re: Views triggering twice

2008-11-13 Thread Jeff Gentry
Another piece of info, in case it's useful here - the page does *not* render on the first view call, it's only after the second call that the page will render. I don't think it's even pulling up the template until the second go-around, as a test I put some intentionally bad template code in a

Re: Views triggering twice

2008-11-13 Thread Jeff Gentry
> How have you noticed that view was triggered twice? I noticed that the URLs were displaying twice in the devel server console (and in HTTP logs for when running off of apache). For the former case, I put a print statement in the view function - when loading those pages, the print is triggered

Re: Views triggering twice

2008-11-13 Thread Jeff Gentry
Actually I lied a little bit - a completely blank file doesn't trigger this (I can also seem to put in a and tag), but adding anything else will cause the view to be loaded 2x. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Views triggering twice

2008-11-13 Thread Jeff Gentry
In my apps, I'm finding that my views are triggering twice. I have a series of related apps, working off of the same settings.py file (there's a global urls.py, which triggers off of the first string and sends to a subdirectory w/ it's own urls.py/__init__.py/models.py/views.py/etc. With one

Re: newforms question

2008-10-17 Thread Jeff Gentry
> Oops. It could also read > from django import newforms as forms > in which case you should change it to > from django import forms Right, that's what I was thinking. > but I hope you've got the idea: basically newforms has *become* forms. Yup - just wasn't sure on that. I had

newforms question

2008-10-17 Thread Jeff Gentry
Hi there ... To date, I've not been using Django's form system (nor 'newforms'), but am trying to integrate another app into a suite that I'm developing. The code on this is a bit older and is using newforms - when I fire up the server (running off of the 1.0 branch) I get "No module named

Re: Sending HTML email

2008-09-23 Thread Jeff Gentry
On Tue, 23 Sep 2008, Berco Beute wrote: > But now I want to use HTML in the body of the email. How do I format > such a message and can I just send it like above? Emails should be plain text, not HTML ;) --~--~-~--~~~---~--~~ You received this message because

Re: Root Access

2008-07-14 Thread Jeff Gentry
> I don't think that is true, the only time I needed root was when I was > symlinking django into /usr/lib/python2.5/site-packages/ but since you I've run Django on machines w/ no root access and nothing special installed for me. Granted I've been running off of non-standard ports, but ...

Re: Getting mod_python working

2008-05-29 Thread Jeff Gentry
Hi there ... In case anyone comes across this in the future, I solved the problem. libpq wasn't getting picked up by the process, all's well now. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Getting mod_python working

2008-05-28 Thread Jeff Gentry
Hi there ... I'm running Django-svn, mod_python 3.3.1, apache 2.2.3-11, python 2.5.2, psycopg 1.2.21 & mxdatetime 2.0.6. On my machine I can run everything perfectly fine via the manage.py shell as well as the development server. However, when I try to fire up a connection running out of

Re: Specifying schema name w/ syncdb

2008-05-16 Thread Jeff Gentry
> I'm using PostgreSQL - one question I had was that when I run syncdb, > the tables that are created are under the default 'public' schema. > Is there a way to specify syncdb to create these tables under another > schema name? Er, sorry about that. If I created the schema first, syncdb stuck

Specifying schema name w/ syncdb

2008-05-16 Thread Jeff Gentry
Hi there ... I'm using PostgreSQL - one question I had was that when I run syncdb, the tables that are created are under the default 'public' schema. Is there a way to specify syncdb to create these tables under another schema name? --~--~-~--~~~---~--~~ You

chained many-to-manys

2008-04-14 Thread Jeff Gentry
I have a setup that I figured I could just crib off of the User/Group/Permission code because the setup is basically identical, but falling a bit short here (perhaps I'm just not looking at the right code). I have three classes, As, Bs & Cs. A has a M2M relationship with both B & C. B has a M2M

Re: how do I create a zebra table using a template?

2008-04-11 Thread Jeff Gentry
On Fri, 11 Apr 2008, Kenneth Gonsalves wrote: > > {% if forloop.counter % 2 %} > divisibleby Actually, he should be using 'cycle' --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: How to json serialize dicts from values(*fields)

2008-03-31 Thread Jeff Gentry
On Mon, 31 Mar 2008, ydjango wrote: > u'jsklajdkls'}, {'food_name': u'PMC', 'group': 1L, 'description': > u'jsklajdkls'}] > ( why do I see u before text in output above?) It indicates that they're unicode strings. --~--~-~--~~~---~--~~ You received this message

Re: using Django unit test framework with existing production db

2008-03-28 Thread Jeff Gentry
> Is there some graceful way to have the Django unit test framework > access the "production database" for certain tests as opposed to > creating a test db? The idea is to do a basic sanity check of the > "production db" in case the schema has changed and the db needs to be > rebuilt.

unit testing Q

2008-03-25 Thread Jeff Gentry
Hi there ... As a relative newcomer to Django, I recently starting looking at how best to implement unit tests for my app. I came across this page: http://www.djangoproject.com/documentation/testing/ as well as a couple of other examples online. If I'm understanding things correctly, the unit

save() always ABORTs

2008-03-05 Thread Jeff Gentry
I'm sure I'm missing something small/stupid here, but it has me stumped. I have a legacy database system which I'm writing some django applets for - up until now it has been purely read-only, but working on making something which can write as well. I've created a minimal test case here which

Re: i'm tired

2008-02-11 Thread Jeff Gentry
> Man I hear you. I've been doing web for 10 years, in a variety of > languages. I have Django installed VERBATIM according to the > documentation. > I can get Django to run, but I can't get it to server images using the > built-in server. mod_python is a whole other ball of wax. I have >