CARVIEW |
Select Language
HTTP/2 200
server: nginx
content-type: text/html;charset=utf-8
cache-control: must-revalidate
expires: Fri, 01 Jan 1999 00:00:00 GMT
set-cookie: trac_form_token=32ea81fe70d26bced8c48712; HttpOnly; Path=/; Secure
set-cookie: trac_session=4f34dc1980f85247fb4eee9c; expires=Tue, 21 Oct 2025 13:08:30 GMT; HttpOnly; Path=/; Secure
strict-transport-security: max-age=31536000; includeSubDomains; preload
permissions-policy: interest-cohort=()
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
accept-ranges: bytes
via: 1.1 varnish, 1.1 varnish
date: Wed, 23 Jul 2025 13:08:30 GMT
x-served-by: cache-fra-eddf8230061-FRA, cache-bom-vanm7210094-BOM
x-cache: MISS, MISS
x-cache-hits: 0, 0
x-timer: S1753276110.399822,VS0,VE339
vary: Accept-Encoding
CookBookPredicates – Django
Back to Top
Django
The web framework for perfectionists with deadlines.
Issues
Many to Many Intermediary Tables in Admin
The [source:django/trunk/tests/modeltests/m2m_intermediary/models.py Many-to-Many Intermediary] test case already shows how this is structured. What I add here is a set of parameters for the fields in the intermediary model that allow smooth inline editing in admin.
from django.db import models class Individual (models.Model): class Admin: pass class Event (models.Model): class Admin: pass class Participation (models.Model): event = models.ForeignKey(Event, related_name='participants', edit_inline=True, blank=True, default=None) individual = models.ForeignKey(Individual, related_name='events', edit_inline=True, blank=True, default=None) role = models.PositiveSmallIntegerField(core=True, blank=True, default=None) class Admin: pass
edit_inline=True
core=False
# So that when anIndividual
is being created along with a fewParticipations
created inline, theParticipation
records will be valid even though theIndividual
doesn't fully exist yet.blank=True, default=None
# So that untouched inline records will have blank core values and thus will not be created.
Last modified
19 years ago
Last modified on Oct 3, 2006, 8:25:54 AM
Note:
See TracWiki
for help on using the wiki.
Download in other formats:
Django Links
Learn More
Get Involved
Follow Us
- Hosting by In-kind donors
- Design by Threespot &
© 2005-2025 Django SoftwareFoundation unless otherwise noted. Django is a registered trademark of the Django Software Foundation.