replace place by product_place

main
jgenero 3 years ago
parent f77984a383
commit 8ecce8d6e8

@ -14,7 +14,7 @@ from bs4 import BeautifulSoup
from peewee import * from peewee import *
from tqdm import tqdm from tqdm import tqdm
from modeles.princes_db_tables import db, Institution, State, Place, Diplo_type, Document, Acte from modeles.princes_db_tables import db, Institution, State, Production_place, Diplo_type, Document, Acte
from data.institution_data import institution from data.institution_data import institution
from data.state_data import state from data.state_data import state
@ -40,7 +40,7 @@ def _create_diplo_type(data_lst: list)-> None:
for data in tqdm(data_lst, desc="Populating Diplo_type..."): for data in tqdm(data_lst, desc="Populating Diplo_type..."):
Diplo_type.create(**data) Diplo_type.create(**data)
def _create_place(xml_file: str)-> None: def _create_produc_place(xml_file: str)-> None:
places_xtract = [] places_xtract = []
production_places = [] production_places = []
soup = make_soup(xml_file) soup = make_soup(xml_file)
@ -61,7 +61,7 @@ def init():
_create_institution(institution) _create_institution(institution)
_create_state(state) _create_state(state)
_create_diplo_type(diplomatic_type) _create_diplo_type(diplomatic_type)
_create_place(xml) _create_produc_place(xml)
xml = "../bourbon-latex/charles-actes-latex.xml" xml = "../bourbon-latex/charles-actes-latex.xml"

@ -38,13 +38,13 @@ class State(Model):
db_table = 'State' db_table = 'State'
class Place(Model): class Production_place(Model):
id_place = IntegerField(primary_key=True) id_place = IntegerField(primary_key=True)
placename = TextField() placename = TextField()
class Meta: class Meta:
database = db database = db
db_table = 'Place' db_table = 'Production_place'
class Diplo_type(Model): class Diplo_type(Model):
@ -59,7 +59,7 @@ class Diplo_type(Model):
class Document(Model): class Document(Model):
id_document = IntegerField(primary_key=True) id_document = IntegerField(primary_key=True)
doc_reference = TextField() doc_reference = TextField()
institution_doc = ForeignKeyField(Institution, backref='document') inst_doc = ForeignKeyField(Institution, backref='document')
state_doc = ForeignKeyField(State, backref='document') state_doc = ForeignKeyField(State, backref='document')
class Meta: class Meta:

Loading…
Cancel
Save