Hi Gergely,

many thanks for your quick reply!

Am 2015-07-16 um 18:15 schrieb Gergely Polonkai:
1) create the "through" model, add it to the migration file
2) migrate all m2m instances (e.g. iterate over all Bereich objects then
iterate through its users, creating a UserBereichAssignment object for
each (all this done in a migrations.RunPython call)

Ok. I've never used migrations.RunPython before, but I'm quite confident that I can manage it.

Would the migration for step 2) be a separate migration file from step 1), or is the migration file of step 1) edited to cover step 2) as well?

3) change the m2m field by adding the through option, and add this
change to the migrations file.

Same question: Is this supposed to go into a separate migration file or into the common migrations file from above?

And won't this last step trigger the same error as before? ("... you cannot alter to or from M2M fields, or add or remove through= on M2M fields") ?

(Not so important, but out of curiosity: This won't get us rid of the old, implicit intermediate table, will it?)

However, you may want to go with django-guardian and thus, with
object-level permissions instead ;)

Thanks for mentioning this!

I've started looking into it, but the only user-code example that I've been able to find so far is in the middle of https://github.com/djangoadvent/djangoadvent-articles/blob/master/1.2/06_object-permissions.rst Are there any other examples that demonstrate the purpose and usage of this package?


Many thanks and best regards,
Carsten

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

Reply via email to