Add support for "toggle complete" for batch API

This commit is contained in:
Lance Edgar 2019-11-11 12:36:50 -06:00
parent bd09acd0fd
commit afdd294c60
3 changed files with 92 additions and 16 deletions

View file

@ -33,13 +33,16 @@ from rattail.time import localtime
from cornice import resource
from tailbone.api import APIMasterView
from tailbone.api.batch import BatchAPIMasterView
class LabelBatchViews(APIMasterView):
class LabelBatchViews(BatchAPIMasterView):
model_class = model.LabelBatch
default_handler_spec = 'rattail.batch.labels:LabelBatchHandler'
permission_prefix = 'labels.batch'
object_url_prefix = '/label-batch'
supports_toggle_complete = True
def pretty_datetime(self, dt):
if not dt:
@ -107,15 +110,17 @@ class LabelBatchViews(APIMasterView):
batch_resource = resource.add_resource(cls, collection_path='/label-batches', path='/label-batch/{uuid}')
config.add_cornice_resource(batch_resource)
cls._batch_defaults(config)
class LabelBatchRowViews(BatchAPIMasterView):
model_class = model.LabelBatchRow
default_handler_spec = 'rattail.batch.labels:LabelBatchHandler'
supports_quick_entry = True
route_prefix = 'api.label_batch_rows'
permission_prefix = 'labels.batch'
url_prefix = '/label-batch-rows'
collection_url_prefix = '/label-batch-rows'
supports_quick_entry = True
def normalize(self, row):
batch = row.batch