def main(): for name, url, version in lino_site.thanks_to(): print name, version, "<%s>" % url app_labels = [n for n in db_apps()] #appnames = [m.__name__ for m in models.get_apps()] print "reset_demo.py", app_labels #print "\n".join([m._meta.db_table for m in loading.get_models()]) options = dict(interactive=False) if not syscon.confirm( "Gonna reset database %s. Are you sure?" % settings.DATABASE_NAME): return print "reset" if settings.DATABASE_ENGINE == 'sqlite3': if settings.DATABASE_NAME != ':memory:': if os.path.exists(settings.DATABASE_NAME): os.remove(settings.DATABASE_NAME) else: call_command('reset', *app_labels, **options) #call_command('reset','songs','auth',interactive=False) print "syncdb" call_command('syncdb', **options) #call_command('flush',interactive=False) print "loaddata demo" call_command('loaddata', 'demo') User.objects.create_superuser('root', '*****@*****.**', '1234') User.objects.create_user('user', '*****@*****.**', '1234') Site(id=1, domain="igen.saffre-rumma.ee", name="Lino/Django demo").save()
def main(): for name,url,version in lino_site.thanks_to(): print name,version, "<%s>" % url app_labels = [n for n in db_apps()] #appnames = [m.__name__ for m in models.get_apps()] print "reset_demo.py", app_labels #print "\n".join([m._meta.db_table for m in loading.get_models()]) options = dict(interactive=False) if not syscon.confirm("Gonna reset database %s. Are you sure?" % settings.DATABASE_NAME): return print "reset" if settings.DATABASE_ENGINE == 'sqlite3': if settings.DATABASE_NAME != ':memory:': if os.path.exists(settings.DATABASE_NAME): os.remove(settings.DATABASE_NAME) else: call_command('reset',*app_labels,**options) #call_command('reset','songs','auth',interactive=False) print "syncdb" call_command('syncdb',**options) #call_command('flush',interactive=False) print "loaddata demo" call_command('loaddata','demo') User.objects.create_superuser('root','*****@*****.**','1234') User.objects.create_user('user','*****@*****.**','1234') Site(id=1,domain="igen.saffre-rumma.ee",name="Lino/Django demo").save()
def main(*args,**kw): msg = "Gonna rebuild the following files:\n" msg += ", ".join(["%s.help.txt" % ct for ct in CONSOLE_TARGETS]) if confirm(msg+"\nAre you sure?"): for ct in CONSOLE_TARGETS: cmd = "lino %s --help > %s.help.txt" % (ct,ct) print cmd trycmd(cmd)
def send_invoices(): q = [ o.get_child_instance() for o in sales.SalesDocument.objects.all() ] q = [ o for o in q if o.must_send() ] #~ q = [o for o in sales.SalesDocument.objects.filter( #~ sent_time__exact=None).exclude(user__exact=None)] if len(q) == 0: print "Nothing to do." return print "%d documents to send: " % len(q) \ + ", ".join(str(d) for d in q) if not syscon.confirm("Send these documents?"): return for doc in q: doc.send()
def send_invoices(): q = [o.get_child_instance() for o in sales.SalesDocument.objects.all()] q = [o for o in q if o.must_send()] #~ q = [o for o in sales.SalesDocument.objects.filter( #~ sent_time__exact=None).exclude(user__exact=None)] if len(q) == 0: print "Nothing to do." return print "%d documents to send: " % len(q) \ + ", ".join(str(d) for d in q) if not syscon.confirm("Send these documents?"): return for doc in q: doc.send()
def make_invoices(): rpt = sales.PendingOrders() print rpt.as_text() q = [o for o in sales.Order.objects.pending()] if len(q) == 0: print "Nothing to do." return #~ for o in q: #~ print o if not syscon.confirm("Make invoices for these orders?"): return for o in q: i = o.make_invoice() print "%s made %s" % (o,i)
def make_invoices(): rpt = sales.PendingOrders() print rpt.as_text() q = [o for o in sales.Order.objects.pending()] if len(q) == 0: print "Nothing to do." return #~ for o in q: #~ print o if not syscon.confirm("Make invoices for these orders?"): return for o in q: i = o.make_invoice() print "%s made %s" % (o, i)