Skip to content
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

Duplicating questions duplicates incorrect fields #27

Open
thclark opened this issue Oct 6, 2022 · 0 comments
Open

Duplicating questions duplicates incorrect fields #27

thclark opened this issue Oct 6, 2022 · 0 comments
Assignees
Labels
bug Unintended behaviour in any area of the app

Comments

@thclark
Copy link
Contributor

thclark commented Oct 6, 2022

Bug report

What is the current behavior?

When a question is duplicated, the intention is to re-ask it, possibly making some changes beforehand.

Django's built-in 'save-as' doesn't work, because it will copy the asked and answered fields, whose values prevent further editing of the model.

We've been using modelclone, which provides a duplicate button in the admin and an intermediate view, which is kind of a patched-up version of the django change view. However, it's not brilliantly architected, or maintained properly, and a problematic issue is that the workaround for RealGeeks/django-modelclone#41 botches the context to be that of 'add' always, meaning you don't get access to the original obj when overriding render_change_form (i.e. the workaround creates other bugs).

This means that currently, when a question is duplicated:

  • any fields on an inherited model are duplicated and pre-filled, which is not the desired behaviour

What is the expected behavior?

  • The render_change_form functionality should work as expected, as opposed to behave like it's adding all the time.
  • Only the desired fields should be duplicated

Proposed solution

We need to move away from modelclone. Whilst there are other better maintained libraries out there like https://github.com/tj-django/django-clone, it's probably better to provide this functionality out-of-the-box from django-twined, with some kind of overridable behaviour to allow for question inheritance.

@thclark thclark added the bug Unintended behaviour in any area of the app label Oct 6, 2022
@thclark thclark moved this to Priority 3 (High) in Octue Board Oct 6, 2022
@thclark thclark self-assigned this Oct 6, 2022
thclark added a commit that referenced this issue Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unintended behaviour in any area of the app
Projects
Status: Priority 3 (High)
Development

No branches or pull requests

1 participant