For anyone else trying to figure this out, I think I found the
answer.
See InlineModelAdmin:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-objects
To translate into my example...
class PersonPositionInline(admin.TabularInline):
model = PersonPosition
class PersonAdmin(admin.ModelAdmin):
inlines = [
PersonPositionInline,
]
On May 7, 7:31 am, sggottlieb <[email protected]> wrote:
> For some reason I can't reply to this thread about Many to One (http://
> groups.google.com/group/django-users/browse_thread/thread/
> 180feab07df9dfe6/17301e3fcaa92a33?lnk=gst&q=many+to
> +one#17301e3fcaa92a33) so I will re-open here.
>
> I am looking for an answer to Puneet's question: "but if there's
> something like one-many it could implicitly tell Django to add objects
> inline with the parent object." My model has a "Person" with multiple
> "PersonPosition" (AKA job) objects. So, in my model, I have something
> like this:
>
> class PersonPosition(models.Model):
> user = models.ForeignKey(Person)
>
> Users will only creating PersonPosition objects from the person. They
> will not be creating a PersonPosition object and then picking a Person
> to relate to.
>
> Is the proper way to handle this to implement add and remove methods
> onto my Person class? How would I expose those methods into the Admin
> UI?
>
> Thanks,
>
> Seth
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---