Skip to content

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

@boylesnick

Description

@boylesnick

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions