So how do you add a custom filter to your Django Forms?
I read and tried several solutions for customizing the view and form but nothing seemed to work. The most promising seemed to be to use
self.fields['website'].queryset = Website.objects.filter(organization__primary_account=self.request.user)
The tricky bitch of it was that the request object wasn't accessible via self or a directly passed parameter.
Because this shit works; well it works for 1 person yet at the same time is a giant security issue for that user.
self.fields['website'].queryset = Website.objects.filter(organization__primary_account=1)
So after much hand wringing and searching I couldn't find a solution that worked for me. I know I should be ashamed to call myself a djangonaut. In my defense, I suck and don't really get to program that often.
IRC #django to the rescue.
So I posted my questions and after about 20 minutes my new best friend mayhew responded with an answer.
Sometimes in retrospect the answer seems so obvious and the simple it is the more obvious it had to be.
So in the view, you need to pass the request object when you instantiate your form.
Mayhew's initial suggestion was ...