Issue
I have a python data dictionary that I am using to do some date comparisions. However when I loop through it I can't figure out how to access the DailyPlannerRequest value. I have tried doing a request.DailyPlannerRequest but the error that comes back is 'datetime.date' object has no attribute 'DailyPlannerRequest'. I've read a bit about trying to convert this dictionary value but can't find anything helpful. I am trying to do a loop and query a filter value and compare it to this data dictionary value.
I'm trying to do something like....
if request.day == day and event.daily_planner_request_name == request.DailyPlannerRequest :
I've done this lots of times before but the complication here is that one is a queryset and the other is a dictionary value that I'm trying to get to compare.
I've played a bit with the approach documented here Accessing dict keys like an attribute?
But can't seem to figure this out.
Thanks in advance for any ideas.
Solution
@Waldemar Podsiadlo answered this one. The answer he provided helped me with my troubleshooting...for key, value in dict.items()
Answered By - Steve Smith
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.