I have an Article model with CharFields
,models.DateTimeField
and FilerFileField
. I create form like this:
class ArticleWizardForm(forms.ModelForm):
class Meta:
model = Article
exclude = []
class Media:
js = 'admin/js/jquery.init.js', #this not working
and creation wizard like this:
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 CharFields
but models.DateTimeField
and FilerFileField
don't have same widgets like in django admin. You can see differences in the following screenshot (Django admin on right)! I figured out that django JS is not loaded so I add it to Media
. However it wasn't added to the template. So I hard code it to cms\wizards\base.html
and jquery.init.js
was successfully loaded but widgets always look like on the image.
Question is, how can I reach same look and functionality in creation wizard like in django admin?
And why media is not loaded in 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 %}