12 lines
487 B
Python
Executable file
12 lines
487 B
Python
Executable file
from django.db import models
|
|
|
|
class Plant(models.Model):
|
|
name = models.CharField(max_length=100)
|
|
description = models.TextField(null=True, blank=True)
|
|
buy_price = models.FloatField(null=True, blank=True)
|
|
sell_price = models.FloatField(null=True, blank=True)
|
|
stock = models.IntegerField(default=0)
|
|
|
|
class PlantImage(models.Model):
|
|
plant = models.ForeignKey(Plant, related_name='images', on_delete=models.CASCADE)
|
|
image = models.ImageField(upload_to='plants/')
|