New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InlinePanels with min_num are incorrectly ordered on first save #9391
Comments
@gasman Are you working on this? |
@MaryAyobami we generally don’t assign issues to anyone directly except the core team. All contributors can choose to work on any issue they like. You’re very welcome to work on this, though if you’ve not done contributions to InlinePanel before this might be a tough one. First step would be to check what in the code causes this initial form to be added to the formset with a blank order – and based on this, decide what to change. |
Alright I'd start working on it |
@MaryAyobami how are you going with this one? Have you been able to reproduce the problem? I'm happy to help with this as it would be good to see if we can fix this in time for 4.1 - feel free to reach out on Slack also. |
@lb- I don't think this would be a candidate for 4.1 - after feature freeze we only really want to apply bugfixes if they're regressions in that particular release (or serious enough that they'd be backported to other currently-supported releases). |
no problems, thanks Matt |
@Nazi-pikachu Sure, go ahead! |
Hi @gasman @lb- sorry LB, if my tag bothers you here as I have already reached out on Slack (as you offered some help in your previous comment). My Findings are: After inspecting request.POST
the order being sent from frontend is an empty string I am not that much knowledeable in html... I think the data is being sent from client/src/components/InlinePanel/index.js if I am not wrong. However, console.log doesn't seem to be effective for me to debug, am I on the right path? How should I go about debugging the frontend. I tried using |
@GeekGawd have you got your local developer set up working? You should be able to enter a debugger statement and then have it trigger when working locally. I am not 100% sure on the underlying problem at the moment but sounds like you are heading in the right direction. Another way to go about this is to try to reproduce the problem in the unit test file and then debug/resolve from there? |
@lb- Yep i have got my local development setup up and running, the hot-reload works when I make changes to the wagtail project. Well, I will try to get my hands dirty with html and js, and will reach out to you if I reach a dead end, Thanks! |
FWIW, I think this is probably a Django issue rather than an HTML / JS one - I'm pretty sure the ORDER field is blank in the initial form objects that get constructed on page creation, when we really want them to be pre-populated with their initial index numbers. |
@lb- So, weeks into this, I think I am certain whats happening... I have noticed that Initial-Form is always 0 in wagtail however, this is wrong, because as per django, you can clearly that the forms order only gets pre filled during initial form creation. The problem is when frontend first fires to make new Inline Panels, it is not passing |
@GeekGawd sorry for the delayed response - your reasoning seems sound but I have not done a deep dive myself. Do you have an idea about how we would fix this? |
@lb- I can't confirm this but I think when the inline panels are initialized, the |
Issue Summary
When an
InlinePanel
is defined with amin_num
argument, an initial empty form is placed on the page. This form is given a blank Order value, which causes it to be ordered after any subsequently added forms when saved.Steps to Reproduce
wagtail start orderabletest
./manage.py makemigrations
/./manage.py migrate
/./manage.py createsuperuser
/./manage.py runserver
Expected behaviour: the form is reshown with "teaser 1" above "teaser 2"
Actual behaviour: "teaser 2" appears first
Technical details
The text was updated successfully, but these errors were encountered: