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

OBJECT needs to have a value for field "FIELD" before this many-to-many relationship can be used error #31

Open
boylesnick opened this issue Jan 6, 2017 · 0 comments

Comments

@boylesnick
Copy link

Hi there,

I'm trying to use modelclone to duplicate an object where two fields are required and need to be unique. I'm using the exact setup explained in the readme and am able to get a prepopulated modelform. Without changing anything and trying to save, I get the correct validation response, where it denies the save because the data is exactly the same as a database object. If I change the two fields that are required for the change I get the following error:

""<Pattern: 1,2,3-benzotriazole_NEWTEST>" needs to have a value for field "pattern" before this many-to-many relationship can be used." and the traceback points to:

PATH/python2.7/site-packages/modelclone/admin.py in clone_view
ModelForm = self.get_form(request)
formsets = []
if request.method == 'POST':
form = ModelForm(request.POST, request.FILES)
if form.is_valid():
new_object = self.save_form(request, form, change=False) ...
form_validated = True
else:
new_object = self.model()
form_validated = False
prefixes = {}

Where the field "pattern" is a text field. Has anyone experienced this?

Thanks
--Nick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant