country fix
This commit is contained in:
@@ -2,7 +2,8 @@ from datetime import datetime, timezone, timedelta
|
||||
from app.extensions import db
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.sql import func
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class Country(db.Model):
|
||||
__tablename__ = 'country'
|
||||
@@ -24,25 +25,28 @@ class Country(db.Model):
|
||||
|
||||
@classmethod
|
||||
def get_all_countries(cls):
|
||||
country_list = cls.query.all()
|
||||
country_list = cls.query.order_by(cls.description.asc()).all()
|
||||
if not country_list:
|
||||
return None
|
||||
return country_list
|
||||
|
||||
@classmethod
|
||||
def set_country_status(cls, country_uid, code, val):
|
||||
|
||||
logger.info(f" Data for set_country_status Data {country_uid} ,{code} {val}")
|
||||
country_data = cls.query.filter_by(uid=str(country_uid), code=str(code)).first()
|
||||
if not country_data:
|
||||
return None
|
||||
country_data.status = val
|
||||
logger.info("UPDT::")
|
||||
country_data.status = int(val)
|
||||
return country_data
|
||||
|
||||
@classmethod
|
||||
def set_country_signup(cls, country_uid, code, val):
|
||||
logger.info(f" Data for set_country_signup Data {country_uid} ,{code} {val}")
|
||||
country_data = cls.query.filter_by(uid=str(country_uid), code=str(code)).first()
|
||||
if not country_data:
|
||||
return None
|
||||
logger.info("UPDT::")
|
||||
country_data.signup = val
|
||||
return country_data
|
||||
|
||||
|
||||
Reference in New Issue
Block a user