question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Browsable API crashes with PresentablePrimaryKeyRelatedField

See original GitHub issue

While declaring the presentable primary key related field like following:

city = PresentablePrimaryKeyRelatedField(
        queryset=City.objects,
        presentation_serializer=CitySerializer
    )

where city serializer is

class CitySerializer(ModelSerializer):
    class Meta:
        model = City

I get unhashable type: 'ReturnDict' in the browsable API. Any ideas how to fix it?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
yigitgulercommented, Jul 13, 2017

Hi @scheparev-moberries,

Thank you for the report. @alicertel is responsible from that field. Assigning to him.

0reactions
yigitgulercommented, Mar 25, 2018

We took a release (0.10) you can use it from pypi as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PresentablePrimaryKeyRelatedF...
I have a serializer field which works differently for read and write. I used PresentablePrimaryKeyRelatedField for that. e.g:
Read more >
Release Notes - Django REST framework
Removes a XSS vulnerability for some kinds of content in the browsable API. 3.11.1. Date: 5th August 2020. Fix compat with Django 3.1....
Read more >
Release Notes - Django REST framework
Django, API, REST, Release Notes. ... Fix exception when HTML_CUTOFF is set to None . #5174; Fix browsable API not supporting multipart/form-data correctly....
Read more >
PUT/POST fails in case of blank input to optional fields in ...
1. If the parent serializer class has optional fields and I enter blank inputs for those fields through the browsable API when writing...
Read more >
Django Rest Framework – An Introduction - Real Python
2 for this application. This tutorial covers these topics: DRF Setup; RESTful Structure; Model Serializer; DRF Web Browseable API. Free Bonus: Click here ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found