I would create a many-to-many relationship between Student and Class 
through a custom intermediate model called Grade. You can then add a date 
field to Grade and any other extra fields you want.

Read up on m2m relationships here: 
https://docs.djangoproject.com/en/dev/topics/db/models/#many-to-many-relationships

Basically, you want to add a field to Student like

    classes = models.ManyToManyField(Class, through='Grade')

Then add a new model like this:

class Grade(models.Model):
    student = models.ForeignKey(Student)
    class = models.ForeignKey(Class)
    grade = models.IntegerField()
    date = models.DateField(auto_now_add=True)


-Psamathos


On Tuesday, 27 March 2012 21:18:12 UTC-4, Zach wrote:
>
> I have the following in my Student model. I am wanting to track the 
> date of each point given to each student. The idea would be so that I 
> could see not only how many points each student has, but also see the 
> date each point was given. In the future I want to see the trend of 
> each students' points.   How should I go about this? Should I use a 
> Foreign Key in another class. I am new to this so thanks for reading. 
>
>
> class Student(models.Model): 
>
>   CLASS_CHOICES = ( 
>         (u'Yoga','Yoga'), 
>         (u'Spanish', 'Spanish'), 
>         (u'French', 'French'), 
>         (u'Dance', 'Dance'), 
>   ) 
>
>   name = models.CharField(max_length=30) 
>   points = models.IntegerField(max_length=4) 
>   classname = models.CharField("Class Name",max_length=20, choices = 
> CLASS_CHOICES) 
>
>
On Tuesday, 27 March 2012 21:18:12 UTC-4, Zach wrote:
>
> I have the following in my Student model. I am wanting to track the 
> date of each point given to each student. The idea would be so that I 
> could see not only how many points each student has, but also see the 
> date each point was given. In the future I want to see the trend of 
> each students' points.   How should I go about this? Should I use a 
> Foreign Key in another class. I am new to this so thanks for reading. 
>
>
> class Student(models.Model): 
>
>   CLASS_CHOICES = ( 
>         (u'Yoga','Yoga'), 
>         (u'Spanish', 'Spanish'), 
>         (u'French', 'French'), 
>         (u'Dance', 'Dance'), 
>   ) 
>
>   name = models.CharField(max_length=30) 
>   points = models.IntegerField(max_length=4) 
>   classname = models.CharField("Class Name",max_length=20, choices = 
> CLASS_CHOICES) 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/GJahRfAOpuoJ.
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.

Reply via email to