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

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

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

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',

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

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

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

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

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

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

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