Skip to content

Commit 9812c58

Browse files
authored
Merge pull request #334 from fusion44/master
Docs: Update Cookbook tutorial
2 parents f045147 + 9840a64 commit 9812c58

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

docs/tutorial-plain.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ Let's get started with these models:
6868
class Ingredient(models.Model):
6969
name = models.CharField(max_length=100)
7070
notes = models.TextField()
71-
category = models.ForeignKey(Category, related_name='ingredients',
72-
on_delete=models.CASCADE)
71+
category = models.ForeignKey(
72+
Category, related_name='ingredients', on_delete=models.CASCADE)
7373
7474
def __str__(self):
7575
return self.name
@@ -84,6 +84,7 @@ Add ingredients as INSTALLED_APPS:
8484
'cookbook.ingredients',
8585
]
8686
87+
8788
Don't forget to create & run migrations:
8889

8990
.. code:: bash
@@ -112,6 +113,18 @@ Alternatively you can use the Django admin interface to create some data
112113
yourself. You'll need to run the development server (see below), and
113114
create a login for yourself too (``./manage.py createsuperuser``).
114115

116+
Register models with admin panel:
117+
118+
.. code:: python
119+
120+
# cookbook/ingredients/admin.py
121+
from django.contrib import admin
122+
from cookbook.ingredients.models import Category, Ingredient
123+
124+
admin.site.register(Category)
125+
admin.site.register(Ingredient)
126+
127+
115128
Hello GraphQL - Schema and Object Types
116129
---------------------------------------
117130

0 commit comments

Comments
 (0)