Last time I checked, (h) one argument:
for entry in f['entries']:
h = {开发者_StackOverflow中文版'feed':self, 'link': entry['link'],'title':entry['title'],
'summary':entry['summary'],
'updated_at':datetime.fromtimestamp(mktime(entry['updated_parsed']))}
en = Entry.objects.get_or_create(h)
This code is failing with the error in the title. What can I check for?
get_or_create
takes keyword arguments only. If the arguments are in a dict, you can call it with:
en = Entry.objects.get_or_create(**h)
Or you can put the keyword arguments directly:
en = Entry.objects.get_or_create(name=value, ....)
The reason the error message told you that you supplied two arguments is that there is an implicit self
parameter passed to the function.
精彩评论