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

Chaining not working in inlines in ChainedManyToManyField with horizontal=True parameter #350

Open
7 tasks done
KaktusOnFire opened this issue Jun 15, 2023 · 1 comment
Open
7 tasks done

Comments

@KaktusOnFire
Copy link

KaktusOnFire commented Jun 15, 2023

Checklist

Put an x in the bracket when you have completed each task, like this: [x]

  • This issue is not about installing previous versions of django-smart-selects older than 1.2.8. I understand that previous versions are insecure and will not receive any support whatsoever.
  • I have verified that that issue exists against the master branch of django-smart-selects.
  • I have debugged the issue to the smart_selects app.
  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • I have reduced the issue to the simplest possible case.
  • I have included all relevant sections of models.py, forms.py, and views.py with problems.
  • I have used GitHub Flavored Markdown to style all of my posted code.

Steps to reproduce

  1. Create inline
  2. Add chainedmanytomany field with horizontal=True parameter
  3. Try to pick any of ProductGroup values

Actual behavior

Get chained values only for product and tariff
p.s. everything works OK ONLY when i'm press save and trying to change EXISTING object
image

Expected behavior

Get chained values for product, tariff and discounts

image

Model structure


    product_group = models.ForeignKey(ProductGroup, on_delete=models.RESTRICT, default=None, null=True)
    product = ChainedForeignKey(Product,
                                chained_field="product_group",
                                chained_model_field="product_group",
                                show_all=False,
                                auto_choose=True,
                                sort=True,
                                default=None
                                )
    tariff = ChainedForeignKey("Tariff",
                               chained_field="product_group",
                               chained_model_field="product_group",
                               show_all=False,
                               auto_choose=True,
                               sort=True,
                               default=None
                               )
    discounts = ChainedManyToManyField("Discount",
                                       chained_field="product_group",
                                       chained_model_field="product_groups",
                                       default=None,
                                       blank=True,
                                       )

Console log after picking ProductGroup value

2023-06-15 16:38:11 | INFO/MainProcess | "GET /chaining/filter/crm/Tariff/product_group/crm/UserInvoiceItem/tariff/68/ HTTP/1.1" 200 286
2023-06-15 16:38:11 | INFO/MainProcess | "GET /chaining/filter/crm/Product/product_group/crm/UserInvoiceItem/product/68/ HTTP/1.1" 200 1071

Log should contains request for discounts field, but its not.

@KaktusOnFire
Copy link
Author

Any suggestions?

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