Ejemplo n.º 1
0
def Systems(request):
    if request.method == "POST":
        name = request.POST.get("wzna")
        photo = request.FILES.get("photo")
        keyword = request.POST.get("key")
        pa = request.POST.get("path")
        mi = request.POST.get("neirong")
        ban = request.POST.get("banquan")
        bei = request.POST.get("beian")
        if photo:
            path = os.path.join(os.getcwd(), 'static\\upload')
            pathname = os.path.join(path, photo.name)
            path1 = default_storage.save(pathname, ContentFile(photo.read()))
            pathname2 = os.path.join('static/upload', photo.name).replace('\\', '/')
            ss = System(name=name,path=pathname2,keyword=keyword,filepath=pa,nei=mi,ban=ban,bei=bei)
            ss.save()
    return render(request,'Systems.html')
Ejemplo n.º 2
0
 def handle(self, *args, **kwargs):
     Loan.objects.all().delete()
     Recurrency.objects.all().delete()
     Transport.objects.all().delete()
     Driver.objects.all().delete()
     ItemDelivery.objects.all().delete()
     Address.objects.all().delete()
     System.objects.all().delete()
     sys = System()
     now_time = utc_to_local(datetime.datetime.now())
     sys.last = now_time
     sys.save()
     dic_sys = {}
     dic_sys[sys.type] = sys.timer
     sys.next = now_time + relativedelta(**dic_sys)
     sys.save()
     for i in range(50):
         transp = Transport()
         transp.save(first_save=True)
         driver = Driver()
         driver.save(first_save=True)
         idelivr = generate_object_item_delivery()
         print(idelivr.lat, idelivr.lng)