Просмотр исходного кода

Need to flip order of class creation

Need to flip order of creating `BlogIndexRelatedLink` and `BlogIndexPage`, otherwise `BlogIndexRelatedLink` references `BlogIndexPage` before it's been created and you get:
```bash
ERRORS:
blog.BlogIndexRelatedLink.page: (fields.E300) Field defines a relation with model 'BlogIndexPage', which is either not installed, or is abstract.
```
John Heasly 9 лет назад
Родитель
Сommit
d87d737f52
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      docs/getting_started/tutorial.rst

+ 4 - 4
docs/getting_started/tutorial.rst

@@ -364,10 +364,6 @@ can be BlogPages or external links. Change ``blog/models.py`` to
             abstract = True
 
 
-    class BlogIndexRelatedLink(Orderable, RelatedLink):
-        page = ParentalKey('BlogIndexPage', related_name='related_links')
-
-
     class BlogIndexPage(Page):
         intro = RichTextField(blank=True)
 
@@ -376,6 +372,10 @@ can be BlogPages or external links. Change ``blog/models.py`` to
             InlinePanel('related_links', label="Related links"),
         ]
 
+
+    class BlogIndexRelatedLink(Orderable, RelatedLink):
+        page = ParentalKey('BlogIndexPage', related_name='related_links')
+
 .. figure:: ../_static/images/tutorial/tutorial_7.png
    :alt: Blog index edit screen