尝试加载我的类别时出现以下错误。发布的值为'1'并且存在于数据库中,
TypeError at /events/add/
int() argument must be a string or a number, not 'Category'
Request Method: POST
Request URL: http://127.0.0.1:8000/events/new/
Django Version: 1.4
Exception Type: TypeError
Exception Value:
int() argument must be a string or a number, not 'Category'
Exception Location: /Library/Python/2.7/site-packages/django/db/models/fields/__init__.py in get_prep_value, line 537
Python Executable: /Users/user/Documents/workspace/RoseBud/django-env/bin/python
视图.py
category = Category.objects.get(pk=form.cleaned_data['category'])