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

Cart constraints referring to base product, instead of category product #9

Open
stevebma opened this issue Oct 29, 2013 · 4 comments
Open

Comments

@stevebma
Copy link

Noticed this issue when switching to mysql db (from sqlite)

A constraint on the shop_cartitem table results in an exception when adding a category-product to the cart.

The constraint is:
product_id from shop_cartitem should an id from shop_product.

This is not correct when using this app, because it should be an id from shop_categories_categoryproduct

(The constraint is easily adjusted manually in phpmyadmin)

@fivethreeo
Copy link
Owner

This happens if you run syncdb and change the productmodel afterwards? If so this is expected.

@stevebma
Copy link
Author

This happened when deploying my application. Syncdb/migrate on a fresh,
empty mysql DB, no code was touched.
The problem may also be in the cart code, not sure :)

2013/10/29 Øyvind Saltvik [email protected]

This happens if you run syncdb and change the productmodel afterwards? If
so this is expected.


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-27350117
.

@fivethreeo
Copy link
Owner

You did syncdb --all and migrate --fake? If that works i suspect it is the migrations fault.

@fivethreeo
Copy link
Owner

Seems to me like south takes orm["shop.Product"] literally as "shop_product" not "%s_%s" % (model._meta.app_label, model._meta.model_name).

Alternative 1: Rename the default product model for shop_categories to Product and set app_label to "shop".
Alternative 2: Fix the migration in the shop to get it's model string from SHOP_PRODUCT_MODEL.

  1. Would be easier to do NOW.
  2. Would be less confusing for people replacing models

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

2 participants