views:

17

answers:

1

I have those models

class A(models.Model):
    name = CharField(max_length=255)

class B(models.Model):
    name = CharField(max_length=255)
    relation = ForeignKey(A)

And I can register like this:

admin.site.register(A)
admin.site.register(B)

In /admin/ page, I can see A and B registered. and "Add B" admin page, will display a combo with (+) icon to add a new "A". What I want is only register "B" and keep the (+) icon, the problem is: if "A" is not registered this icon dissapears of this place :( so and I cant add "A" when adding "B"s

Thanks :)

+1  A: 

relation = ForeignKey(A, null=True, blank=True) will let you save a B without needing to link it to an A. Does that help?

stevejalim