update tickettype with camp, remove camp from baseticket
minor updates to template and str method of TicketType
This commit is contained in:
parent
85a1db6704
commit
fc87a13c05
26
src/tickets/migrations/0002_auto_20170817_1937.py
Normal file
26
src/tickets/migrations/0002_auto_20170817_1937.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-08-17 17:37
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('camps', '0022_camp_colour'),
|
||||
('tickets', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='baseticket',
|
||||
name='camp',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='tickettype',
|
||||
name='camp',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='camps.Camp'),
|
||||
),
|
||||
]
|
21
src/tickets/migrations/0003_auto_20170817_1938.py
Normal file
21
src/tickets/migrations/0003_auto_20170817_1938.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-08-17 17:38
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('tickets', '0002_auto_20170817_1937'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='tickettype',
|
||||
name='camp',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='camps.Camp'),
|
||||
),
|
||||
]
|
|
@ -21,15 +21,15 @@ logger = logging.getLogger("bornhack.%s" % __name__)
|
|||
# TicketType can be full week, one day. etc.
|
||||
class TicketType(CreatedUpdatedModel, UUIDModel):
|
||||
name = models.TextField()
|
||||
camp = models.ForeignKey('camps.Camp')
|
||||
|
||||
def __str__(self):
|
||||
return '{}'.format(self.name)
|
||||
return '{} ({})'.format(self.name, self.camp.title)
|
||||
|
||||
|
||||
class BaseTicket(models.Model):
|
||||
qrcode_base64 = models.TextField(null=True, blank=True)
|
||||
ticket_type = models.ForeignKey('TicketType')
|
||||
camp = models.ForeignKey('camps.Camp')
|
||||
|
||||
def save(self, **kwargs):
|
||||
super(BaseTicket, self).save(**kwargs)
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<h2>{{ ticket.camp.title }} Ticket</h2>
|
||||
<h3>Type: {{ ticket.ticket_type }}</h3>
|
||||
<h2>{{ ticket.ticket_type.camp.title }} Ticket</h2>
|
||||
<h3>Type: {{ ticket.ticket_type.name }}</h3>
|
||||
|
||||
{% if ticket.name %}
|
||||
<h3>Participant: {{ ticket.name }}</h3>
|
||||
|
|
Loading…
Reference in a new issue