mirror of
				https://github.com/graphql-python/graphene-django.git
				synced 2025-10-31 16:07:36 +03:00 
			
		
		
		
	* Update travis and tox * Use xenial distribution * Don't install coveralls twice * Add black and flake8 tox commands * Remove Python 3.5 test for Django master * Fix indent * Ignore migrations * Remove black for now * Run black formatting (#668) * Run black format * Update makefile * Add black to travis build
		
			
				
	
	
		
			29 lines
		
	
	
		
			719 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			719 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from django.db import models
 | |
| 
 | |
| from ..ingredients.models import Ingredient
 | |
| 
 | |
| 
 | |
| class Recipe(models.Model):
 | |
|     title = models.CharField(max_length=100)
 | |
|     instructions = models.TextField()
 | |
| 
 | |
|     def __str__(self):
 | |
|         return self.title
 | |
| 
 | |
| 
 | |
| class RecipeIngredient(models.Model):
 | |
|     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,
 | |
|         choices=(
 | |
|             ("unit", "Units"),
 | |
|             ("kg", "Kilograms"),
 | |
|             ("l", "Litres"),
 | |
|             ("st", "Shots"),
 | |
|         ),
 | |
|     )
 |