correct foreigns keys

main
jgenero 3 years ago
parent 0a373bf830
commit c845a0ee0d

@ -59,7 +59,7 @@ class Diplo_type(Model):
class Document(Model):
id_document = IntegerField(primary_key=True)
inst_doc = ForeignKeyField(Institution, backref='document')
inst_doc = ForeignKeyField(Institution, backref='documents')
collection_doc = TextField()
class Meta:
@ -73,10 +73,11 @@ class Acte(Model):
date_time = TextField() # YYYY-MM-DD
date = TextField() # verbose
analysis = TextField()
doc_acte = ForeignKeyField(Document, backref='acte')
doc_acte = ForeignKeyField(Document, backref='actes')
ref_acte = TextField() # cote
state_doc = ForeignKeyField(State, backref='acte')
diplo_type_acte = ForeignKeyField(Diplo_type, backref='acte')
state_doc = ForeignKeyField(State, backref='actes')
diplo_type_acte = ForeignKeyField(Diplo_type, backref='actes')
prod_place_acte = ForeignKeyField(Production_place, backref='actes')
class Meta:
database = db
@ -94,7 +95,7 @@ class Individual(Model):
class Duke(Model):
id_duke = IntegerField(primary_key=True)
house = TextField()
indiv_duke = ForeignKeyField(Individual, backref='duke')
indiv_duke = ForeignKeyField(Individual, backref='dukes')
birth = TextField()
reign = TextField()
death = TextField()
@ -102,3 +103,12 @@ class Duke(Model):
class Meta:
database = db
db_table = 'Duke'
class Produced_by(Model):
id_produced_by = IntegerField(primary_key=True)
produced_by_acte = ForeignKeyField(Acte, backref='produced_bys')
produced_by_prince = ForeignKeyField(Duke, backref='produced_bys')
class Meta:
database = db
db_table = 'Produced_by'

Loading…
Cancel
Save