Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango and DB error "Column 'id' specified twice"
    primarykey
    data
    text
    <p>I am new to django and I am having some issues when I try to save a mapping. </p> <pre><code>from django.db import models # Create your models here. class Users(models.Model): user = models.CharField(max_length=45) password = models.CharField(max_length=125) env = models.CharField(max_length=10) class Meta: db_table = 'esp-users' def __unicode__(self): return unicode(self.user) class Groups(models.Model): group_name = models.CharField(max_length=45) description = models.CharField(max_length=255) env = models.CharField(max_length=45) class Meta: db_table = 'esp-groups' def __unicode__(self): return unicode(self.group_name) class Roles(models.Model): role_name = models.CharField(max_length=45) env = models.CharField(max_length=10) class Meta: db_table = 'esp-roles' def __unicode__(self): return unicode(self.role_name) class Group_Map(models.Model): group_id = models.ForeignKey(Groups, db_column='id') user_id = models.ForeignKey(Users, db_column='id') class Meta: db_table='esp-group-map' def __unicode__(self): return unicode(self.group_id) class Role_Map(models.Model): role_id = models.ForeignKey(Roles, db_column='id') group_id = models.ForeignKey(Groups, db_column='id') class Meta: db_table='esp-role-map' def __unicode__(self): return unicode(self.role_id) </code></pre> <p>Thanks for the help. </p> <p>Django V 1.3, Python 2.4, Mysql 5.0.77</p> <p>Request Method: POST Request URL: <a href="http://somehost:8100/admin/users_admin/group_map/add/" rel="nofollow">http://somehost:8100/admin/users_admin/group_map/add/</a> Django Version: 1.3 Exception Type: DatabaseError Exception Value: </p> <p>(1110, "Column 'id' specified twice")</p> <p>Lesson Learned: If its a new database isntead of making the tables yourself just run python manage.py syncdb and it will make the db for you and all is good. Thanks for the help!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload