Hi,
This is what i did with django-import-export
   1. pip install django-import-export
  2.# add to settings.py

INSTALLED_APPS = (
    ...
    'import_export',)

3. Modified lib/python2.7/site-packages/cartridge/shop and added following code

from import_export import resources
from import_export.admin import ImportExportModelAdmin
from import_export.admin import ImportExportMixin, ImportMixin, 
ExportActionModelAdmin

class CategoryAdmin(PageAdmin):

!class CategoryAdmin(ExportActionModelAdmin, PageAdmin):

class ProductVariationAdmin(admin.TabularInline):

!class ProductVariationAdmin(ImportMixin, admin.TabularInline):

class ProductImageAdmin(TabularDynamicInlineAdmin):

!class ProductImageAdmin(ImportMixin, TabularDynamicInlineAdmin):

+class ProductResource(resources.ModelResource):

+    class Meta:
+        model = Product

class ProductAdmin(ImportExportModelAdmin, DisplayableAdmin):

!class ProductAdmin(ImportExportModelAdmin, DisplayableAdmin):

      +resource_class = ProductResource


1. python manage.py runserver

2. http://127.0.0.1:8000/admin/shop/product/ 

    Import export options are available in admin.

3. First do an export of csv file say current.csv

4. Delete Django pony sample product.

5. Do import of same current.csv 

The Product gets added without any errors.

However the errors observed are

1. The variation fields does not gets filled up.

2. Multiple images are not loaded.

3. Unit price and sales price are not updated.

I am not sure how the product variation are to be handled.

Thanks,

sathish Anton. A







On Saturday, April 30, 2016 at 10:07:01 PM UTC+5:30, Sathish Anton wrote:
>
> Hi,
> W.r.t Product_db command i tried the following with single django pony 
> sample data loaded with createdb.
> 1. python manage.py product_db --export cur.csv
> 2. Deleted the single django product using admin panel manualy so that 
> there wont be any issues with indexing or sku.
> 3. python manage.py product_db --import cur.csv  
>     
> The errors observed are,
>   1. Additional empty shop category gets created as the field for 
> subcategory is blank in csv.
>   2. There seems to issues with image path. Probaly i have to adust the 
> following parametes for this in product_db.py
>       LOCAL_IMAGE_DIR, 
>       SITE_MEDIA_IMAGE_DIR
>       PRODUCT_IMAGE_DIR
> or probaly some documnetation on what values should be set should help.
>
>
> I also tried django-import-export util by following the example mentioned 
> in read docs
> 1. I was able to see admin panel having import and export options.,
> 2. Export of data was succesfull.
> 3. Import was successful was sucessfull but database was corrupted.
>
> Probaly i need an understanding of mandatory fields required to add a 
> product to make this work.
>
>
> Thanks,
> Sathish Anton. A
>               
>     
>
> On Saturday, April 30, 2016 at 9:30:55 PM UTC+5:30, Eduardo Rivas wrote:
>>
>> What have you tried so far? What errors are you getting? 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to