Django-parler IntegrityError when add new object in admin












0















I have this error when try to save new object. Trying to ask google, nothing helpful. I think my problem is different id for Product and translation table, but i don't know how to fix this. Sorry for my english.



django==1.10.7 django-parler==1.8




Exception Type: IntegrityError



Exception Value:

insert or update on table "pcart_catalog_product_translation" violates foreign key constraint "pcart_catalog_pr_master_id_571a2ec0_fk_pcart_catalog_product_id"
DETAIL: Key (master_id)=(a74f5571-512d-4bd5-9164-0388dd22bcd8) is not present in table "pcart_catalog_product".




This is part of my object:



class Product(TranslatableModel):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
slug = models.SlugField(_('Slug'), max_length=255, unique=True)
external_id = models.CharField(
_('External ID'), default='', blank=True, max_length=255, db_index=True)

translations = TranslatedFields(
title=models.CharField(_('Title'), max_length=255),
description=HTMLField(_('Description'), blank=True),
page_title=models.CharField(_('Page title'), max_length=255, blank=True),
meta_description=models.TextField(_('Meta description'), blank=True),
meta_keywords=models.TextField(_('Meta keywords'), blank=True),
meta_text=models.TextField(_('Meta text'), blank=True),
)


This is language and parler settings:



LANGUAGE_CODE = os.environ.get('LANGUAGE_CODE', 'uk')

LANGUAGES = [
('uk', 'Українська'),
]

USE_I18N = True
USE_L10N = True
USE_TZ = True

PARLER_LANGUAGES = {
SITE_ID: (
{'code': 'uk',},
),
'default': {
'fallbacks': ['uk'],
'hide_untranslated': False,
}
}


----------



Problem detecdet. It was class ProductImage related to my Product. In admin when I add Product first time. ProductImage raise error trying to conect to Product befor his creation. And it's look like refering to translated field by Django-parler.










