So closed problem with me. My model's parent is itself. I mean, I want it
like that.
class Content(models.Model):
subtitle = models.CharField(blank=True, max_length=300,
help_text='Something is coming.')
title = models.CharField(max_length=300, unique=True,
help_text='Something is coming.')
slug = models.SlugField(db_index=True, unique=True)
spot = models.TextField()
content = models.TextField()
key_words = models.TextField(blank=True)
short_exp = models.TextField(blank=True)
avatar = models.ImageField(upload_to='images/content/', blank=True)
gallery = models.ManyToManyField(Gallery, blank=True)
relateds = models.ManyToManyField('self', blank=True)
parent = models.ForeignKey('self', blank=True, related_name='parent_id',
verbose_name='parent content', null=True)
Firstly I want to make possible it can be left blank. But django says me
parent_id' cannot be null
when i leave it blank. And secondly can I define a default value for it.
Thank you..
2008/9/14 Daniel Roseman <[EMAIL PROTECTED]>
>
> On Sep 14, 9:05 am, Donn <[EMAIL PROTECTED]> wrote:
> > Hi,
> > I have been looking, but can't find.
> >
> > I have a Client model with a Website inline (related by FK). it's open in
> a
> > change screen in the admin.
> > The inline below has a field that refers to the parent Client.
> > That field is a drop-down showing many Clients.
> >
> > Is there any way to tell the inline to use the Client name that I am
> currently
> > editing anyway?
> >
> > If I edit Client A it seems silly to have to choose "A" again from the
> inline
> > for each row I want to add/edit.
> >
> > Just wondering. A client is bound to ask "can you just..." :)
> > \d
>
> That should happen automatically - you shouldn't see the foreign key
> to the parent model. Can you post your model and admin code on
> dpaste.com so we can work out what's wrong?
>
> --
> DR.
> >
>
--
Ali Deniz EREN
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---