python - Django Admin custom view using get_urls - doesn't work -
i have followed django docs , i'have added following code models admin.py file
my model customerorder , app name customer_orders
class customerorderadmin(admin.modeladmin): def get_urls(self): urls = super(customerorderadmin, self).get_urls() my_urls = patterns('', (r'^upload/$', self.upload) ) return my_urls + urls def upload(self, request): # custom view should return httpresponse pass
now when try visit '/admin/customer_orders/customerorder/upload/' mentioned in django docs fails following error.
object primary key u'upload' not exist.
and error seems obvious '/admin/customer_orders/customerorder/pk_id' takes me particular model data given primary key.
i don't know i've missed.
Comments
Post a Comment