AncientSwordRage / nWoD-db

Web app for creating new world of darkness characters and browsing character data (Mage spells, vampire disciplines merits, etc)
1 stars 0 forks source link

Add values to serialized traits #2

Open AncientSwordRage opened 9 years ago

AncientSwordRage commented 9 years ago

Currently serialized mages/characters look like this:

[
    {
        "id": 3, 
        "player": "admin", 
        "name": "gandalf", 
        "sub_race": "Foo", 
        "faction": "Foo", 
        "is_published": false, 
        "power_level": 1, 
        "energy_trait": 7, 
        "virtue": "prudence", 
        "vice": "lust", 
        "morality": 7, 
        "size": 5, 
        "arcana": [
            "Fate", 
            "Mind", 
            "Spirit", 
            "Death", 
            "Forces", 
            "Time", 
            "Space", 
            "Life", 
            "Matter", 
            "Prime"
        ], 
        "attributes": [
            "Intelligence", 
            "Wits", 
            "Resolve", 
            "Strength", 
            "Dexterity", 
            "Stamina", 
            "Presence", 
            "Manipulation", 
            "Composure"
        ], 
        "skills": [
            "Academics", 
            "Computer", 
            "Crafts", 
            "Investigation", 
            "Medicine", 
            "Occult", 
            "Politics", 
            "Science", 
            "Athletics", 
            "Brawl", 
            "Drive", 
            "Firearms", 
            "Larceny", 
            "Stealth", 
            "Survival", 
            "Weaponry", 
            "Animal", 
            "Empathy", 
            "Expression", 
            "Intimidation", 
            "Persuasion", 
            "Socialize", 
            "Streetwise", 
            "Subterfuge"
        ]
    }
]

But the traits don't have related values. This is because We're just using:

    arcana = serializers.StringRelatedField(many=True)
    attributes = serializers.StringRelatedField(many=True)
    skills = serializers.StringRelatedField(many=True)

For the fields

AncientSwordRage commented 9 years ago

This is an important question:

http://stackoverflow.com/q/25450323/1075247