MattBroach / DjangoRestMultipleModels

View (and mixin) for serializing multiple models or querysets in Django Rest Framework
MIT License
549 stars 67 forks source link

Caps in model name are not displayed #28

Closed masaruduy closed 7 years ago

masaruduy commented 7 years ago

screen shot 2017-05-17 at 8 37 17 pm ex: My model name is called userType but when I use it with the DjangoRestMultipleModels view, I get: { "usertype": [ { "id": 1, Perhaps I'm doing something wrong?

MattBroach commented 7 years ago

You're not doing anything wrong: for standardization purposes, the auto label creation from the model runs .lower() on the model name. If having the caps is important, you can manually specify the label as a third option:

queryList = [
    (userType.objects.all(), userTypeSerializer, 'userType'),
    ....
]
masaruduy commented 7 years ago

Got it thanks!

On Sun, May 21, 2017 at 12:54 PM, Matt Nishi-Broach < notifications@github.com> wrote:

You're not doing anything wrong: for standardization purposes, the auto label creation from the model runs .lower() on the model name. If having the caps is important, you can manually specify the label as a third option:

queryList = [ (userType.objects.all(), userTypeSerializer, 'userType'), .... ]

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Axiologue/DjangoRestMultipleModels/issues/28#issuecomment-302948703, or mute the thread https://github.com/notifications/unsubscribe-auth/AHAD_vCT-0o_e8ftVdZTZ7X1CkQX_4e5ks5r8GxPgaJpZM4NemcP .

-- -Duy