21 lines
622 B
Python
21 lines
622 B
Python
|
|
from peewee import AutoField, BooleanField, TextField
|
||
|
|
from playhouse.sqlite_ext import JSONField
|
||
|
|
|
||
|
|
from .base_model import BaseModel
|
||
|
|
|
||
|
|
|
||
|
|
class Recipes(BaseModel):
|
||
|
|
id = AutoField(primary_key=True, unique=True, null=False)
|
||
|
|
name = TextField(null=False)
|
||
|
|
spec = JSONField(null=False) # keys inside spec must not overlap withthe model
|
||
|
|
archived = BooleanField(null=False, default=False)
|
||
|
|
|
||
|
|
@classmethod
|
||
|
|
def delete(cls, *args, **kwargs):
|
||
|
|
# OVERRIDE DELETION
|
||
|
|
# so that deleting a user will only archive it
|
||
|
|
return cls.update(archived=True)
|
||
|
|
|
||
|
|
class Meta:
|
||
|
|
table_name = "recipes"
|