Say I was creating a 'Character' model in Django for an RPG, and I wanted all the attributes (Strength, Dexterity, Stamina etc.) to be defined in a similar way, and be able to be treated in a similar way.
Obviously I could do this:
intelligence = IntegerRangeField(min_value=1, max_value=10)
wits= IntegerRangeField(min_value=1, max_value=10)
resolve = IntegerRangeField(min_value=1, max_value=10)
strength = IntegerRangeField(min_value=1, max_value=10)
dexterity = IntegerRangeField(min_value=1, max_value=10)
stamina = IntegerRangeField(min_value=1, max_value=10)
presence = IntegerRangeField(min_value=1, max_value=10)
manipulation = IntegerRangeField(min_value=1, max_value=10)
composure = IntegerRangeField(min_value=1, max_value=10)
IntegerRangeField definition
But that's not particularly DRY. It also means when I get to add ~30 skills that are similar I'm going to be even less dry, and prone to mistakes.
These don't seem worth creating via foreign keys (which is the solution here), as I'd need to specify 9 of them for each attribute etc.
Is there a solution to this already that is DRY? Or will I need to roll my own?
Edit:
My Primary use of attributes and skills is to provide totals for skill checks, for instance if I want to know how many dice to roll for Programming
I might specify it uses the characters intelligence+computers
attributes and skill, and for example from a list of 'Tasks' (e.g. other combinations of attributes and skills) show the top five that character can perform.
Edit:
Looks like following the M2M route has lead me to overnormalization. Would anyone be able to suggest improvements?