July 2018
Intermediate to advanced
324 pages
8h 14m
English
For implementing the subscription functionality, we require to validate the mobile number. Hence we are going to implement the OTP verification functionality before subscribing any mobile number. We require to have a database table to persist the data for OTP generated codes along with mobile number. The following is the code snippet of models.py class with along with OTPModel class:
import osimport datetimefrom shutil import copyfilefrom peewee import *# Copy our working DB to /tmp..db_name = 'quote_database.db'src = os.path.abspath(db_name)dst = "/tmp/{}".format(db_name)copyfile(src, dst)db = SqliteDatabase(dst)class QuoteModel(Model): class Meta: database = db id = IntegerField(primary_key= ...