Skip to content


Repository files navigation


installation can be done via pip install djangorestrelationalhyperlink

A simple serializer that allows relations to be changed using the url while still allowsing to see/update/create objects via normal methods.

the example above is a team -> player model

our initial pull brings in the teams and the players ie

        {"url": "", "team": "", "player_name": "George Monroe"},  
        {"url": "", "team": "", "player_name": "John Jeffereson"},  
        {"url": "", "team": "", "player_name": "Thomas Adams"},  
        {"url": "", "team": "", "player_name": "James Washington"},  
        {"url": "", "team": "", "player_name": "James Jeffereson"},  
        {"url": "", "team": "", "player_name": "James Van Buren"},  
        {"url": "", "team": "", "player_name": "Andrew Quincy Adams"},  
        {"url": "", "team": "", "player_name": "Martin Monroe"}  

    "url": "", "team_name": "team 3"  

but if we want to add players to a team we can use the logic of a hyper linked field, ie, only use the url

ie PUT

    partial: true,  
    player_set: [""]  
    team_name: "team 1"  

ie we can read and write to this serializer with dictionarys like a normal serializer but we can change relations with these objects using urls. This is useful when pulling in large JSON structures without having to post back a lot of data to the server.

please note all this does is mirror the existing hyperlinked field logic, at the moment this only supports adding to the player set so the above put will only add to the player set not remove existing players


additional serializers and resources for django rest






No releases published


No packages published