Skip to content

Commit

Permalink
new support for remove from collection
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Apr 1, 2016
1 parent b194c03 commit bcb8260
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/budy/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,17 +301,31 @@ def simple_csv_url(cls, absolute = False):
)

@appier.operation(
name = "Apply Collection",
name = "Add Collection",
parameters = (
("Collection", "collection", str),
)
)
def apply_collection_s(self, collection):
def add_collection_s(self, collection):
from . import collection as _collection
collection = _collection.Collection.get(name = collection)
if collection in self.collections: return
self.collections.append(collection)
self.save()

@appier.operation(
name = "Remove Collection",
parameters = (
("Collection", "collection", str),
)
)
def remove_collection_s(self, collection):
from . import collection as _collection
collection = _collection.Collection.get(name = collection)
if not collection in self.collections: return
self.collections.remove(collection)
self.save()

def get_price(
self,
currency = None,
Expand Down

0 comments on commit bcb8260

Please sign in to comment.