I have a ManyToMany field that works as a raw_id_fields item. It is an
intermediary ManyToMany model class using the through='ClassName'
feature.
The admin.py shows that ManyToMany model using an Inline admin class.
The Inline class has the raw_id_fields and extras attributes. Here is
an example based on the Admin tool docs...
# models.py
class Membership(models.Model):
person = models.ForeignKey(Person)
group = models.ForeignKey(Group)
# admin.py
class MembershipInline(admin.TabularInline):
model = Membership
raw_id_fields = ('person',)
extra = 1
class PersonAdmin(admin.ModelAdmin):
# ... add other features
inlines = (MembershipInline,)
admin.site.register(Person, PersonAdmin)
The resulting admin tool generates a separate Membership ID field
(table row) with a spyglass next to it. Each spyglass sets or replaces
the single ID in that row.
The "extra" makes a new open field. Use that to add more entrties,
without deleted the others.
DISCLOSURE
This applies to an intermediary model, with a ForeignKey field, and
the "through" declaration. You may see the bug as described with an
implied "many-to-many table", which is the normal way to do this.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---