def home(request): context = { 'books': Book.objects.all(), 'form': UserRegistrationFom(), 'form2': UserLogInForm() } check(request) return render(request, 'shop/shop-home.html', context)
def set_properties(self, i1, i2, **properties): memo = self.texel.get_styles(i1, i2) self.texel = self.texel.set_properties(i1, i2, properties).\ simplify(i1).simplify(i2) assert check(self.texel) self.notify_views('properties_changed', i1, i2) return memo
def cart(request): if request.user.is_authenticated: check(request) cart = Cart.objects.get(user=User.objects.get( email=request.user.email)) count = Count.objects.filter(cart=cart) for i in count: if str(i.id) in request.POST: cart.total = F('total') - i.price cart.save() i.delete() # count.save() return HttpResponseRedirect('') context = {'cart': cart, 'count': count} return render(request, 'shop/cart.html', context) else: return render(request, 'shop/cart.html')
def insert(self, i, text): assert isinstance(text, TextModel) row, col = self.index2position(i) self.texel = group([ self.texel.insert(i, text.texel). \ simplify(i). \ simplify(i+len(text))] ) assert check(self.texel) l1 = self.linelengths l2 = text.linelengths r2 = len(text)-sum(l2) l_ = l1[:row]+l2+l1[row:] if row < len(l_): l_[row] += col if row+len(l2) < len(l_): l_[row+len(l2)] += r2-col self.linelengths = l_ self.notify_views('inserted', i, len(text))
def remove(self, i1, i2): row1, col1 = self.index2position(i1) row2, col2 = self.index2position(i2) texel, old = self.texel.takeout(i1, i2) self.texel = group([texel.simplify(i1)]) # update der linelengths l = self.linelengths l_ = l[:] del l_[row1:row2] if row1<len(l_): l_[row1] += col1-col2 self.linelengths = l_ model = TextModel() model.texel = old model.linelengths = l[row1:row2] if len(model.linelengths): model.linelengths[0] -= col1 self.notify_views('removed', i1, old) assert check(self.texel) return model
msg.attach(part) server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login(email, password) text = msg.as_string() server.sendmail(email, send_to_email, text) server.quit() #Input from sensor inp = 1 if inp: print("Scan QR") output = QR.scan().strip("b'") price = base.check( output ) #A tuple (price amount, list[df.loc[df['regno'] == id]]) where second element = [regno, name, email] print("This is price : ", price[0]) if price[0] == 1: empty_detect.empty() try: user_image = image_mail(price[-1][-2]) user_image.send_image user_schedule = scheduling_remainders() user_schedule.schedule(user_scheduling.job()) except: pass elif price[0] > 1: user_money = Mailing(str(int(price[0]))) user_money.send_mail() print("Thanks for using our service")
part.add_header('Content-Disposition', "attachment; filename= %s" % filename) # Attach the attachment to the MIMEMultipart object msg.attach(part) server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login(email, password) text = msg.as_string() server.sendmail(email, send_to_email, text) print("Mail sent successfully") server.quit() #Input from sensor inp = 1 if inp: #print("Scan QR") output = QR.scan().strip("b'") price = base.check(output) #A tuple (price amount, out) where second element = [regno, name, email, hours] #print("This is price : ", price[0]) if price [0] == 1: empty_detect.empty() try: user_image = image_mail() user_image.send_image() #user_schedule = scheduling_remainders() # user_schedule.schedule(user_scheduling.job()) except : pass elif price[0] >= 1: user_money= Mailing(str(int(price[0]))) user_money.send_mail() print("Thanks for using our service")