redo migrations for Tickets app again, fix BaseTicket to be abstract
This commit is contained in:
parent
410905f3ce
commit
a07e74180e
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Generated by Django 1.10.5 on 2017-08-19 19:32
|
# Generated by Django 1.10.5 on 2017-08-19 20:21
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Generated by Django 1.10.5 on 2017-08-19 19:32
|
# Generated by Django 1.10.5 on 2017-08-19 20:21
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
@ -12,20 +12,52 @@ class Migration(migrations.Migration):
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('shop', '0047_auto_20170522_1942'),
|
|
||||||
('sponsors', '0006_auto_20170715_1110'),
|
|
||||||
('camps', '0022_camp_colour'),
|
('camps', '0022_camp_colour'),
|
||||||
|
('sponsors', '0006_auto_20170715_1110'),
|
||||||
|
('shop', '0047_auto_20170522_1942'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='BaseTicket',
|
name='DiscountTicket',
|
||||||
fields=[
|
fields=[
|
||||||
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||||
('created', models.DateTimeField(auto_now_add=True)),
|
('created', models.DateTimeField(auto_now_add=True)),
|
||||||
('updated', models.DateTimeField(auto_now=True)),
|
('updated', models.DateTimeField(auto_now=True)),
|
||||||
('qrcode_base64', models.TextField(blank=True, null=True)),
|
('qrcode_base64', models.TextField(blank=True, null=True)),
|
||||||
('checked_in', models.BooleanField(default=False)),
|
('checked_in', models.BooleanField(default=False)),
|
||||||
|
('price', models.IntegerField(help_text='Price of the discounted ticket (in DKK, including VAT).')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'abstract': False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='ShopTicket',
|
||||||
|
fields=[
|
||||||
|
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||||
|
('created', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('updated', models.DateTimeField(auto_now=True)),
|
||||||
|
('qrcode_base64', models.TextField(blank=True, null=True)),
|
||||||
|
('checked_in', models.BooleanField(default=False)),
|
||||||
|
('name', models.CharField(blank=True, help_text='Name of the person this ticket belongs to. This can be different from the buying user.', max_length=100, null=True)),
|
||||||
|
('email', models.EmailField(blank=True, max_length=254, null=True)),
|
||||||
|
('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='shoptickets', to='shop.Order')),
|
||||||
|
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='shop.Product')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'abstract': False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='SponsorTicket',
|
||||||
|
fields=[
|
||||||
|
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||||
|
('created', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('updated', models.DateTimeField(auto_now=True)),
|
||||||
|
('qrcode_base64', models.TextField(blank=True, null=True)),
|
||||||
|
('checked_in', models.BooleanField(default=False)),
|
||||||
|
('sponsor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sponsors.Sponsor')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'abstract': False,
|
'abstract': False,
|
||||||
|
@ -38,51 +70,25 @@ class Migration(migrations.Migration):
|
||||||
('created', models.DateTimeField(auto_now_add=True)),
|
('created', models.DateTimeField(auto_now_add=True)),
|
||||||
('updated', models.DateTimeField(auto_now=True)),
|
('updated', models.DateTimeField(auto_now=True)),
|
||||||
('name', models.TextField()),
|
('name', models.TextField()),
|
||||||
('camp', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='camps.Camp')),
|
('camp', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='camps.Camp')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'abstract': False,
|
'abstract': False,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
|
||||||
name='DiscountTicket',
|
|
||||||
fields=[
|
|
||||||
('baseticket_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='tickets.BaseTicket')),
|
|
||||||
('price', models.IntegerField(help_text='Price of the discounted ticket (in DKK, including VAT).')),
|
|
||||||
],
|
|
||||||
options={
|
|
||||||
'abstract': False,
|
|
||||||
},
|
|
||||||
bases=('tickets.baseticket',),
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='ShopTicket',
|
|
||||||
fields=[
|
|
||||||
('baseticket_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='tickets.BaseTicket')),
|
|
||||||
('name', models.CharField(blank=True, help_text='Name of the person this ticket belongs to. This can be different from the buying user.', max_length=100, null=True)),
|
|
||||||
('email', models.EmailField(blank=True, max_length=254, null=True)),
|
|
||||||
('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='shoptickets', to='shop.Order')),
|
|
||||||
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='shop.Product')),
|
|
||||||
],
|
|
||||||
options={
|
|
||||||
'abstract': False,
|
|
||||||
},
|
|
||||||
bases=('tickets.baseticket',),
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='SponsorTicket',
|
|
||||||
fields=[
|
|
||||||
('baseticket_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='tickets.BaseTicket')),
|
|
||||||
('sponsor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sponsors.Sponsor')),
|
|
||||||
],
|
|
||||||
options={
|
|
||||||
'abstract': False,
|
|
||||||
},
|
|
||||||
bases=('tickets.baseticket',),
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='baseticket',
|
model_name='sponsorticket',
|
||||||
name='ticket_type',
|
name='ticket_type',
|
||||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tickets.TicketType'),
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='tickets.TicketType'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='shopticket',
|
||||||
|
name='ticket_type',
|
||||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='tickets.TicketType'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='discountticket',
|
||||||
|
name='ticket_type',
|
||||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='tickets.TicketType'),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
36
src/tickets/migrations/0002_auto_20170819_2222.py
Normal file
36
src/tickets/migrations/0002_auto_20170819_2222.py
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.5 on 2017-08-19 20:22
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('tickets', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='discountticket',
|
||||||
|
name='ticket_type',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tickets.TicketType'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='shopticket',
|
||||||
|
name='ticket_type',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tickets.TicketType'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='sponsorticket',
|
||||||
|
name='ticket_type',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tickets.TicketType'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='tickettype',
|
||||||
|
name='camp',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='camps.Camp'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -32,6 +32,9 @@ class BaseTicket(CreatedUpdatedModel, UUIDModel):
|
||||||
ticket_type = models.ForeignKey('TicketType')
|
ticket_type = models.ForeignKey('TicketType')
|
||||||
checked_in = models.BooleanField(default=False)
|
checked_in = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
|
||||||
def save(self, **kwargs):
|
def save(self, **kwargs):
|
||||||
super(BaseTicket, self).save(**kwargs)
|
super(BaseTicket, self).save(**kwargs)
|
||||||
self.qrcode_base64 = self.get_qr_code()
|
self.qrcode_base64 = self.get_qr_code()
|
||||||
|
|
Loading…
Reference in a new issue