示例#1
0
 def test_unicode(self):
     """Test the ProductExportForm behavior
     Specifically, we're checking that a unicode 'format' is converted to ascii
     in the 'export' method of 'ProductExportForm'."""
     form = ProductExportForm({'format': u'yaml', 'include_images': True})
     response = form.export(None)
     self.assert_(isinstance(response, HttpResponse))
示例#2
0
 def test_unicode(self):
     """Test the ProductExportForm behavior
     Specifically, we're checking that a unicode 'format' is converted to ascii
     in the 'export' method of 'ProductExportForm'."""
     form = ProductExportForm({'format': u'yaml', 'include_images': True})
     response = form.export(None)
     self.assert_(isinstance(response, HttpResponse))
示例#3
0
def export_products(request, template='product/admin/product_export_form.html'):
    """A product export tool"""
    if request.method == 'POST':
        new_data = request.POST.copy()
        form = ProductExportForm(new_data)
        if form.is_valid():
            return form.export(request)
    else:
        form = ProductExportForm()
        fileform = ProductImportForm()  
        

    ctx = RequestContext(request, {
        'title' : _('Product Import/Export'),
        'form' : form,
        'importform': fileform
        })

    return render_to_response(template, ctx)
示例#4
0
def export_products(request, template='product/admin/product_export_form.html'):
    """A product export tool"""
    if request.method == 'POST':
        new_data = request.POST.copy()
        form = ProductExportForm(new_data)
        if form.is_valid():
            return form.export(request)
    else:
        form = ProductExportForm()
    fileform = ProductImportForm()


    ctx = {
        'title' : _('Product Import/Export'),
        'form' : form,
        'importform': fileform
        }

    return render(request, template, ctx)