Revision d240ebcb

b/cloudcms/admin.py
80 80
    context = {}
81 81
    form = RstZipImportForm()
82 82

  
83
    if request.GET.get('form_saved'):
84
        context['save_log'] = request.session.get('save_log')
85
    else:
86
        if request.session.get('save_log'):
87
            del request.session['save_log']
88

  
83 89
    if request.method == 'POST':
84 90
        form = RstZipImportForm(request.POST, request.FILES)
85 91
        if form.is_valid():
86 92
            try:
87
                ret = form.save(request.user)
88
                messages.add_message(request, messages.INFO, 'Form saved')
89
                return redirect('/cmsmanage/sphinximport/')
93
                saved, log = form.save(request.user)
94
                if saved:
95
                    messages.add_message(request, messages.INFO, 'Form saved')
96
                    request.session['save_log'] = log.replace("\n", "<br />")
97
                    return redirect('/cmsmanage/sphinximport/' + '?form_saved=1')
98
                else:
99
                    messages.add_message(request, messages.ERROR, 'Form failed')
100
                    context['save_log'] = log.replace("\n", "<br />")
90 101
            except Exception, e:
91
                context['exception'] = e
102
                context['save_log'] = e
92 103

  
93 104
        else:
94 105
            context['error'] = True
b/cloudcms/templates/cms/admin_import_guide_faq.html
3 3

  
4 4

  
5 5
{% block extrahead %}{{ block.super }}
6
<style>
7
    .log-entry { padding: 5px; }
8
    .log-entry pre { color: #000 }
9
    .log-entry.WARNING { background-color: #8D560F; font-weight: bold }
10
    .log-entry.INFO { background-color: #F0F0F0 }
11
    .log-entry.DEBUG { background-color: #BDBDBD }
12
    .log-entry.ERROR { background-color: #8D1C03; font-weight: bold }
13
    .log-entry.ERROR *, .log-entry.WARNING * { color: #fff; }
14
</style>
6 15
{% url admin:jsi18n as jsi18nurl %}
7 16
<script type="text/javascript" src="{{ jsi18nurl|default:"../../../jsi18n/" }}"></script>
8 17
{{ media }}
......
40 49
        {{ form.as_p }}
41 50
        <input type="submit" />
42 51
    </div>
43
</form></div>
52
</form>
53

  
54
{% if save_log %}
55
<div class="form-log">
56
    <h3>Log</h3>
57
    <br />
58
    <div>
59
        {{ save_log|safe }}
60
    </div>
61
</div>
62
{% endif %}
63

  
64
</div>
44 65
{% endblock %}

Also available in: Unified diff