Re: How to create such a model?

2009-03-09 Thread Alex Gaynor
On Mon, Mar 9, 2009 at 9:09 AM, uprising wrote: > > Thanks for your fast reply.. > You mean unique_together=(node_a, node_b)? > No, that's not what I meant. > > I want to make sure if someone has created > Edge(node_a=x, node_b=y).save() > he can't add > Edge(node_a=y, node_b=x).save() > becaus

Re: How to create such a model?

2009-03-09 Thread uprising
Thanks for your fast reply.. You mean unique_together=(node_a, node_b)? No, that's not what I meant. I want to make sure if someone has created Edge(node_a=x, node_b=y).save() he can't add Edge(node_a=y, node_b=x).save() because edge is a set of two distinct nodes. On Mar 9, 8:54 pm, Alex Ga

Re: How to create such a model?

2009-03-09 Thread Alex Gaynor
On Mon, Mar 9, 2009 at 8:52 AM, uprising wrote: > > Just reminded of a problem by this post, how can I validate a unique > pair of nodes like this: > > class Edge(models.Model): >node_a: models.ForeignKey(Node) >node_b: models.ForeignKey(Node) > > I mean if I already have {"node_a

Re: How to create such a model?

2009-03-09 Thread uprising
Just reminded of a problem by this post, how can I validate a unique pair of nodes like this: class Edge(models.Model): node_a: models.ForeignKey(Node) node_b: models.ForeignKey(Node) I mean if I already have {"node_a": 1, "node_b": 2}, I can't add {"node_a": 2, "node_b": 1} How

Re: How to create such a model?

2009-03-09 Thread Alex Gaynor
On Mon, Mar 9, 2009 at 7:17 AM, Reiner wrote: > > Hi, > > have a look at the documentation of field options in models: > http://docs.djangoproject.com/en/dev/ref/models/fields/#blank > > class Foo(models.Model): >this_is_required = models.CharField(...) >this_not = models.CharField(..., b

Re: How to create such a model?

2009-03-09 Thread Reiner
Hi, have a look at the documentation of field options in models: http://docs.djangoproject.com/en/dev/ref/models/fields/#blank class Foo(models.Model): this_is_required = models.CharField(...) this_not = models.CharField(..., blank=True) Regards, Reiner On Mar 9, 8:37 am, khsing wrote

How to create such a model?

2009-03-09 Thread khsing
I want create a model that contain two field and there is one of two field can not be blank. how to do it? thanks. -- A man live in jail and want to break. http://blog.khsing.net --~--~-~--~~~---~--~~ You received this message because you are subscribed to the