Add checked_in to tickets and make it possible to mark tickets as arrived.

This commit is contained in:
Víðir Valberg Guðmundsson 2016-08-27 10:17:43 +02:00
parent 029ec74389
commit 370e9b6d32
3 changed files with 38 additions and 2 deletions

View file

@ -8,9 +8,9 @@ admin.site.register(models.CoinifyAPIInvoice)
admin.site.register(models.CoinifyAPICallback) admin.site.register(models.CoinifyAPICallback)
admin.site.register(models.Invoice) admin.site.register(models.Invoice)
admin.site.register(models.CreditNote) admin.site.register(models.CreditNote)
admin.site.register(models.Ticket)
admin.site.register(models.CustomOrder) admin.site.register(models.CustomOrder)
@admin.register(models.ProductCategory) @admin.register(models.ProductCategory)
class ProductCategoryAdmin(admin.ModelAdmin): class ProductCategoryAdmin(admin.ModelAdmin):
list_display = [ list_display = [
@ -37,7 +37,6 @@ class TicketInline(admin.TabularInline):
exclude = ['qrcode_base64'] exclude = ['qrcode_base64']
@admin.register(models.Order) @admin.register(models.Order)
class OrderAdmin(admin.ModelAdmin): class OrderAdmin(admin.ModelAdmin):
change_form_template = 'admin/change_order_form.html' change_form_template = 'admin/change_order_form.html'
@ -84,3 +83,14 @@ class OrderAdmin(admin.ModelAdmin):
order.mark_as_refunded(request) order.mark_as_refunded(request)
mark_order_as_refunded.description = 'Mark order(s) as refunded' mark_order_as_refunded.description = 'Mark order(s) as refunded'
@admin.register(models.Ticket)
class TicketModelAdmin(admin.ModelAdmin):
list_display = ['order', 'product', 'name', 'email', 'get_token', 'checked_in']
actions = ['mark_as_arrived']
def mark_as_arrived(self, request, queryset):
queryset.update(checked_in=True)

View file

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-08-27 07:52
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shop', '0029_auto_20160712_2133'),
]
operations = [
migrations.AlterModelOptions(
name='product',
options={'ordering': ['available_in', 'price', 'name'], 'verbose_name': 'Product', 'verbose_name_plural': 'Products'},
),
migrations.AddField(
model_name='ticket',
name='checked_in',
field=models.BooleanField(default=False),
),
]

View file

@ -439,6 +439,8 @@ class Ticket(CreatedUpdatedModel, UUIDModel):
blank=True, blank=True,
) )
checked_in = models.BooleanField(default=False)
def __unicode__(self): def __unicode__(self):
return 'Ticket {user} {product}'.format( return 'Ticket {user} {product}'.format(
user=self.order.user, user=self.order.user,