Commit a7ea5e44 authored by Mario Chirinos's avatar Mario Chirinos

update db

parent de5b5a9f
...@@ -60,19 +60,21 @@ class Command(BaseCommand): ...@@ -60,19 +60,21 @@ class Command(BaseCommand):
os.chdir(curentdir) os.chdir(curentdir)
publisher = Publisher.objects.all().filter(shortName=p) publisher = Publisher.objects.all().filter(shortName=p)
print(os.getcwd()) print(os.getcwd())
if publisher.count()<=0 and os.path.isfile("settings.json") : if publisher.count()<=0:
if os.path.isfile("settings.json") :
print(p, "do not exsist, crating publisher") print(p, "do not exsist, crating publisher")
with open('settings.json', 'r') as f: with open('settings.json', 'r') as f:
cfgfile = json.load(f) cfgfile = json.load(f)
newPublisher = Publisher() newPublisher = Publisher()
newPublisher.shortName=p newPublisher.shortName=p
newPublisher.name=cfgfile["name"] newPublisher.name=cfgfile["name"]
newPublisher.crawler=cfgfile["crawler"] newPublisher.crawler=cfgfile["crawler"]
newPublisher.url=cfgfile["url"] newPublisher.url=cfgfile["url"]
newPublisher.type="texto" newPublisher.type="texto"
newPublisher.save() newPublisher.save()
publisher = Publisher.objects.all().filter(shortName=p) publisher = Publisher.objects.all().filter(shortName=p)
else:
print("settings.json not found")
else: else:
publisher=publisher[0] publisher=publisher[0]
print(publisher) print(publisher)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment