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)
|
||||
updated = models.DateTimeField(auto_now=True, db_index=True)
|
||||
name = models.CharField(max_length=300)
|
||||
email = models.CharField(max_length=300, null=True)
|
||||
public = models.BooleanField(default=False, db_index=True)
|
||||
pages = models.PositiveIntegerField(default=0)
|
||||
sections = models.PositiveIntegerField(default=0)
|
||||
@ -98,6 +99,7 @@ class Catalog(models.Model):
|
||||
|
||||
|
||||
def summary(self):
|
||||
"""Useful in the catalog list."""
|
||||
return {
|
||||
'id': self.id,
|
||||
'seasonCode': self.season.id,
|
||||
@ -128,6 +130,7 @@ class Catalog(models.Model):
|
||||
data = self.data
|
||||
|
||||
self.name = data.get('name', '(No name)')
|
||||
self.email = data.get('email')
|
||||
|
||||
self.season = Season.objects.get(id=data.get('season'))
|
||||
self.region = Region.objects.get(id=data.get('region'))
|
||||
|
||||
Reference in New Issue
Block a user