Django反向问题

时间:2016-04-14 15:42:08

标签: python django

我的应用中有以下UnicodeDecodeError

url.py

现在我正在尝试在我的模型中实现from django.conf.urls import url from . import views urlpatterns = [ url(r'^save_dropbox_files/$', views.save_dropbox_files, name='save_dropbox_files'), url(r'^transfer_files/$', views.show_files_to_transfer, name='show_files_to_transfer'), url(r'^upload/(?P<token>[^/]+)$', views.upload, name='upload'), url(r'^$', views.index, name='index'), ] 函数,如下所示:

get_absolute_url()

我试图从另一个模型中调用它(显然class YoutubeToken(models.Model): userid = models.TextField() access_token = models.TextField() refresh_token = models.TextField(default='None', null=True) created_date = models.DateTimeField('date created', default=timezone.now) def get_absolute_url(self): return reverse('upload', kwargs={'token': self.userid}) 是模型):

youtube

但是,我收到错误next = youtube.get_absolute_url() ,上面的代码有什么问题?
我的预期输出类似于NoReverseMatch: Reverse for 'upload' with arguments '()'

完整的追溯(我在Django的shell中导入模型,而userid不为null):

/upload/token1234

0 个答案:

没有答案