Django cms creation form

I have a model article with CharFields, models.DateTimeFieldand FilerFileField. I create the form as follows:

class ArticleWizardForm(forms.ModelForm):
    class Meta:
        model = Article
        exclude = []

    class Media:
        js = 'admin/js/jquery.init.js', #this not working

and creation wizard:

class ArticleWizard(Wizard):
    pass

article_wizard = ArticleWizard(
    title="Article",
    weight=200,
    form=ArticleWizardForm,
    description="Create a new Article",
)

wizard_pool.register(article_wizard)

It works fine with trivial ones CharFields, but models.DateTimeFieldit FilerFileFielddoesn’t have the same widgets as in django admin. You can see the differences in the following screenshot (Django admin on the right)! I realized that Django JS is not loaded, so I am adding it to Media. However, it was not added to the template. Therefore, I had it hard-coded cms\wizards\base.htmland jquery.init.jswas successfully loaded, but the widgets always look like in the image.

Screenshot

The question is, how can I achieve the same appearance and functionality in creating a wizard as in django admin?

And why doesn't the media load into the template?

original cms\wizards\base.html

{% block extrahead %}
    {{ block.super }}
    <script type="text/javascript" src="{% static_with_version "cms/js/modules/jquery.noconflict.pre.js" %}"></script>
    <script type="text/javascript" src="{% static_with_version "cms/js/libs/jquery.min.js" %}"></script>
    <script type="text/javascript" src="{% static_with_version "cms/js/modules/jquery.noconflict.post.js" %}"></script>
    {{ form.media }}
{% endblock %}
+4

All Articles