我收到此错误:invalid literal for int() with base 10: 'social'
当我尝试在 /category/social/ 打开页面时。
def all_partners(request,category):
p = Content.objects.filter(category_id=category)
return render_to_response('reserve/templates/category.html', {'p':p},
context_instance=RequestContext(request))
class ContentCategory(models.Model):
content_category = models.CharField('User-friendly name', max_length = 200)
def __unicode__(self):
return self.content_category
class Content(models.Model):
category = models.ForeignKey(ContentCategory)
external = models.CharField('User-friendly name', max_length = 200, null=True, blank=True)
host = models.CharField('Video host', max_length = 200, null=True, blank=True)
slug = models.CharField('slug', max_length = 200, null=True, blank=True)
def __unicode__(self):
return self.slug
url(r'^category/(?P<category>[-\w]+)/$', 'all_partners'),
有想法该怎么解决这个吗?我认为错误就在这"p = Content..."
条线上。