bornhack-website/src/bar/models.py

22 lines
533 B
Python
Raw Normal View History

2017-08-26 01:48:02 +00:00
from django.db import models
from utils.models import CampRelatedModel
class ProductCategory(CampRelatedModel):
name = models.CharField(max_length=255)
camp = models.ForeignKey('camps.Camp')
def __str__(self):
return self.name
class Product(models.Model):
name = models.CharField(max_length=255)
price = models.IntegerField()
category = models.ForeignKey(ProductCategory, related_name="products")
in_stock = models.BooleanField(default=True)
def __str__(self):
return self.name