Hello Django users,

i just started working with django and i really can't figure out even
with the tutorial how i can get some info out of the database.

i have the following database models

class LoginInfo(models.Model):

        lab_id = models.IntegerField(maxlength=10)
        password = models.CharField(maxlength=20)

class Modules(models.Model):

        user = models.ForeignKey(LoginInfo)
        lupus = models.IntegerField(maxlength=1)
        apa = models.IntegerField(maxlength=1)

        def __str__(self):
                return self.lupus,self.apa

i imported 2 users in the model LoginInfo the first is lab_id = '100'
and the second is lab_id = '200'
how do i put in the data in the class Modules ?

what i thought i had to do was first create a object from the LoginInfo
class like
p = LoginInfo.objects.get(lab_id='100')

and next just put in the data in the Modules class like
p.module_set.create(lupus=1,apa=0)

but i get the following error message
AttributeError: 'LoginInfo' object has no attribute 'module_set'

does anyone know what i'm doing wrong,

thanks in advance for your help

richard


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to