mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-24 02:23:58 +03:00
18 lines
383 B
Python
18 lines
383 B
Python
|
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()
|
||
|
category = models.ForeignKey(Category, related_name='ingredients')
|
||
|
|
||
|
def __str__(self):
|
||
|
return self.name
|