Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

id column integer primary key of 0 gets returned as null #1244

Closed
Labels
@tonytony99

Description

@tonytony99

If a model has an id column that's an integer primary key

classPerson(models.Model):id=models.IntegerField(primary_key=True)name=models.CharField(max_length=200)

and a fixture is loaded where the id has value 0

[    {"model":"project.person","fields": {"id":0,"name":"Example"}},    {"model":"project.person","fields": {"id":1,"name":"Someone"}}]

then the JSON response returned from the API replaces the id of 0 with null

"data": [        {"type":"person","id":null,"attributes": {"name":"Example"            }        },        {"type":"person","id":"1","attributes": {"name":"Someone"            }        }    ],

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp