mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 11:27:36 -02:30
fix for POST scenario
This commit is contained in:
@@ -596,15 +596,6 @@ class OrganizationList(ListCreateAPIView):
|
|||||||
model = Organization
|
model = Organization
|
||||||
serializer_class = OrganizationSerializer
|
serializer_class = OrganizationSerializer
|
||||||
|
|
||||||
# @paginated
|
|
||||||
# def get(self, *args, **kwargs):
|
|
||||||
# # self.paginated_params = {'limit': limit, 'offset': offset, 'ordering': ordering}
|
|
||||||
# limit = kwargs.pop('limit')
|
|
||||||
# offset = kwargs.pop('offset')
|
|
||||||
# ordering = kwargs.pop('ordering')
|
|
||||||
# # qs[offset:offset + limit]
|
|
||||||
# return (super(OrganizationList, self).get(*args, **kwargs), 5, None)
|
|
||||||
|
|
||||||
def create(self, request, *args, **kwargs):
|
def create(self, request, *args, **kwargs):
|
||||||
"""Create a new organzation.
|
"""Create a new organzation.
|
||||||
|
|
||||||
@@ -673,11 +664,16 @@ class OrganizationList(ListCreateAPIView):
|
|||||||
.annotate(Count('organization')).order_by('organization')
|
.annotate(Count('organization')).order_by('organization')
|
||||||
|
|
||||||
count_context = {}
|
count_context = {}
|
||||||
|
zeroed_dict = {'inventories': 0, 'teams': 0, 'users': 0,
|
||||||
|
'job_templates': 0, 'admins': 0, 'projects': 0}
|
||||||
for org in org_id_list:
|
for org in org_id_list:
|
||||||
org_id = org['id']
|
org_id = org['id']
|
||||||
count_context[org_id] = {'inventories': 0, 'teams': 0, 'users': 0,
|
count_context[org_id] = zeroed_dict.copy()
|
||||||
'job_templates': 0, 'admins': 0,
|
if self.request.method == 'POST':
|
||||||
'projects': 0}
|
org_id = max([int(k) for k in count_context.keys()]) + 1
|
||||||
|
# org_id = instance = self.get_object().id
|
||||||
|
# self.request.data['id']
|
||||||
|
count_context[org_id] = zeroed_dict
|
||||||
|
|
||||||
for res in db_results:
|
for res in db_results:
|
||||||
for entry in db_results[res]:
|
for entry in db_results[res]:
|
||||||
|
|||||||
Reference in New Issue
Block a user