Closed MattFisher closed 12 years ago
Ah, interesting. You want to fork and add to the docs? :)
On Aug 8, 2011, at 3:11 AM, MattFisher wrote:
I think it needs to be made clear that the model names in urls for ModelEndpoints such as
/ajax/my_app/mymodel/{pk}/tags/add.json
must not be capitalised or the endpoint_loader will fail.eg if you posted to
/ajax/my_app/Mymodel/{pk}/tags/add.json
thenhasattr(my_app.endpoints, 'Mymodel')
will return true becauseendpoints
importsMymodel
to create theModelEndpoint
, but this will make theendpoint_loader
think it's an ad-hoc endpoint instead. Fromendpoint_loader
:if hasattr(module, model): # This is an ad-hoc endpoint endpoint = getattr(module, model)
It will then fail when it tries to serialize the model object via
data = endpoint(request)
Reply to this email directly or view it on GitHub: https://github.com/joestump/django-ajax/issues/15
I think it needs to be made clear that the model names in urls for ModelEndpoints such as
/ajax/my_app/mymodel/{pk}/tags/add.json
must not be capitalised or the endpoint_loader will fail.eg if you posted to
/ajax/my_app/Mymodel/{pk}/tags/add.json
thenhasattr(my_app.endpoints, 'Mymodel')
will return true becauseendpoints
importsMymodel
to create theModelEndpoint
, but this will make theendpoint_loader
think it's an ad-hoc endpoint instead. Fromendpoint_loader
:It will then fail when it tries to serialize the model object via
data = endpoint(request)