mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-25 19:14:11 +03:00
Make cookbook example working on django 2 (#680)
This commit is contained in:
parent
612ba5a4ea
commit
91c1278d1a
|
@ -11,7 +11,9 @@ class Category(models.Model):
|
|||
class Ingredient(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
notes = models.TextField(null=True, blank=True)
|
||||
category = models.ForeignKey(Category, related_name="ingredients")
|
||||
category = models.ForeignKey(
|
||||
Category, related_name="ingredients", on_delete=models.CASCADE
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
|
|
@ -10,8 +10,10 @@ class Recipe(models.Model):
|
|||
|
||||
|
||||
class RecipeIngredient(models.Model):
|
||||
recipe = models.ForeignKey(Recipe, related_name="amounts")
|
||||
ingredient = models.ForeignKey(Ingredient, related_name="used_by")
|
||||
recipe = models.ForeignKey(Recipe, related_name="amounts", on_delete=models.CASCADE)
|
||||
ingredient = models.ForeignKey(
|
||||
Ingredient, related_name="used_by", on_delete=models.CASCADE
|
||||
)
|
||||
amount = models.FloatField()
|
||||
unit = models.CharField(
|
||||
max_length=20,
|
||||
|
|
|
@ -43,13 +43,12 @@ INSTALLED_APPS = [
|
|||
"cookbook.recipes.apps.RecipesConfig",
|
||||
]
|
||||
|
||||
MIDDLEWARE_CLASSES = [
|
||||
MIDDLEWARE = [
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"django.contrib.auth.middleware.SessionAuthenticationMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
graphene
|
||||
graphene-django
|
||||
graphql-core>=2.1rc1
|
||||
django==1.11.21
|
||||
django==2.2.2
|
||||
django-filter>=2
|
||||
|
|
Loading…
Reference in New Issue
Block a user