Thanks for your reply. My excel column headers are the same as my model 
field names but i am still getting the error as seen.

On Tuesday, July 23, 2019 at 10:28:09 PM UTC+8, sachinbg sachin wrote:
>
> If ur dumping the data from exel make prepare as per ur database table ur 
> exel headings should be as table name check in models then migrate and make 
> migrate it will work
>
> On Tue, Jul 23, 2019, 5:04 PM Jasmine Chua <babym...@gmail.com 
> <javascript:>> wrote:
>
>> Hi,
>>
>> I am struggling to correctly map my Excel data tab of CaseSummary to my 
>> CaseSummary model using Django-Excel. I am getting the error that 
>> CaseSummary does not match any given models when it should match my 
>> CaseSummary model. I have no problem previously in uploading data from a 
>> single tab spreadsheet to a single model without any foreign keys or 
>> relationships to other models. However, my objective is to upload a 
>> spreadsheet containing multiple tabs of data and my models have foreign 
>> keys, one-to-one and many-to-many fields too. However, i cannot seem to 
>> find good documentation online about how to do this. i really hope to 
>> receive some tips from this mailing list as i have been banging my head 
>> against the wall on this one. I look forward to hear from you guys. Thank 
>> you very much in advance! 
>>
>> More details below. 
>>
>> Error message screenshot while uploading my Excel Spreadsheet:
>>
>> [image: Screenshot 2019-07-23 at 5.16.03 PM.png]
>>
>>
>> Screenshot of my CaseSummary tab in my spreadsheet. Fictitious data.
>>
>> [image: Screenshot 2019-07-23 at 5.40.04 PM.png]
>>
>> My CaseSummary Model
>>
>> [image: Screenshot 2019-07-23 at 5.41.15 PM.png]
>>
>>
>>
>>
>> I am running Python version 2.2.2, Django version 3.7.3 and Django-Excel 
>> 0.0.10. 
>> While reading the documentation at Django-Excel page (
>> http://django.pyexcel.org/en/latest/), i am not sure if i understand 
>> choice_func function correctly. I understand the reason why choice_func is 
>> required because it has a foreign key to Question and its Question column 
>> has to be translate to a Question instance. However, i am guessing that the 
>> argument "row" when parsed into choice_func refers to a row of data from 
>> Choice data tab in the sample-data.xlsx and row[0] refers to the first 
>> column of Choice tab whose values are e.g. 'ide'. Am i correct? 
>>
>>         def choice_func(row):
>>             q = Question.objects.filter(slug=row[0])[0]
>>             row[0] = q
>>             return row
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/e8b0cc85-517b-4452-b856-2c4ff14b8019%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/e8b0cc85-517b-4452-b856-2c4ff14b8019%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a8b451bf-6154-4185-af14-6c5a778bc764%40googlegroups.com.

Reply via email to