Closed dwatkinsweb closed 9 years ago
Django core serializers don't support anything but model fields, e.g. can't add get_FOO_display
or any attribute to fields
kwarg for serializer.serialize()
call.
So yeah, you'll have to add the display info manually. Maybe you could override the build_json_response
method to use restframework
serializers, or drop crud view entirely in favour of rest framework while you're at it.
Thank you. I think I'll move to rest framework. I was thinking of integrating that anyways for other tools to use the information and that will probably make it a bit easier.
Thanks
I have a model set up to use an NgCRUDView. It's working correctly as far as I can tell, except I don't want it to return 'J' or 'N', but rather 'Major' or 'Minor' respectively.
I was able to get it working using the following overrides:
I wasn't sure if there was a better way to handle this or if I should even really be using NgCRUDView for something like this.