Hello, I am writing my first app in Django. I already have existing tables/sequences/triggers in Oracle. so I used "inspectdb" to generate the models for django. Here's one model for example:
class Instructors(models.Model): > instructorid = models.IntegerField(db_column='INSTRUCTORID', > primary_key=True) # Field name made lowercase. > instructor_name = models.CharField(max_length=50, > db_column='INSTRUCTOR_NAME', blank=True) # Field name made lowercase. > instructor_email = models.CharField(max_length=255, > db_column='INSTRUCTOR_EMAIL', blank=True) # Field name made lowercase. > comments = models.CharField(max_length=255, db_column='COMMENTS', > blank=True) # Field name made lowercase. > fingerprint = models.CharField(max_length=8, db_column='FINGERPRINT', > blank=True) # Field name made lowercase. > timestamp = models.DateField(null=True, db_column='TIMESTAMP', > blank=True) # Field name made lowercase. > > def __unicode__(self): > return self.instructor_name > class Meta: > db_table = u'INSTRUCTORS' > After "syncdb", here's what I do in the shell: >>>from mysite.assignments.models import Instructors >>>p = Instructors(instructor_ name="John",instructor_email = " jo...@email.com <wanpeng.y...@gmail.com>") >>>p.save() I already have a trigger in oracle to insert the instructorid, the fingerprint and timestamp. However, when I type: >>>p.instructorid It returns null while it should return a new instructorid. If I change the model type of instructorid to AutoField, I get the 'Cannot find sequence' error when using p.save() , but I do have the sequence and trigger. I tried to create a new model in django and let django create the table for me in oracle. I don't have the same problem as with the existing tables. So how can I let django know 'I already have sequences and triggers, use them!' ? Thank you. --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---