Hi all,

Currently, only M2M fields without custom intermediary models can use the
normal Django M2M form machinery. If you define your own intermediary
models, you need to use inlines instead.

I would like to allow fields with custom through models to use the regular
M2M field/widget automatically, if the through model meets the requirement
that all its extra fields either have defaults or are nullable. I'll refer
to these as "auto-compatible" models.

Making this work right now is as easy as adding "auto_created = True" to
the intermediary model's Meta. If your model is not auto-compatible, you'll
get a error when you try to add to the relation.

I would like to add official support for this. My suggestion would be:

1. Add a model Meta attribute that better describes these models, e.g.
"simple_m2m". Auto-created intermediary models should have this set to True.
2. Wherever auto_created appears in a condition, decide for each whether or
not auto-compatible models should also pass the test - if so, replaced with
a check to "simple_m2m".
3. Add code to validate that user-created models with simple_m2m True
actually do meet the above requirements.

As a note to step 2, if there is no test of auto_created that
auto-compatible models shouldn't also pass, auto_created could simply be
renamed. I doubt that though.

Thoughts?

Alex

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CA%2BKBOKykoNVUZLR_DGdYx%2Bfd87ZcpGWku25ZR8japaPG2fdReg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to