Hi Bruno It's only to overview the stats and be able to track it.
I had started looking at binding the skill to the player og detecting in the skill if it's changed. If its change then create a new one. But I can see the point in putting it en a seperate class and make it a skill changed instead. Not sure what you mean by detecting skill change using properties, I havn't looked into that. Could you point to some documentation about it. Thanks for the input, it has been very helpful. /Carsten On 24 Maj, 17:10, bruno desthuilliers <bruno.desthuilli...@gmail.com> wrote: > On May 23, 10:45 pm, Carsten Jantzen <cars...@jantzens.net> wrote: > > > When I load the player I would like to see his latest stats. > > If I goto the players page I would like to be able to view when and > > what skill changed. > > > I am looking for a good way to implement it. > > I was thinking to make the skill it's own object and make a one to > > many relation on the player. > > What I am afraid of is that the same skill will show up multiple times > > when loading the player. > > There are many ways to tackle this problem, and the "best" one depends > on your game's rules. Your above solution would indeed return the > whole history, and you'd need to filter it out to only get the last > value for each skill. A PITA to work with and not exactly efficient... > > If it's only for stats and you have no other reason to turn skills > into proper models, the simplest thing would be to add a > "SkillChanged" model, ie (Q&D): > > class SkillChange(models.Model): > player = models.ForeignKey(Player) > skill = models.CharField() > value = models.IntegerField() > date = models.DatetimeField(auto_now_add=True) > > then detect skill changes using properties (or explicit getters / > setters) to access your Player's class skills fields and create a new > SkillChange for each skill update. > > Or use any of the solutions Andre suggested.... -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.