1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
from ..base import ShopifyResource
from .metafield import Metafield
from .event import Event
class Shop(ShopifyResource):
@classmethod
def current(cls):
return cls.find_one(cls.site + "/shop." + cls.format.extension)
def metafields(self):
return Metafield.find()
def add_metafield(self, metafield):
if self.is_new():
raise ValueError("You can only add metafields to a resource that has been saved")
metafield.save()
return metafield
def events(self):
return Event.find()
|