Hey all,
I'm having trouble wrapping my head around querying multiple tables
with relations between them.
I'm writing an (cms-like) app that will use an existing mysql
database. I modeled that, got my code up and running and am now in the
process of trying to retrieve and submit data to it.
Here is an example of my model:
class Author(models.Model):
authorid = models.IntegerField(primary_key=True,
db_column='AuthorID')
firstname = models.CharField(max_length=96,
db_column='FirstName')
lastname = models.CharField(max_length=96, db_column='LastName')
....
class Meta:
db_table = u'Author'
def __unicode__(self):
return self.middleinitials
class Documentrevision(models.Model):
docrevid = models.IntegerField(primary_key=True,
db_column='DocRevID')
documentid = models.IntegerField(db_column='DocumentID')
submitterid = models.IntegerField(db_column='SubmitterID')
...
class Meta:
db_table = u'DocumentRevision'
def __unicode__(self):
return self.documenttitle
Now, for every documentid I retrieve I want to find it's firstname and
lastname. Authorid relates to submitterid in this case.
Can someone help me on my way on how to accomplish this?
Many thanks,
Michel
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
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.