Commit 06e0d2f5 by Bessie Steinberg

Create Journal model

parent 270aeba2
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-03-21 20:02
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('core', '0007_auto_20171004_1133'),
]
operations = [
migrations.CreateModel(
name='Journal',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, verbose_name='UUID')),
('key', models.CharField(max_length=255)),
('title', models.CharField(blank=True, default=None, max_length=225, null=True)),
('price', models.DecimalField(decimal_places=2, default=0.0, max_digits=10)),
('sku', models.CharField(blank=True, max_length=128, null=True)),
('expires', models.DateTimeField(blank=True, null=True)),
('currency', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Currency')),
('partner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Partner')),
],
options={
'get_latest_by': 'modified',
'ordering': ('-modified', '-created'),
'abstract': False,
},
),
]
from django.db import models
from django_extensions.db.models import TimeStampedModel
from uuid import uuid4
# Create your models here.
from course_discovery.apps.core.models import Currency, Partner
class Journal(TimeStampedModel):
"""" Journal model """
PRICE_FIELD_CONFIG = {
'decimal_places': 2,
'max_digits': 10,
'null': False,
'default': 0.00,
}
uuid = models.UUIDField(
default=uuid4,
editable=False,
verbose_name='UUID',
)
partner = models.ForeignKey(Partner)
key = models.CharField(max_length=255)
title = models.CharField(
max_length=225,
default=None,
null=True,
blank=True
)
price = models.DecimalField(**PRICE_FIELD_CONFIG)
currency = models.ForeignKey(Currency)
sku = models.CharField(max_length=128, null=True, blank=True)
expires = models.DateTimeField(null=True, blank=True)
def __str__(self):
return '{key}: {title}'.format(
key=self.key,
title=self.title
)
\ No newline at end of file
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-03-21 20:02
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('publisher', '0064_auto_20180125_1836'),
]
operations = [
migrations.RemoveField(
model_name='courserun',
name='enrollment_end',
),
migrations.RemoveField(
model_name='courserun',
name='enrollment_start',
),
migrations.RemoveField(
model_name='historicalcourserun',
name='enrollment_end',
),
migrations.RemoveField(
model_name='historicalcourserun',
name='enrollment_start',
),
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment