Re: null=True conditionally

2006-05-20 Thread Glenn Tenney
: Glenn Tenney <[EMAIL PROTECTED]> To: django-users@googlegroups.com Subject: Re: null=True conditionally Message-ID: <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> Mime-Version: 1.0 Content-Type: t

Re: null=True conditionally

2006-05-20 Thread qhfgva
May 2006 05:43:43 + (UTC) From: "qhfgva" <[EMAIL PROTECTED]> To: "Django users" Subject: Re: null=True conditionally Date: Sun, 21 May 2006 05:43:43 - Message-ID: <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <

Re: null=True conditionally

2006-05-20 Thread Malcolm Tredinnick
On Sat, 2006-05-20 at 22:15 +, qhfgva wrote: > Thanks for your response, I'm not having luck with this. It seems like > the admin interface is requiring ForeignKey fields even when marked as > null=True. OK, this problem bites everybody once. It's documented, but easy enough to miss in all t

Re: null=True conditionally

2006-05-20 Thread qhfgva
Thanks for your response, I'm not having luck with this. It seems like the admin interface is requiring ForeignKey fields even when marked as null=True. My validator that I wrote seems to be working, but since the fk field is being required it defeats the purpose. Here is my model. Is there an

Re: null=True conditionally

2006-05-17 Thread Malcolm Tredinnick
On Thu, 2006-05-18 at 04:51 +, qhfgva wrote: > Class Foo(Model): > blah = CharField(maxlength=20) > bar = ForeignKey(Qwerty) # requred field > baz = CharField(maxlength=20, null=False) > > In the above class I'd like to make baz a required field if bar is of a > certain value oth

Re: null=True conditionally

2006-05-17 Thread qhfgva
Perhaps more generally, how can I constrain baz to a certain subset of values as a function of bar? bar = ('qwe','wer','ert','rty') baz = ('w1','w2','t1','t2') E.g if bar's value has a 'w' in it then baz must be w1 or w2. Otherwise it must be t2 or t2. --~--~-~--~~~

null=True conditionally

2006-05-17 Thread qhfgva
Class Foo(Model): blah = CharField(maxlength=20) bar = ForeignKey(Qwerty) # requred field baz = CharField(maxlength=20, null=False) In the above class I'd like to make baz a required field if bar is of a certain value otherwise it can be blank. If there a way to accomplish this? Th