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

CompositeKey issue - django-viewflow compatibility #218

Open
McQueTX opened this issue Mar 30, 2022 · 0 comments
Open

CompositeKey issue - django-viewflow compatibility #218

McQueTX opened this issue Mar 30, 2022 · 0 comments

Comments

@McQueTX
Copy link

McQueTX commented Mar 30, 2022

I unfortunately have to deal with legacy tables that are linking tables without a pk. The package django-viewflow==2.0.0a2 allows us to create a virtual field that is a composite of the 2 foreign keys in the linking table. i.e. id='{"tbl1_kf": 123, "tbl2_fk": 456}'

There are 2 compatibility issues I am having:

  1. The formsets.py get_queryset qs.filter(pk__in) was breaking pmysql. I was able to work around using json.loads() to split the key when the model uses the virtual field.
  2. The tbl2_fk is the only field that is editable in the form as it is not the foreign key to the inline's parent. If anything inside the formset is clicked the tbl2_fk select goes blank. Submiting the form throws a validation error saying tbl2_fk is required even though a value is selected before submitting.

I am assuming the second issue is in the js since the tbl2_fk field value never makes it back to my app. If you have any ideas on where I should look in the js file to try to fix the issue that would be greatly appreciated!

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