share|improve this question





























    0















    I have this error when try to save new object. Trying to ask google, nothing helpful. I think my problem is different id for Product and translation table, but i don't know how to fix this. Sorry for my english.



    django==1.10.7 django-parler==1.8




    Exception Type: IntegrityError



    Exception Value:

    insert or update on table "pcart_catalog_product_translation" violates foreign key constraint "pcart_catalog_pr_master_id_571a2ec0_fk_pcart_catalog_product_id"
    DETAIL: Key (master_id)=(a74f5571-512d-4bd5-9164-0388dd22bcd8) is not present in table "pcart_catalog_product".




    This is part of my object:



    class Product(TranslatableModel):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
    slug = models.SlugField(_('Slug'), max_length=255, unique=True)
    external_id = models.CharField(
    _('External ID'), default='', blank=True, max_length=255, db_index=True)

    translations = TranslatedFields(
    title=models.CharField(_('Title'), max_length=255),
    description=HTMLField(_('Description'), blank=True),
    page_title=models.CharField(_('Page title'), max_length=255, blank=True),
    meta_description=models.TextField(_('Meta description'), blank=True),
    meta_keywords=models.TextField(_('Meta keywords'), blank=True),
    meta_text=models.TextField(_('Meta text'), blank=True),
    )


    This is language and parler settings:



    LANGUAGE_CODE = os.environ.get('LANGUAGE_CODE', 'uk')

    LANGUAGES = [
    ('uk', 'Українська'),
    ]

    USE_I18N = True
    USE_L10N = True
    USE_TZ = True

    PARLER_LANGUAGES = {
    SITE_ID: (
    {'code': 'uk',},
    ),
    'default': {
    'fallbacks': ['uk'],
    'hide_untranslated': False,
    }
    }


    ----------



    Problem detecdet. It was class ProductImage related to my Product. In admin when I add Product first time. ProductImage raise error trying to conect to Product befor his creation. And it's look like refering to translated field by Django-parler.










    share|improve this question



























      0












      0








      0








      I have this error when try to save new object. Trying to ask google, nothing helpful. I think my problem is different id for Product and translation table, but i don't know how to fix this. Sorry for my english.



      django==1.10.7 django-parler==1.8




      Exception Type: IntegrityError



      Exception Value:

      insert or update on table "pcart_catalog_product_translation" violates foreign key constraint "pcart_catalog_pr_master_id_571a2ec0_fk_pcart_catalog_product_id"
      DETAIL: Key (master_id)=(a74f5571-512d-4bd5-9164-0388dd22bcd8) is not present in table "pcart_catalog_product".




      This is part of my object:



      class Product(TranslatableModel):
      id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
      slug = models.SlugField(_('Slug'), max_length=255, unique=True)
      external_id = models.CharField(
      _('External ID'), default='', blank=True, max_length=255, db_index=True)

      translations = TranslatedFields(
      title=models.CharField(_('Title'), max_length=255),
      description=HTMLField(_('Description'), blank=True),
      page_title=models.CharField(_('Page title'), max_length=255, blank=True),
      meta_description=models.TextField(_('Meta description'), blank=True),
      meta_keywords=models.TextField(_('Meta keywords'), blank=True),
      meta_text=models.TextField(_('Meta text'), blank=True),
      )


      This is language and parler settings:



      LANGUAGE_CODE = os.environ.get('LANGUAGE_CODE', 'uk')

      LANGUAGES = [
      ('uk', 'Українська'),
      ]

      USE_I18N = True
      USE_L10N = True
      USE_TZ = True

      PARLER_LANGUAGES = {
      SITE_ID: (
      {'code': 'uk',},
      ),
      'default': {
      'fallbacks': ['uk'],
      'hide_untranslated': False,
      }
      }


      ----------



      Problem detecdet. It was class ProductImage related to my Product. In admin when I add Product first time. ProductImage raise error trying to conect to Product befor his creation. And it's look like refering to translated field by Django-parler.










      share|improve this question
















      I have this error when try to save new object. Trying to ask google, nothing helpful. I think my problem is different id for Product and translation table, but i don't know how to fix this. Sorry for my english.



      django==1.10.7 django-parler==1.8




      Exception Type: IntegrityError



      Exception Value:

      insert or update on table "pcart_catalog_product_translation" violates foreign key constraint "pcart_catalog_pr_master_id_571a2ec0_fk_pcart_catalog_product_id"
      DETAIL: Key (master_id)=(a74f5571-512d-4bd5-9164-0388dd22bcd8) is not present in table "pcart_catalog_product".




      This is part of my object:



      class Product(TranslatableModel):
      id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
      slug = models.SlugField(_('Slug'), max_length=255, unique=True)
      external_id = models.CharField(
      _('External ID'), default='', blank=True, max_length=255, db_index=True)

      translations = TranslatedFields(
      title=models.CharField(_('Title'), max_length=255),
      description=HTMLField(_('Description'), blank=True),
      page_title=models.CharField(_('Page title'), max_length=255, blank=True),
      meta_description=models.TextField(_('Meta description'), blank=True),
      meta_keywords=models.TextField(_('Meta keywords'), blank=True),
      meta_text=models.TextField(_('Meta text'), blank=True),
      )


      This is language and parler settings:



      LANGUAGE_CODE = os.environ.get('LANGUAGE_CODE', 'uk')

      LANGUAGES = [
      ('uk', 'Українська'),
      ]

      USE_I18N = True
      USE_L10N = True
      USE_TZ = True

      PARLER_LANGUAGES = {
      SITE_ID: (
      {'code': 'uk',},
      ),
      'default': {
      'fallbacks': ['uk'],
      'hide_untranslated': False,
      }
      }


      ----------



      Problem detecdet. It was class ProductImage related to my Product. In admin when I add Product first time. ProductImage raise error trying to conect to Product befor his creation. And it's look like refering to translated field by Django-parler.







      django django-parler






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 26 '18 at 15:53







      Viacheslav Ovcharenko

















      asked Nov 23 '18 at 12:23









      Viacheslav OvcharenkoViacheslav Ovcharenko

      13




      13
























          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53446678%2fdjango-parler-integrityerror-when-add-new-object-in-admin%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53446678%2fdjango-parler-integrityerror-when-add-new-object-in-admin%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Tangent Lines Diagram Along Smooth Curve

          Yusuf al-Mu'taman ibn Hud

          Zucchini