Ticket #9779: tutorial-db-introspection.diff

File tutorial-db-introspection.diff, 1.6 KB (added by Ramiro Morales, 16 years ago)

Efefcto of that patch intrspecting a sqlite3 DB with the project from the Django tutorial

  • .py

    old new  
    1717
    1818class AuthGroupPermissions(models.Model):
    1919    id = models.IntegerField(primary_key=True)
    20     group_id = models.IntegerField()
    21     permission_id = models.IntegerField()
     20    group = models.ForeignKey(AuthGroup)
     21    permission = models.ForeignKey(AuthPermission)
    2222    class Meta:
    2323        db_table = u'auth_group_permissions'
    2424
    2525class AuthMessage(models.Model):
    2626    id = models.IntegerField(primary_key=True)
    27     user_id = models.IntegerField()
     27    user = models.ForeignKey(AuthUser)
    2828    message = models.TextField()
    2929    class Meta:
    3030        db_table = u'auth_message'
     
    5454
    5555class AuthUserGroups(models.Model):
    5656    id = models.IntegerField(primary_key=True)
    57     user_id = models.IntegerField()
    58     group_id = models.IntegerField()
     57    user = models.ForeignKey(AuthUser)
     58    group = models.ForeignKey(AuthGroup)
    5959    class Meta:
    6060        db_table = u'auth_user_groups'
    6161
    6262class AuthUserUserPermissions(models.Model):
    6363    id = models.IntegerField(primary_key=True)
    64     user_id = models.IntegerField()
    65     permission_id = models.IntegerField()
     64    user = models.ForeignKey(AuthUser)
     65    permission = models.ForeignKey(AuthPermission)
    6666    class Meta:
    6767        db_table = u'auth_user_user_permissions'
    6868
     
    9090
    9191class PollsChoice(models.Model):
    9292    id = models.IntegerField(primary_key=True)
    93     poll_id = models.IntegerField()
     93    poll = models.ForeignKey(PollsPoll)
    9494    choice = models.CharField(max_length=200)
    9595    votes = models.IntegerField()
    9696    class Meta:
Back to Top