Trying to follow the example mentionned in Django 1.9 documentation, I'm unable to make it works as described.
Here's the code I'm stuck with :
fields.py
class Hand(object):
"""A hand of cards (bridge style)"""
def __init__(self, north, east, south, west):
# Input parameters are lists of cards ('Ah', '9s', etc)
self.north = north
self.east = east
self.south = south
self.west = west
class HandField(models.Field):
def __init__(self, *args, **kwargs):
kwargs['max_length'] = 104
super(HandField, self).__init__(*args, **kwargs)
def deconstruct(self):
name, path, args, kwargs = super(HandField, self).deconstruct()
del kwargs["max_length"]
return name, path, args, kwargs
models.py
from django.db import models
from .fields import HandField
class Game(models.Model)
hand = HandField()
However, when trying to migrate, I see the hand column is not created :
...
-- Create model Game
--
CREATE TABLE "django_quizz_game" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT);
--
...
What am I missing ? btw, I can't figure out where the relationship between the Hand class and the HandField class (should) occur.