django-nested-inline icon indicating copy to clipboard operation
django-nested-inline copied to clipboard

add button adds only first level inline

Open ghost opened this issue 12 years ago • 13 comments
trafficstars

Hi,

Something wrong with my setup. I'm using django 1.4.5 and the lates nested-inline from git. It creates at the start form with nested inlines without any problems. Unfortunately "add new" button doesn't work properly: it adds only first level inline.

It looks like, something incorrect in template: it creates empty-form block for first level inline and creates nothing with empty-form class for nested-inline-row.

I'm not sure if it is the problem, anyway something is incorrect. :)

ghost avatar Aug 12 '13 20:08 ghost

Can I see your admin and models code?

s-block avatar Aug 20 '13 17:08 s-block

Sure.

admin.py: http://pastebin.com/t4VS4v6L models.py: http://pastebin.com/9sY3bSmq

ghost avatar Aug 20 '13 20:08 ghost

any update?

ghost avatar Sep 02 '13 13:09 ghost

Same problem here!

luddement avatar Sep 03 '13 09:09 luddement

Any update? @s-block ? Thanks in advance. :D

madEng84 avatar Apr 24 '14 10:04 madEng84

Has somebody found solution of this problem?

agurinov avatar Jun 30 '14 17:06 agurinov

I have added a fix for the tabular template in the latest version of master.

s-block avatar Sep 11 '14 13:09 s-block

@s-block , I believe I'm still having this issue. The first row of inlines is created on page load, as it should, but their "Add another..." buttons fail to create the child inline.

For example, clicking this button:

... generates this:

... when it should generate this:

I'm running django 1.6.5 with django-nested-inline 0.3.3 . If you can point me to what might be causing this I would be glad to help out as well! Thanks

natejlong avatar Oct 27 '14 17:10 natejlong

I experienced a similar issue. My temporary fix was to set extra = 1 for the Inline in the admin. I would prefer to use extra = 0, if someone can fix this problem.

celiao avatar Oct 27 '14 17:10 celiao

This comment explains the method behind this code: https://code.djangoproject.com/ticket/9025#comment:155

It seems that it just depends on a nested inline already existing before it knows how to make a new one, so I think we're stuck unless we come at it from a different angle than the code in ticket 9025.

The other major package based on 9025 (https://github.com/silverfix/django-nested-inlines) also has this same problem, based on my experience.

natejlong avatar Oct 27 '14 20:10 natejlong

Thanks, @natejlong. Your comments remind me of another issue. I had to put my nested inlines at the end of my inlines = [] array to get it to work.

celiao avatar Oct 27 '14 23:10 celiao

I will hopefully get a chance to look at this in the next few days.

s-block avatar Oct 28 '14 09:10 s-block

Im getting this when using the same model for my inlines. Because the inline forms will get the same prefix names.

Don't know whats the normal inline behaviour is for this but using a proxy model for each inline should be a workable workaround.

lostb1t avatar Dec 08 '14 12:12 lostb1t