Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
585 views
in Technique[技术] by (71.8m points)

django - I have problem with AutoField in my model and seqence in oracle database

I use Legacy database oracle 11g and there are a seqences.

If I remove number_mymodel field from my model i have an error: ORA-00904: "MYMODEL"."ID": invalid identifier

if i try

class MyModel(models.Model):
    number_mymodel = models.AutoField(primary_key=True ,auto_created=True)
    ...

it's work, but if I want add in my django admin panel number_Mymodel is NULL so I can't add it.

What should I do with my sequence in database or in my model? I want that, if I'm adding in django panel it will be autoincrement number_mymodelin my database.

question from:https://stackoverflow.com/questions/65839605/i-have-problem-with-autofield-in-my-model-and-seqence-in-oracle-database

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...