mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-15 22:27:10 +03:00
20 lines
489 B
Python
20 lines
489 B
Python
from django.db import models
|
|
|
|
|
|
class Category(models.Model):
|
|
class Meta:
|
|
verbose_name_plural = 'Categories'
|
|
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', on_delete=models.CASCADE)
|
|
|
|
def __str__(self):
|
|
return self.name
|