-1š
The django way to create new models, (and SaleorĀ“s backend is django based) is:
- You should create a new app on your store backend (the django part of saleor) with:
$ python manage.py startapp artist
- Create your Artist model, with all the fields you want such as email, etcā¦ in the file:
artist/models.py
. - Modify the Product model in the file
product/models.py
by importing the Artist models and adding a ForeignKey (for example) relationship to it. - Register the new artist app in your
settings.py
ās āINSTALLED_APPSā. - Run
python manage.py makemigrations
ā¦ (Check they include your changes to models) - Run
python manage.py migrate
.
That should be it. āless I`m forgeting something, in which case, please post back when you have moved forward with this.
Notes:
- You may want to back up your DB first.
- Also when applying these migrations, django will ask you for a placeholder value for products which where in your DB before Product had an Artist field.
References:
š¤Aerials
Source:stackexchange.com