Guest User

Untitled

a guest
Dec 14th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. from django.db import models
  2.  
  3. class Collection(models.Model):
  4. name = models.CharField(max_length=50)
  5. prod_category = models.CharField(max_length=50)
  6. description = models.TextField()
  7. manufacturer = models.TextField()
  8. num_products = models.IntegerField()
  9. image_url = models.URLField()
  10.  
  11. from oscar.apps.catalogue.abstract_models import AbstractProduct
  12.  
  13. class Product(AbstractProduct):
  14. collection = models.ForeignKey(Collection, on_delete=models.CASCADE)
  15. multiplier = models.DecimalField(max_digits=2, decimal_places=1)
  16.  
  17. from oscar.apps.catalogue.models import *
  18.  
  19. Running migrations:
  20. Applying catalogue.0014_auto_20181211_1617...Traceback (most recent call last):
  21. File "/home/mysite/lib/python3.7/Django-2.1.3-py3.7.egg/django/db/backends/utils.py", line 85, in _execute
  22. return self.cursor.execute(sql, params)
  23. psycopg2.IntegrityError: insert or update on table "catalogue_product" violates foreign key constraint "catalogue_product_collection_id_e8789e0b_fk_catalogue"
  24. DETAIL: Key (collection_id)=(1) is not present in table "catalogue_collection".
Add Comment
Please, Sign In to add comment