catalog gets email field
This commit is contained in:
18
procat2/migrations/0006_catalog_email.py
Normal file
18
procat2/migrations/0006_catalog_email.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 2.2 on 2019-05-15 20:36
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('procat2', '0005_auto_20190426_0503'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='catalog',
|
||||||
|
name='email',
|
||||||
|
field=models.CharField(max_length=300, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -58,6 +58,7 @@ class Catalog(models.Model):
|
|||||||
created = models.DateTimeField(auto_now_add=True)
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
updated = models.DateTimeField(auto_now=True, db_index=True)
|
updated = models.DateTimeField(auto_now=True, db_index=True)
|
||||||
name = models.CharField(max_length=300)
|
name = models.CharField(max_length=300)
|
||||||
|
email = models.CharField(max_length=300, null=True)
|
||||||
public = models.BooleanField(default=False, db_index=True)
|
public = models.BooleanField(default=False, db_index=True)
|
||||||
pages = models.PositiveIntegerField(default=0)
|
pages = models.PositiveIntegerField(default=0)
|
||||||
sections = models.PositiveIntegerField(default=0)
|
sections = models.PositiveIntegerField(default=0)
|
||||||
@ -98,6 +99,7 @@ class Catalog(models.Model):
|
|||||||
|
|
||||||
|
|
||||||
def summary(self):
|
def summary(self):
|
||||||
|
"""Useful in the catalog list."""
|
||||||
return {
|
return {
|
||||||
'id': self.id,
|
'id': self.id,
|
||||||
'seasonCode': self.season.id,
|
'seasonCode': self.season.id,
|
||||||
@ -128,6 +130,7 @@ class Catalog(models.Model):
|
|||||||
data = self.data
|
data = self.data
|
||||||
|
|
||||||
self.name = data.get('name', '(No name)')
|
self.name = data.get('name', '(No name)')
|
||||||
|
self.email = data.get('email')
|
||||||
|
|
||||||
self.season = Season.objects.get(id=data.get('season'))
|
self.season = Season.objects.get(id=data.get('season'))
|
||||||
self.region = Region.objects.get(id=data.get('region'))
|
self.region = Region.objects.get(id=data.get('region'))
|
||||||
|
|||||||
31
products/migrations/0001_initial.py
Normal file
31
products/migrations/0001_initial.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# Generated by Django 2.2 on 2019-05-15 20:36
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Product',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('sap', models.CharField(db_column='sap_article_number', max_length=10)),
|
||||||
|
('name', models.CharField(db_column='short_name', max_length=100)),
|
||||||
|
('model', models.CharField(db_column='model', max_length=100)),
|
||||||
|
('gender', models.CharField(db_column='gender', max_length=100)),
|
||||||
|
('category', models.CharField(db_column='model_product_type', max_length=100)),
|
||||||
|
('family', models.CharField(db_column='product_family', max_length=100)),
|
||||||
|
('color', models.CharField(db_column='color', max_length=100)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'db_table': 'adilog_product',
|
||||||
|
'managed': False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user