Model strings

This commit is contained in:
Kumi 2019-10-26 17:39:14 +02:00
parent 76b9f78b46
commit ad154b6954
3 changed files with 12 additions and 3 deletions

View file

@ -5,4 +5,7 @@ from django.db import models
class Card(models.Model): class Card(models.Model):
number = models.IntegerField("Card number", primary_key=True) number = models.IntegerField("Card number", primary_key=True)
purchased = models.DateTimeField("Card purchased", auto_now_add=True) purchased = models.DateTimeField("Card purchased", auto_now_add=True)
delivered = models.DateTimeField("Card delivered to Oma", default=None, null=True) delivered = models.DateTimeField("Card delivered to Oma", default=None, null=True)
def __str__(self):
return str(self.number)

View file

@ -4,4 +4,7 @@ from django.db import models
class Setting(models.Model): class Setting(models.Model):
key = models.CharField(primary_key=True, max_length=512) key = models.CharField(primary_key=True, max_length=512)
value = models.CharField(max_length=512) value = models.CharField(max_length=512)
def __str__(self):
return self.key

View file

@ -6,4 +6,7 @@ class Payment(models.Model):
description = models.CharField("Payment description", max_length=128) description = models.CharField("Payment description", max_length=128)
amount = models.DecimalField("Payment amount", max_digits=15, decimal_places=2) amount = models.DecimalField("Payment amount", max_digits=15, decimal_places=2)
date = models.DateTimeField("Date of payment", auto_now_add=True) date = models.DateTimeField("Date of payment", auto_now_add=True)
repayment = models.DateTimeField("Date of repayment", default=None, null=True) repayment = models.DateTimeField("Date of repayment", default=None, null=True)
def __str__(self):
return self.description