coder
asked on
Django model key error
Hi Experts,
I get the following error when I run the python application.
The code which is causing error is as follows:
where Item is a Django model and id is the primary key . the error which i get is as follows:-
KeyError: 'id'
Thank you,
I get the following error when I run the python application.
The code which is causing error is as follows:
current = Item.objects.filter(pk=str(properties['id'])).first()
where Item is a Django model and id is the primary key . the error which i get is as follows:-
KeyError: 'id'
Traceback (most recent call last):
File "/home/ubuntu/workarea/dev-harvestor/harvestor-2/harvest-territory-stories/harvest/models.py", line 283, in _add_item
current = Item.objects.filter(pk=str(properties['id'])).first()
KeyError: 'id'
I am not getting what is causing this error. Please help in resolving this issue.Thank you,
ASKER
Hi
I get the same error, When I try following
How to resolve this issue? please help me
I get the same error, When I try following
Traceback (most recent call last):
File "/home/ubuntu/workarea/dev-harvestor/harvestor-2/harvest-territory-stories/harvest/models.py", line 294, in _add_item
if Item.objects.filter(pk=str(properties['id'])).exists():
KeyError: 'id'
How to resolve this issue? please help me
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I get the same error when I change the code to like this
Open in new window
Please help me in resolving this issue.