1

I am trying to customize Products and few other models in the catalogue app following the documentation.

I have forked catalogue app (to myproject/boscar/catalogue) as per documentation documentation and my updated boscar/catalogue/models.py:

from django.db import models
from oscar.apps.catalogue.abstract_models import AbstractProduct

class Product(AbstractProduct):
    is_active = models.BooleanField(default=False)

from oscar.apps.catalogue.models import *

I have already included the modified catalogue app, in the INSTALLED_APPS in settings.py as an argument for get_core_apps function.

    INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'rest_framework',
    'django.contrib.sites',
    'django.contrib.flatpages',
    'bmigrate',
    'compressor',
    'widget_tweaks',
    'boscar'
] + get_core_apps(['boscar.catalogue'])

Migrations are automatically copied to my local app when I executed this command manage.py oscar_fork_app catalogue boscar.

My issue is when I execute the makemigrations command (python "manage.py makemigrations boscar"), it shows "No changes detected in app 'boscar'". But I already made a change to add is_active field in product table.

solarissmoke
  • 30,039
  • 14
  • 71
  • 73
Arun SS
  • 1,791
  • 8
  • 29
  • 48

1 Answers1

1

I believe you need to refer to the catalogue app when migrating:

python manage.py makemigrations catalogue
dentemm
  • 6,231
  • 3
  • 31
  • 43
  • I want to change the product id (int) to uuid. I have updated the model as `id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)`. Now it shows the error. `django.db.utils.ProgrammingError: column "id" cannot be cast automatically to type uuid HINT: You might need to specify "USING id::uuid".` – Arun SS Apr 10 '17 at 06:10
  • Personally I have not yet tried using a uuid as primary key, but [here](http://stackoverflow.com/questions/3936182/using-a-uuid-as-a-primary-key-in-django-models-generic-relations-impact) you can find some information on doing so. Apparently there exists a UUIDField since django 1.8 – dentemm Apr 10 '17 at 07:18