16 lines
560 B
Python
16 lines
560 B
Python
from django.db import models
|
|
|
|
class Product(models.Model):
|
|
CATEGORY_CHOICES = [
|
|
('food', 'Food'),
|
|
('drink', 'Drink'),
|
|
]
|
|
|
|
name = models.CharField(max_length=100)
|
|
price = models.DecimalField(max_digits=6, decimal_places=2)
|
|
category = models.CharField(max_length=20, choices=CATEGORY_CHOICES, default='drink')
|
|
has_deposit = models.BooleanField(default=False)
|
|
image_url = models.URLField(max_length=200, blank=True, null=True, help_text="Optional URL for product image.")
|
|
|
|
def __str__(self):
|
|
return self.name |