What is Django's behavior when a request is interrupted?

2012-05-29 Thread John Boxall
Consider the following code: def view(request): > import pdb;pdb.set_trace() > # Make a bunch of databases updates > return HttpResponse('OKAY') I boot up the Django devserver and make a request from my browser. It is routed by Django to `view`. When the debugger

Re: Preventing JOIN while checking if a self referencing FK is null

2009-11-04 Thread John Boxall
there is an optimization to be made at the Django ORM level? jb On Nov 4, 11:32 am, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Nov 4, 7:22 pm, John Boxall <bisha...@gmail.com> wrote: > > > Both of these will raise a FieldError: > > > people_with_bffs = Person.ob

Re: Preventing JOIN while checking if a self referencing FK is null

2009-11-04 Thread John Boxall
Both of these will raise a FieldError: people_with_bffs = Person.objects.filter(bbf_id__isnull=False) people_with_bffs = Person.objects.filter(bbf_pk__isnull=False) Cannot resolve keyword 'bbf_pk' into field. Choices are 'bbf'. Thanks for the suggestion though! jb On Nov 4, 11:13 am, Javier

Re: Building Q queries

2009-11-04 Thread John Boxall
Hey Marc, You can store queryset by pickling them - you might find this documentation helpful: http://docs.djangoproject.com/en/dev/ref/models/querysets/#id2 I could imagine an interface that combined Alex's django-filter with a Model for storing the pickled query objects to implement your

Preventing JOIN while checking if a self referencing FK is null

2009-11-04 Thread John Boxall
Hey Djangonauts, I'd like to optimize the performance of a query I've got running on a page - I've got a model which has a self referencing nullable foreign key and I'd like to select all instances of that model that which have a value for that column. Imagine a class Person with a nullable FK

Re: Implementing A/B Testing in Django

2009-05-18 Thread John Boxall
Using template_loader idea I've developed a little pluggable app for conducting basic A/B tests. You can grab it here: http://github.com/johnboxall/django-ab/tree/master John On May 16, 9:04 pm, John Boxall <bisha...@gmail.com> wrote: > I've got a new home page and I'd like to

Re: Implementing A/B Testing in Django

2009-05-18 Thread John Boxall
Thanks Tino, I am aware of GWO - just thought it would be a cool project to try! It looks like the local threads / request object available in the template loader trick is going to work - just gotta clear up some possible caching issues then it'll be ready for release. Cheers, John On May

Implementing A/B Testing in Django

2009-05-16 Thread John Boxall
I've got a new home page and I'd like to test it's performance in getting users to sign up compared to my existing home page. In Django terms I have two templates that I would like my existing view to alternate between - I want to make whatever template the viewer sees "sticky" - they see the

Re: Django Pluggable application for invoicing / accounts?

2009-03-06 Thread John Boxall
/lincolnloop/django-beancounter/blob/736b627c337fdc2cab41f45375fd4eecbdd55526/beancounter/models.py Thanks, John On Mar 5, 4:36 pm, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Thu, 2009-03-05 at 16:23 -0800, John Boxall wrote: > > Hey everyone, > > > I'm building a

Django Pluggable application for invoicing / accounts?

2009-03-05 Thread John Boxall
Hey everyone, I'm building a Django app that charges users monthly and one time fees. I need to generate invoices and keep track of orders and I most definitely don't want to write this non-core code myself :) Someone else must have done it (or something like it!) I've tried searching in the

Re: HttpResponse.set_cookie defaults?

2008-12-03 Thread John Boxall
To answer my own question - the SESSION_COOKIE_* variables are not used in set_cookie. You'll have to pass in these things yourself! John On Dec 3, 3:02 pm, John Boxall <[EMAIL PROTECTED]> wrote: > From the documentation it's not obivous what the defaults are for the >

HttpResponse.set_cookie defaults?

2008-12-03 Thread John Boxall
>From the documentation it's not obivous what the defaults are for the set_cookie() function. http://docs.djangoproject.com/en/dev/ref/request-response/?from=olddocs#django.http.HttpResponse.set_cookie I've read about the various django SESSION_COOKIE_* settings:

Re: Custom Inline Forms with InlineFormsets

2008-11-10 Thread John Boxall
, fields=None, exclude=None, extra=3, can_order=False, can_delete=True, max_num=0, formfield_callback=lambda f: f.formfield()): On Nov 10, 12:47 pm, John Boxall <[EMAIL PROTECTED]> wrote:

Custom Inline Forms with InlineFormsets

2008-11-10 Thread John Boxall
Heyo Django Users, I'm in a bit of a pickle with InlineFormsets - I'm following the example at the Django Docs: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-inlineformset-factory I've got two models: class Author(models.Model): name =

Re: Regex

2008-07-02 Thread John Boxall
You might want to refer to this recent article at Coding Horror: http://www.codinghorror.com/blog/archives/001016.html I would stick to what you have. (and I would also only do the calculation once and store it as a boolean field in the database as suggested : ) John On Jun 30, 7:13 am,

Re: Newforms Admin - Overriding the Save Method of an Inline Model

2008-07-02 Thread John Boxall
rian Rosner <[EMAIL PROTECTED]> wrote: > > > > > On Jul 2, 2008, at 12:22 PM, John Boxall wrote: > > > > class OptionModelForm(forms.ModelForm): > > > >       class Meta: > > >               model = Option > > > >       def save(self, commit

Newforms Admin - Overriding the Save Method of an Inline Model

2008-07-02 Thread John Boxall
Hey everyone - I'm running into a bit of a problem with NFA. I would like to override the save method of an inline model. For example - I have a Poll which many Options. In the admin panel I would be able to edit the Options while editing the Poll so I declare the Poll to have the Options as