Commit a7ea5e44 authored by Mario Chirinos's avatar Mario Chirinos

update db

parent de5b5a9f
......@@ -60,19 +60,21 @@ class Command(BaseCommand):
os.chdir(curentdir)
publisher = Publisher.objects.all().filter(shortName=p)
print(os.getcwd())
if publisher.count()<=0 and os.path.isfile("settings.json") :
print(p, "do not exsist, crating publisher")
with open('settings.json', 'r') as f:
cfgfile = json.load(f)
newPublisher = Publisher()
newPublisher.shortName=p
newPublisher.name=cfgfile["name"]
newPublisher.crawler=cfgfile["crawler"]
newPublisher.url=cfgfile["url"]
newPublisher.type="texto"
newPublisher.save()
publisher = Publisher.objects.all().filter(shortName=p)
if publisher.count()<=0:
if os.path.isfile("settings.json") :
print(p, "do not exsist, crating publisher")
with open('settings.json', 'r') as f:
cfgfile = json.load(f)
newPublisher = Publisher()
newPublisher.shortName=p
newPublisher.name=cfgfile["name"]
newPublisher.crawler=cfgfile["crawler"]
newPublisher.url=cfgfile["url"]
newPublisher.type="texto"
newPublisher.save()
publisher = Publisher.objects.all().filter(shortName=p)
else:
print("settings.json not found")
else:
publisher=publisher[0]
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