Add notes to label batch API (get), basic create support
This commit is contained in:
parent
4afbb350ce
commit
8dcec94aec
|
@ -62,6 +62,8 @@ class LabelBatchViews(APIMasterView):
|
|||
'id': batch.id,
|
||||
'id_str': batch.id_str,
|
||||
'description': batch.description,
|
||||
'notes': batch.notes,
|
||||
'rowcount': batch.rowcount,
|
||||
'created': created,
|
||||
'created_by_uuid': batch.created_by.uuid,
|
||||
'created_by_display': six.text_type(batch.created_by),
|
||||
|
@ -74,14 +76,23 @@ class LabelBatchViews(APIMasterView):
|
|||
def collection_get(self):
|
||||
return self._collection_get()
|
||||
|
||||
# @view(permission='ordering.create')
|
||||
# def collection_post(self):
|
||||
# return self._collection_post()
|
||||
def collection_post(self):
|
||||
return self._collection_post()
|
||||
|
||||
def update_object(self, batch, data):
|
||||
|
||||
# assign some default values for new batch
|
||||
if not batch.uuid:
|
||||
batch.created_by_uuid = self.request.user.uuid
|
||||
if batch.rowcount is None:
|
||||
batch.rowcount = 0
|
||||
|
||||
return super(LabelBatchViews, self).update_object(batch, data)
|
||||
|
||||
def get(self):
|
||||
return self._get()
|
||||
|
||||
# @view(permission='ordering.edit')
|
||||
# @view(permission='labels.batch.edit')
|
||||
# def post(self):
|
||||
# return self._post()
|
||||
|
||||
|
@ -90,6 +101,7 @@ class LabelBatchViews(APIMasterView):
|
|||
|
||||
# label batches
|
||||
resource.add_view(cls.collection_get, permission='labels.batch.list')
|
||||
resource.add_view(cls.collection_post, permission='labels.batch.create')
|
||||
resource.add_view(cls.get, permission='labels.batch.view')
|
||||
batch_resource = resource.add_resource(cls, collection_path='/label-batches', path='/label-batch/{uuid}')
|
||||
config.add_cornice_resource(batch_resource)
|
||||
|
|
Loading…
Reference in a new issue