I'm really at sea here with my models. I used to have an application
in python with cgi, which would allow children to solve simple
multiplication problems and earn points for their team, which is then
displayed in a league table.

I thought it would be fun to port this over to django to see how it
works. I've written other more simple apps with django and so am up
for the challenge.

However, I'm not sure how to construct my models so that they work
properly once everything is built.

tables/models.py looks like this so far:

from django.db import models
# The pupil
class Pupil(models.Model):
    name = models.CharField(max_length=200)
    score = models.IntegerField()
    result = models.ManyToManyField('Result')
    team = models.OneToOneField('Team')

#The teams that the pupils will support
class Team(models.Model):
    name = models.CharField(max_length=200)
    pupils = models.ManyToManyField('Pupil')

# The results from the games that the pupils play (including table
taken and the results out of 10 for that game)
class Result(models.Model):
    date = models.DateTimeField(auto_now_add=True)
    pupil = models.ManyToManyField('Pupil')
    table = models.ManyToManyField('Table')
    score = models.IntegerField()

#What tables are we offering at the moment to test?
class Table(models.Model):
    TABLE_CHOICES = ( '2', '5', '10')
    table = models.CharField(max_length=1, choices=TABLE_CHOICES)

#Will control how many points each times table will earn for the pupil
for each game.
class Point (models.Model):
    point = models.IntegerField()
    table = models.OneToOneField('Table')

I basically want to keep results for each test taken and then
aggregate these in to total scores for the pupil but also total score
for the team that the pupil belongs to.
Each multiplication table will have a different score (7x are harder
and so should earn more points that 2x).

Can anyone offer this newbie some advice on why this doesn't validate?
Any other offers of how better to construct these models would also be
appreciated.

Thanks in advance.
Adam
--
You back your data up on the same planet?
http://www.monkeez.org
PGP key: 0x7111B833

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to