I see more than one problem with your code. StackedInline is only used for 
models that have a one to many relationship and not the otherway around, in 
other words, you can have Docs stacked in line on the Client page but not 
the other way around, because only ONE client owns the document. You will 
see who owns it unless you have editable=False in your foreignkey.  The 
code should look like this:

#Model
class Client(models.Model):
    name= models.CharField(max_length=25)
    ...

class Docs(models.Model):
    name= models.CharField(max_length=25)
    ...
    client  = models.ForeignKey(Client)

#Admin
class Detail_Doc(admin.StackedInline):
    model = Docs

class DocAdmin(admin.ModelAdmin):
    pass

class ClientAdmin(admin.ModelAdmin):
    inlines = [Detail_Doc,]

admin.site.register(Doc, DocAdmin)
admin.site.register(Client, ClientAdmin)


Thank you,
Victor Rocha
www.rochapps.com

On Wednesday, February 6, 2013 8:02:53 AM UTC-5, grat wrote:
>
> Hi,
>
> i have this code:
>
> #Model
> class Client(models.Model):
>     name= models.CharField(max_length=25)
>     ...
>
> class Docs(models.Model):
>     name= models.CharField(max_length=25)
>     ...
>     client  = models.ForeignKey(Client)
>
> #Admin
> class Detail_Doc(admin.StackedInline):
>     model = Docs
>
> class Detail_Client(admin.StackedInline):
>     model = Client
>
> class DocAdmin(admin.ModelAdmin):
>     inlines = [Detail_Client,]
>
> class ClientAdmin(admin.ModelAdmin):
>     inlines = [Detail_Docs,]
>
> admin.site.register(Doc,DocAdmin)
> admin.site.register(Client,ClientAdmin)
>
> what i want:
> a) in pages where is DOC i need see owner this Doc
> b) in pages in client i want to see DOC owned 
>
> Sorry for simple QA, but i only starting learn Django
>
> Milan
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to