ag管理员所做的更改不会反映在前端

时间:2019-06-26 15:51:14

标签: django wagtail

从Wagtail管理员进行的更改未在前端实现。

我已经确认对wagtail管理员所做的更改会在django admin层上反映出来。仍然在多次重新加载后,所做的更改不会反映在前端。

models.py:

class AboutUs(models.Model):
    """
    This holds the info being displayed at the '/authors' page.
    This model just stores info about the blog, it's visions and what it hopes to achieve through the internet
    """
    id = models.PositiveIntegerField(blank=True,
                                     unique=True,
                                     primary_key=True
                                     )
    title = models.CharField("Title of About Us Text",
                             max_length=100,
                             null=True,
                             blank=True,
                             help_text="Default can be named 'Default', Christmas season can be named 'Christmas'"
                             )
    about_us = RichTextField("About us",
                             null=True,
                             blank=True,
                             features=['bold', 'italic', 'hr', 'link', 'document-link', 'embed'],
                             )
    date_created = models.DateField()
    our_story = RichTextField("Our Story",
                              null=True,
                              blank=True,
                              features=['bold', 'italic', 'hr', 'link', 'document-link', 'embed'],
                              )
    our_vision = RichTextField("Our Vision",
                               null=True,
                               blank=True,
                               features=['bold', 'italic', 'hr', 'link', 'document-link', 'embed']
                               )
    our_quote = RichTextField("Our Quote",
                              null=True,
                              blank=True,
                              features=['bold', 'italic', 'hr', 'link', 'document-link', 'embed']
                              )
    author_of_quote = models.CharField("Quote Author", null=True,
                                       blank=True,
                                       max_length=100
                                       )

    panels = [
        FieldPanel('title'),
        FieldPanel('about_us'),
        FieldPanel('date_created'),
        FieldPanel('our_story'),
        FieldPanel('our_vision'),
        FieldPanel('our_quote'),
        FieldPanel('author_of_quote'),
    ]

    template = 'templates/about.html'

    def __str__(self):
        return self.title

about.html:

    {% include "nav_and_navbars/nav_and_navbars.html" %}
        <div class="page-header">
            <div class="container">
                <div class="row">
                    <div class="col-md-offset-1 col-md-10 text-center">
                        {% if about_us %}
                        {% for inspiration in about_us %}
                        <h1> <!--class="text-uppercase"-->About <font style = "font-family:broadway regular">IXORABLOOM</font></h1>
                        <p class="lead">{{ inspiration.about_us|richtext }}</p>
                        {% endfor %}
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
        <!-- /PAGE HEADER -->
    </header>
    <!-- /HEADER -->

    <!-- SECTION -->
    <div class="section">
        <!-- container -->
        <div class="container">
            <!-- row -->
            <div class="row">
                <div class="col-md-5">
                    <div class="section-row">
                        {% for story_base in about_us %}
                        {% if about_us %}
                        <div class="section-title">
                            <h2 class="title">Our story</h2>
                        </div>
                        <p>{{  story_base.our_story|richtext }}</p>
                        <blockquote class="blockquote">
                            <p>{{  story_base.our_quote|richtext }}</p>
                            <footer class="blockquote-footer">{{ story_base.author_of_quote }}</footer>
                        </blockquote>
                    </div>
                </div>
                <div class="col-md-7">
                    <div class="section-row">
                        <div class="section-title">
                            <h2 class="title">Our Vision</h2>
                        </div>
                        <p>{{ story_base.our_vision|richtext }}</p>
                        {% endif %}
                        {% endfor %}
                    </div>
                </div>
            </div>
            <!-- /row -->
        </div>
        <!-- /container -->
    </div>
    <!-- /SECTION -->

    {% include "footer_and_js/footer_and_js.html" %}

我希望对Wagtail管理员所做的文本更改会显示在前端,但仍然需要重载几次,但似乎不起作用。

1 个答案:

答案 0 :(得分:0)

与Django的StateReloader不同,在检测到代码库中的[重要]更改后,它会自动重新启动服务器,而当wagtail管理员层发生更改时,代码库实际上没有任何更改但是数据库已修改。由于在代码库级别没有更改,因此不会重新启动或重新加载服务器。

必须先手动重新启动服务器,然后才能对前端实施更改。