Re: Proposal: Meta.required_together

2010-10-04 Thread TiNo
Sorry I didn't reread this thread, or remembered it after my previous post.
I just replied to clearify my previous post.

Tino

On Mon, Oct 4, 2010 at 02:57, LookMa NoSQL  wrote:

> Tino, are you joking? Did you even bother to read the OP's proposal. I
> think there is a real lack of patience when you spend the time writing
> what the OP has written without even reading it, just to try to
> dismiss it.
>
> OP:
>
> >def clean(self):
> >if any((self.weight, self.height))
> >if not all((self.weight, self.height))
> >raise ValidationError("Uh oh!")
>
> On Oct 3, 2:08 pm, TiNo  wrote:
> > Doesn't this do what you want?:
> >
> > class MyModel(models.Model):
> > weight = ..
> > height = ...
> > width = ...
> > length = ...
> >
> > def clean(self):
> > from django.core.exceptions import ValidationError
> > if self.weight or self.height or self.width or self.length and
> > not (self.weight and self.height and self.width and
> > self.length):
> > raise ValidationError("Sorry, in order to use weight, height,
> > width, or"
> > " length, you have to include them all.")
> >
> > def save(self, *args, **kwargs):
> > self.clean()
> > super(MyModel, self).save(*args, **kwargs)
> >
> > Of course it does require you to write a little more code, but it is
> > possible.
> >
> > Besides, does the required_together mean that all fields are required
> when
> > one is filled out, or that some are required when the first is filled
> out?
> > What I mean is that there are many possibilities for validating a model,
> and
> > at the moment we have quite some good tools for them. Adding another Meta
> > option for a small portion of the cases doesn't seem so necessary to
> me...
> >
> > Anyway, that's just my 2c.
> >
> > TinO
> >
> > On Sun, Oct 3, 2010 at 05:58, LookMa NoSQL 
> wrote:
> > > +1 on proposal (for what it matters).
> >
> > > Tina, where did you see that Django does that? The docs link you sent
> > > shows regular model validation. What Mamayo is looking for, I think,
> > > is the ability to add a Meta option to a  model that says
> > > required_together=({fields: ('weight', 'height', 'width', 'length'),
> > > error_message: "Sorry, in order to use weight, height, width, or
> > > length, you have to include them all."}). At least I think that's what
> > > he means. This would help me too.
> >
> > > On Oct 2, 10:17 am, TiNo  wrote:
> > > > Hi,
> >
> > > > Isn't this covered by model validation [1]?
> >
> > > > Tino
> >
> > > > [1]
> > >http://docs.djangoproject.com/en/dev/ref/models/instances/#validating.
> ..
> >
> > > > On Fri, Oct 1, 2010 at 15:59, hejsan  wrote:
> > > > > Hi.
> > > > > I just filed a feature request on the same or similar issue, and
> this
> > > > > thread was brought to my attention:
> > > > >http://code.djangoproject.com/ticket/14347
> >
> > > > > Basically the usecase is this:
> > > > > Very often we have a "Published" field on our models (or "Published
> > > > > date" or "Published status" etc..) It would be very nice to be able
> to
> > > > > allow people to save instances without all the required fields
> being
> > > > > filled in IF the article or whathaveyou is not published yet.
> >
> > > > > My suggestion was to allow the "required" field on the form field
> to
> > > > > take a callable instead of a boolean.
> > > > > In this callable we could check whether some other fields are
> filled
> > > > > out or whatever we want.
> >
> > > > > This would be a very handy feature for a very common problem.
> >
> > > > > best,
> > > > > Hejsan
> >
> > > > > On Sep 27, 7:34 am, Yo-Yo Ma  wrote:
> > > > > > Thanks, David. I've read some about the "Custom validation error
> on
> > > > > > unique_together" ticket. I imagine that if people want
> customization
> > > > > > there, required_together would need the same. The only idea I
> have
> > > > > > that seems to work for both situations is:
> >
> > > > > > required_together = (('weight', 'height', 'You must provide a
> weight
> > > > > > and height, if you intend to use either.'),)
> >
> > > > > > unique_together = (('account', 'sku', 'This sku is already in use
> by
> > > > > > your company.'),)
> >
> > > > > > On Sep 27, 1:22 am, "David P. Novakovic" <
> davidnovako...@gmail.com>
> > > > > > wrote:
> >
> > > > > > > Is it? I read this as different to anything in the ORM.
> >
> > > > > > > This is about conditionally requiring a second field if one is
> > > filled
> > > > > > > out. Normally it would be done at the JS level.
> >
> > > > > > > I think it's a good idea, assuming I haven't missed something
> that
> > > > > > > already does this.
> >
> > > > > > > I can't help thinking this is part of a much larger problem
> though.
> > > > > > > That problem is multifield validation. I think we'd have to
> 

Re: Proposal: Meta.required_together

2010-10-03 Thread LookMa NoSQL
Tino, are you joking? Did you even bother to read the OP's proposal. I
think there is a real lack of patience when you spend the time writing
what the OP has written without even reading it, just to try to
dismiss it.

OP:

>def clean(self):
>if any((self.weight, self.height))
>if not all((self.weight, self.height))
>raise ValidationError("Uh oh!")

On Oct 3, 2:08 pm, TiNo  wrote:
> Doesn't this do what you want?:
>
> class MyModel(models.Model):
>     weight = ..
>     height = ...
>     width = ...
>     length = ...
>
>     def clean(self):
>         from django.core.exceptions import ValidationError
>         if self.weight or self.height or self.width or self.length and
>                 not (self.weight and self.height and self.width and
> self.length):
>             raise ValidationError("Sorry, in order to use weight, height,
> width, or"
>                 " length, you have to include them all.")
>
>     def save(self, *args, **kwargs):
>         self.clean()
>         super(MyModel, self).save(*args, **kwargs)
>
> Of course it does require you to write a little more code, but it is
> possible.
>
> Besides, does the required_together mean that all fields are required when
> one is filled out, or that some are required when the first is filled out?
> What I mean is that there are many possibilities for validating a model, and
> at the moment we have quite some good tools for them. Adding another Meta
> option for a small portion of the cases doesn't seem so necessary to me...
>
> Anyway, that's just my 2c.
>
> TinO
>
> On Sun, Oct 3, 2010 at 05:58, LookMa NoSQL  wrote:
> > +1 on proposal (for what it matters).
>
> > Tina, where did you see that Django does that? The docs link you sent
> > shows regular model validation. What Mamayo is looking for, I think,
> > is the ability to add a Meta option to a  model that says
> > required_together=({fields: ('weight', 'height', 'width', 'length'),
> > error_message: "Sorry, in order to use weight, height, width, or
> > length, you have to include them all."}). At least I think that's what
> > he means. This would help me too.
>
> > On Oct 2, 10:17 am, TiNo  wrote:
> > > Hi,
>
> > > Isn't this covered by model validation [1]?
>
> > > Tino
>
> > > [1]
> >http://docs.djangoproject.com/en/dev/ref/models/instances/#validating...
>
> > > On Fri, Oct 1, 2010 at 15:59, hejsan  wrote:
> > > > Hi.
> > > > I just filed a feature request on the same or similar issue, and this
> > > > thread was brought to my attention:
> > > >http://code.djangoproject.com/ticket/14347
>
> > > > Basically the usecase is this:
> > > > Very often we have a "Published" field on our models (or "Published
> > > > date" or "Published status" etc..) It would be very nice to be able to
> > > > allow people to save instances without all the required fields being
> > > > filled in IF the article or whathaveyou is not published yet.
>
> > > > My suggestion was to allow the "required" field on the form field to
> > > > take a callable instead of a boolean.
> > > > In this callable we could check whether some other fields are filled
> > > > out or whatever we want.
>
> > > > This would be a very handy feature for a very common problem.
>
> > > > best,
> > > > Hejsan
>
> > > > On Sep 27, 7:34 am, Yo-Yo Ma  wrote:
> > > > > Thanks, David. I've read some about the "Custom validation error on
> > > > > unique_together" ticket. I imagine that if people want customization
> > > > > there, required_together would need the same. The only idea I have
> > > > > that seems to work for both situations is:
>
> > > > > required_together = (('weight', 'height', 'You must provide a weight
> > > > > and height, if you intend to use either.'),)
>
> > > > > unique_together = (('account', 'sku', 'This sku is already in use by
> > > > > your company.'),)
>
> > > > > On Sep 27, 1:22 am, "David P. Novakovic" 
> > > > > wrote:
>
> > > > > > Is it? I read this as different to anything in the ORM.
>
> > > > > > This is about conditionally requiring a second field if one is
> > filled
> > > > > > out. Normally it would be done at the JS level.
>
> > > > > > I think it's a good idea, assuming I haven't missed something that
> > > > > > already does this.
>
> > > > > > I can't help thinking this is part of a much larger problem though.
> > > > > > That problem is multifield validation. I think we'd have to address
> > > > > > that issue first before working on this specific case that is
> > probably
> > > > > > the simplest.
>
> > > > > > Maybe this has been considered before, but was dropped because the
> > > > > > idea is too hard to encapsulate in a simple Meta style option?
>
> > > > > > David
>
> > > > > > On Mon, Sep 27, 2010 at 5:18 PM, Florian Apolloner
>
> > > > > >  wrote:
> > > > > > > Please post usage questions to the users list. This is 

Re: Proposal: Meta.required_together

2010-10-03 Thread TiNo
Doesn't this do what you want?:

class MyModel(models.Model):
weight = ..
height = ...
width = ...
length = ...

def clean(self):
from django.core.exceptions import ValidationError
if self.weight or self.height or self.width or self.length and
not (self.weight and self.height and self.width and
self.length):
raise ValidationError("Sorry, in order to use weight, height,
width, or"
" length, you have to include them all.")

def save(self, *args, **kwargs):
self.clean()
super(MyModel, self).save(*args, **kwargs)

Of course it does require you to write a little more code, but it is
possible.

Besides, does the required_together mean that all fields are required when
one is filled out, or that some are required when the first is filled out?
What I mean is that there are many possibilities for validating a model, and
at the moment we have quite some good tools for them. Adding another Meta
option for a small portion of the cases doesn't seem so necessary to me...

Anyway, that's just my 2c.

TinO


On Sun, Oct 3, 2010 at 05:58, LookMa NoSQL  wrote:

> +1 on proposal (for what it matters).
>
> Tina, where did you see that Django does that? The docs link you sent
> shows regular model validation. What Mamayo is looking for, I think,
> is the ability to add a Meta option to a  model that says
> required_together=({fields: ('weight', 'height', 'width', 'length'),
> error_message: "Sorry, in order to use weight, height, width, or
> length, you have to include them all."}). At least I think that's what
> he means. This would help me too.
>
> On Oct 2, 10:17 am, TiNo  wrote:
> > Hi,
> >
> > Isn't this covered by model validation [1]?
> >
> > Tino
> >
> > [1]
> http://docs.djangoproject.com/en/dev/ref/models/instances/#validating...
> >
> > On Fri, Oct 1, 2010 at 15:59, hejsan  wrote:
> > > Hi.
> > > I just filed a feature request on the same or similar issue, and this
> > > thread was brought to my attention:
> > >http://code.djangoproject.com/ticket/14347
> >
> > > Basically the usecase is this:
> > > Very often we have a "Published" field on our models (or "Published
> > > date" or "Published status" etc..) It would be very nice to be able to
> > > allow people to save instances without all the required fields being
> > > filled in IF the article or whathaveyou is not published yet.
> >
> > > My suggestion was to allow the "required" field on the form field to
> > > take a callable instead of a boolean.
> > > In this callable we could check whether some other fields are filled
> > > out or whatever we want.
> >
> > > This would be a very handy feature for a very common problem.
> >
> > > best,
> > > Hejsan
> >
> > > On Sep 27, 7:34 am, Yo-Yo Ma  wrote:
> > > > Thanks, David. I've read some about the "Custom validation error on
> > > > unique_together" ticket. I imagine that if people want customization
> > > > there, required_together would need the same. The only idea I have
> > > > that seems to work for both situations is:
> >
> > > > required_together = (('weight', 'height', 'You must provide a weight
> > > > and height, if you intend to use either.'),)
> >
> > > > unique_together = (('account', 'sku', 'This sku is already in use by
> > > > your company.'),)
> >
> > > > On Sep 27, 1:22 am, "David P. Novakovic" 
> > > > wrote:
> >
> > > > > Is it? I read this as different to anything in the ORM.
> >
> > > > > This is about conditionally requiring a second field if one is
> filled
> > > > > out. Normally it would be done at the JS level.
> >
> > > > > I think it's a good idea, assuming I haven't missed something that
> > > > > already does this.
> >
> > > > > I can't help thinking this is part of a much larger problem though.
> > > > > That problem is multifield validation. I think we'd have to address
> > > > > that issue first before working on this specific case that is
> probably
> > > > > the simplest.
> >
> > > > > Maybe this has been considered before, but was dropped because the
> > > > > idea is too hard to encapsulate in a simple Meta style option?
> >
> > > > > David
> >
> > > > > On Mon, Sep 27, 2010 at 5:18 PM, Florian Apolloner
> >
> > > > >  wrote:
> > > > > > Please post usage questions to the users list. This is already
> doable
> > > > > > with model validation.
> >
> > > > > > Florian
> >
> > > > > > --
> > > > > > You received this message because you are subscribed to the
> Google
> > > Groups "Django developers" group.
> > > > > > To post to this group, send email to
> > > django-develop...@googlegroups.com.
> > > > > > To unsubscribe from this group, send email to
> > > django-developers+unsubscr...@googlegroups.com
> 

Re: Proposal: Meta.required_together

2010-10-02 Thread LookMa NoSQL
+1 on proposal (for what it matters).

Tina, where did you see that Django does that? The docs link you sent
shows regular model validation. What Mamayo is looking for, I think,
is the ability to add a Meta option to a  model that says
required_together=({fields: ('weight', 'height', 'width', 'length'),
error_message: "Sorry, in order to use weight, height, width, or
length, you have to include them all."}). At least I think that's what
he means. This would help me too.

On Oct 2, 10:17 am, TiNo  wrote:
> Hi,
>
> Isn't this covered by model validation [1]?
>
> Tino
>
> [1]http://docs.djangoproject.com/en/dev/ref/models/instances/#validating...
>
> On Fri, Oct 1, 2010 at 15:59, hejsan  wrote:
> > Hi.
> > I just filed a feature request on the same or similar issue, and this
> > thread was brought to my attention:
> >http://code.djangoproject.com/ticket/14347
>
> > Basically the usecase is this:
> > Very often we have a "Published" field on our models (or "Published
> > date" or "Published status" etc..) It would be very nice to be able to
> > allow people to save instances without all the required fields being
> > filled in IF the article or whathaveyou is not published yet.
>
> > My suggestion was to allow the "required" field on the form field to
> > take a callable instead of a boolean.
> > In this callable we could check whether some other fields are filled
> > out or whatever we want.
>
> > This would be a very handy feature for a very common problem.
>
> > best,
> > Hejsan
>
> > On Sep 27, 7:34 am, Yo-Yo Ma  wrote:
> > > Thanks, David. I've read some about the "Custom validation error on
> > > unique_together" ticket. I imagine that if people want customization
> > > there, required_together would need the same. The only idea I have
> > > that seems to work for both situations is:
>
> > > required_together = (('weight', 'height', 'You must provide a weight
> > > and height, if you intend to use either.'),)
>
> > > unique_together = (('account', 'sku', 'This sku is already in use by
> > > your company.'),)
>
> > > On Sep 27, 1:22 am, "David P. Novakovic" 
> > > wrote:
>
> > > > Is it? I read this as different to anything in the ORM.
>
> > > > This is about conditionally requiring a second field if one is filled
> > > > out. Normally it would be done at the JS level.
>
> > > > I think it's a good idea, assuming I haven't missed something that
> > > > already does this.
>
> > > > I can't help thinking this is part of a much larger problem though.
> > > > That problem is multifield validation. I think we'd have to address
> > > > that issue first before working on this specific case that is probably
> > > > the simplest.
>
> > > > Maybe this has been considered before, but was dropped because the
> > > > idea is too hard to encapsulate in a simple Meta style option?
>
> > > > David
>
> > > > On Mon, Sep 27, 2010 at 5:18 PM, Florian Apolloner
>
> > > >  wrote:
> > > > > Please post usage questions to the users list. This is already doable
> > > > > with model validation.
>
> > > > > Florian
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > Groups "Django developers" group.
> > > > > To post to this group, send email to
> > django-develop...@googlegroups.com.
> > > > > To unsubscribe from this group, send email to
> > django-developers+unsubscr...@googlegroups.com
> > .
> > > > > For more options, visit this group athttp://
> > groups.google.com/group/django-developers?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django developers" group.
> > To post to this group, send email to django-develop...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-developers+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-developers?hl=en.

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



Re: Proposal: Meta.required_together

2010-10-02 Thread TiNo
Hi,

Isn't this covered by model validation [1]?

Tino

[1]
http://docs.djangoproject.com/en/dev/ref/models/instances/#validating-objects

On Fri, Oct 1, 2010 at 15:59, hejsan  wrote:

> Hi.
> I just filed a feature request on the same or similar issue, and this
> thread was brought to my attention:
> http://code.djangoproject.com/ticket/14347
>
> Basically the usecase is this:
> Very often we have a "Published" field on our models (or "Published
> date" or "Published status" etc..) It would be very nice to be able to
> allow people to save instances without all the required fields being
> filled in IF the article or whathaveyou is not published yet.
>
> My suggestion was to allow the "required" field on the form field to
> take a callable instead of a boolean.
> In this callable we could check whether some other fields are filled
> out or whatever we want.
>
> This would be a very handy feature for a very common problem.
>
> best,
> Hejsan
>
>
> On Sep 27, 7:34 am, Yo-Yo Ma  wrote:
> > Thanks, David. I've read some about the "Custom validation error on
> > unique_together" ticket. I imagine that if people want customization
> > there, required_together would need the same. The only idea I have
> > that seems to work for both situations is:
> >
> > required_together = (('weight', 'height', 'You must provide a weight
> > and height, if you intend to use either.'),)
> >
> > unique_together = (('account', 'sku', 'This sku is already in use by
> > your company.'),)
> >
> > On Sep 27, 1:22 am, "David P. Novakovic" 
> > wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Is it? I read this as different to anything in the ORM.
> >
> > > This is about conditionally requiring a second field if one is filled
> > > out. Normally it would be done at the JS level.
> >
> > > I think it's a good idea, assuming I haven't missed something that
> > > already does this.
> >
> > > I can't help thinking this is part of a much larger problem though.
> > > That problem is multifield validation. I think we'd have to address
> > > that issue first before working on this specific case that is probably
> > > the simplest.
> >
> > > Maybe this has been considered before, but was dropped because the
> > > idea is too hard to encapsulate in a simple Meta style option?
> >
> > > David
> >
> > > On Mon, Sep 27, 2010 at 5:18 PM, Florian Apolloner
> >
> > >  wrote:
> > > > Please post usage questions to the users list. This is already doable
> > > > with model validation.
> >
> > > > Florian
> >
> > > > --
> > > > You received this message because you are subscribed to the Google
> Groups "Django developers" group.
> > > > To post to this group, send email to
> django-develop...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com
> .
> > > > For more options, visit this group athttp://
> groups.google.com/group/django-developers?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to django-develop...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>
>

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



Re: Proposal: Meta.required_together

2010-10-01 Thread hejsan
Hi.
I just filed a feature request on the same or similar issue, and this
thread was brought to my attention:
http://code.djangoproject.com/ticket/14347

Basically the usecase is this:
Very often we have a "Published" field on our models (or "Published
date" or "Published status" etc..) It would be very nice to be able to
allow people to save instances without all the required fields being
filled in IF the article or whathaveyou is not published yet.

My suggestion was to allow the "required" field on the form field to
take a callable instead of a boolean.
In this callable we could check whether some other fields are filled
out or whatever we want.

This would be a very handy feature for a very common problem.

best,
Hejsan


On Sep 27, 7:34 am, Yo-Yo Ma  wrote:
> Thanks, David. I've read some about the "Custom validation error on
> unique_together" ticket. I imagine that if people want customization
> there, required_together would need the same. The only idea I have
> that seems to work for both situations is:
>
> required_together = (('weight', 'height', 'You must provide a weight
> and height, if you intend to use either.'),)
>
> unique_together = (('account', 'sku', 'This sku is already in use by
> your company.'),)
>
> On Sep 27, 1:22 am, "David P. Novakovic" 
> wrote:
>
>
>
>
>
>
>
> > Is it? I read this as different to anything in the ORM.
>
> > This is about conditionally requiring a second field if one is filled
> > out. Normally it would be done at the JS level.
>
> > I think it's a good idea, assuming I haven't missed something that
> > already does this.
>
> > I can't help thinking this is part of a much larger problem though.
> > That problem is multifield validation. I think we'd have to address
> > that issue first before working on this specific case that is probably
> > the simplest.
>
> > Maybe this has been considered before, but was dropped because the
> > idea is too hard to encapsulate in a simple Meta style option?
>
> > David
>
> > On Mon, Sep 27, 2010 at 5:18 PM, Florian Apolloner
>
> >  wrote:
> > > Please post usage questions to the users list. This is already doable
> > > with model validation.
>
> > > Florian
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Django developers" group.
> > > To post to this group, send email to django-develop...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > django-developers+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/django-developers?hl=en.

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



Re: Proposal: Meta.required_together

2010-09-27 Thread Yo-Yo Ma
Thanks, David. I've read some about the "Custom validation error on
unique_together" ticket. I imagine that if people want customization
there, required_together would need the same. The only idea I have
that seems to work for both situations is:

required_together = (('weight', 'height', 'You must provide a weight
and height, if you intend to use either.'),)

unique_together = (('account', 'sku', 'This sku is already in use by
your company.'),)

On Sep 27, 1:22 am, "David P. Novakovic" 
wrote:
> Is it? I read this as different to anything in the ORM.
>
> This is about conditionally requiring a second field if one is filled
> out. Normally it would be done at the JS level.
>
> I think it's a good idea, assuming I haven't missed something that
> already does this.
>
> I can't help thinking this is part of a much larger problem though.
> That problem is multifield validation. I think we'd have to address
> that issue first before working on this specific case that is probably
> the simplest.
>
> Maybe this has been considered before, but was dropped because the
> idea is too hard to encapsulate in a simple Meta style option?
>
> David
>
> On Mon, Sep 27, 2010 at 5:18 PM, Florian Apolloner
>
>  wrote:
> > Please post usage questions to the users list. This is already doable
> > with model validation.
>
> > Florian
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django developers" group.
> > To post to this group, send email to django-develop...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-developers+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-developers?hl=en.

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



Re: Proposal: Meta.required_together

2010-09-27 Thread Florian Apolloner


On Sep 27, 9:22 am, "David P. Novakovic" 
wrote:
> Is it? I read this as different to anything in the ORM.
Well either way; he could have been more specific which stuff he is
talking about (remember the only classes having Meta are Modelform and
Model -- at least does are the two where I use it on a regular base)

> This is about conditionally requiring a second field if one is filled
> out. Normally it would be done at the JS level.
JS level + Server level

> I think it's a good idea, assuming I haven't missed something that
> already does this.
Yes, form.clean and the model validation can do it.

> I can't help thinking this is part of a much larger problem though.
> That problem is multifield validation. I think we'd have to address
> that issue first before working on this specific case that is probably
> the simplest.
Why is multifield validation a problem? I works (tm).

Florian

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



Re: Proposal: Meta.required_together

2010-09-27 Thread David P. Novakovic
Is it? I read this as different to anything in the ORM.

This is about conditionally requiring a second field if one is filled
out. Normally it would be done at the JS level.

I think it's a good idea, assuming I haven't missed something that
already does this.

I can't help thinking this is part of a much larger problem though.
That problem is multifield validation. I think we'd have to address
that issue first before working on this specific case that is probably
the simplest.

Maybe this has been considered before, but was dropped because the
idea is too hard to encapsulate in a simple Meta style option?

David

On Mon, Sep 27, 2010 at 5:18 PM, Florian Apolloner
 wrote:
> Please post usage questions to the users list. This is already doable
> with model validation.
>
> Florian
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django developers" group.
> To post to this group, send email to django-develop...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-developers?hl=en.
>
>

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



Re: Proposal: Meta.required_together

2010-09-27 Thread Yo-Yo Ma
This is a feature request. I'm not asking how to do it. If you read,
I've shown the current method of doing this in clean(). I'm proposing
the addition of an additional Meta option to allow for automatically
adding this behavior.

On Sep 27, 1:18 am, Florian Apolloner  wrote:
> Please post usage questions to the users list. This is already doable
> with model validation.
>
> Florian

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



Re: Proposal: Meta.required_together

2010-09-27 Thread Florian Apolloner
Please post usage questions to the users list. This is already doable
with model validation.

Florian

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