Hi!

Maybe I did not fully understand but it seems we indeed don't talk about 
the same.
I already got M2M relation.
If I access the "Jobs" admin-page, I have the option to add inline-options.
On a new object, there are no lines but I can add new.
I would like to add lines for the attributes from M2M relation of (Actions 
-> Attributes).
Every action has a different set of attributes that needs to be defined. If 
I open the admin page for Jobs, it would need to refresh (or AJAX) the form 
to display the correct default set of attributes in the inline area, as 
soon as I choose / change the Action type.

Pseudo: With HTML and JS I would listen for a change event, then AJAX an 
API for the attributes. Then I would clear the inline-area and add new rows 
for each mandatory attribute.

I wonder if this is possible with Django alone, without building a view.

Kind regards
Kevin


Am Samstag, 19. Januar 2019 21:47:45 UTC+1 schrieb Mohammad Etemaddar:
>
> If I get you right you need to add m2m objects with a default value.
> In this situation, you can create an intermediate model to build m2m.
> For example:
> JobActionRel:
> job = fk
> action = fk-to-actions (default=Action.objects.get...)
>
> And use it as through model:
>
> https://docs.djangoproject.com/en/2.1/topics/db/models/#extra-fields-on-many-to-many-relationships
>
> Now, in admin you see the default action.
> Remember, before making it through, create JobActionRels from previous m2m 
> objects.
>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/871c12e5-909e-49ab-9f33-a480607e6490%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to