graphene-django/examples/cookbook-plain/cookbook/ingredients/models.py

18 lines
404 B
Python
Raw Normal View History

from django.db import models
class Category(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
class Ingredient(models.Model):
name = models.CharField(max_length=100)
notes = models.TextField(null=True, blank=True)
category = models.ForeignKey(Category, related_name='ingredients')
def __str__(self):
return self.name