On 6/10/06, Justin <[EMAIL PROTECTED]> wrote:
> I toyed with the idea of a custom Manager but wanted to see first if
> Django already handled this scenerio "out of the box" and I was just
> missing it.
Yeah, Django covers it, you just need to add 'blank=True' as well; as
Luke pointed out, 'null'
Yeah, what I have is:
class Container(models.Model):
parent = models.ForeignKey('self', null=True, related_name='child')
I toyed with the idea of a custom Manager but wanted to see first if
Django already handled this scenerio "out of the box" and I was just
missing it.
--~--~-~--~--
On Saturday 10 June 2006 16:46, Todd O'Bryan wrote:
> On Jun 10, 2006, at 11:41 AM, Justin wrote:
> > I was following the Model Ex. 11 "Relating an object to itself,
> > many-to-one" in an attempt to create nested containers. I'm running
> > into the problem that at the start there is no parent f
won't this work for you:
class Node(Model):
parent = ForeignKey('self', blank=True, null=True)
... rest of your model...
then fetch it like Node.objects.filter(parent__isnull=True)
if you are worried with the possibility of ending up with mode that
one root node you could do either (bot
On Jun 10, 2006, at 11:41 AM, Justin wrote:
>
> I was following the Model Ex. 11 "Relating an object to itself,
> many-to-one" in an attempt to create nested containers. I'm running
> into the problem that at the start there is no parent for newly
> created
> objects to relate too. Is there a w
I was following the Model Ex. 11 "Relating an object to itself,
many-to-one" in an attempt to create nested containers. I'm running
into the problem that at the start there is no parent for newly created
objects to relate too. Is there a way to handle this from the Model or
do I need to just fire
6 matches
Mail list logo