mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Add an API
This commit is contained in:
26
src/pretix/base/migrations/0137_auto_20190918_1820.py
Normal file
26
src/pretix/base/migrations/0137_auto_20190918_1820.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# Generated by Django 2.2.1 on 2019-09-18 18:20
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
import pretix.base.models.fields
|
||||
import pretix.base.models.giftcards
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pretixbase', '0136_auto_20190918_1537'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='giftcard',
|
||||
name='secret',
|
||||
field=models.CharField(db_index=True, default=pretix.base.models.giftcards.gen_giftcard_secret, max_length=190),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='giftcard',
|
||||
unique_together={('secret', 'issuer')},
|
||||
),
|
||||
]
|
||||
@@ -48,7 +48,6 @@ class GiftCard(LoggedModel):
|
||||
secret = models.CharField(
|
||||
max_length=190,
|
||||
default=gen_giftcard_secret,
|
||||
unique=True,
|
||||
db_index=True,
|
||||
verbose_name=_('Gift card code'),
|
||||
)
|
||||
@@ -62,6 +61,9 @@ class GiftCard(LoggedModel):
|
||||
def value(self):
|
||||
return self.transactions.aggregate(s=Sum('value'))['s'] or Decimal('0.00')
|
||||
|
||||
class Meta:
|
||||
unique_together = (('secret', 'issuer'),)
|
||||
|
||||
|
||||
class GiftCardTransaction(models.Model):
|
||||
card = models.ForeignKey(
|
||||
|
||||
Reference in New Issue
Block a user