django2/demo/migration/models.py
Peter Kotyczka 679d7d1b58 smc
2024-03-24 22:58:33 +01:00

18 lines
645 B
Python
Executable File

from django.db import models
from datetime import date
class ShoppingItem(models.Model):
created_at = models.DateField(default=date.today)
name = models.CharField(max_length=120)
done = models.BooleanField(default=False)
price = models.DecimalField(max_digits=10, decimal_places=2, default = 0.0)
quantity = models.PositiveIntegerField()
def __str__(self):
return str(self.id) + ' - ' + self.name
class Product(models.Model):
title = models.CharField(max_length=120)
content= models.TextField(blank=True, null=True)
price = models.DecimalField(max_digits=15,decimal_places=2,default=99.99)