You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
494 B
Python

2 years ago
from peewee import *
client_proxy = Proxy()
class BaseModel(Model):
class Meta:
database = client_proxy
@classmethod
def update_obj(cls, obj):
obj.save()
@classmethod
def delete_obj(cls, id):
cls.get(cls.id == id).delete_instance()
@classmethod
def get_all(cls):
try:
return cls.select()
except:
return 'Error'
@classmethod
def get_by_id(cls, id):
return cls.get(cls.id == id)