Add more 'auto-associate by posting new object' end points.

This commit is contained in:
Michael DeHaan 2013-03-26 18:26:40 -04:00
parent fa54f7ad66
commit 4aed4f6405
2 changed files with 8 additions and 0 deletions

View File

@ -207,4 +207,8 @@ class UsersTest(BaseTest):
data = self.get(url, expect=200, auth=self.get_normal_credentials())
self.assertEquals(data['count'], 0)
# FIXME: add test that shows posting a user w/o id to /organizations/2/users/ can create a new one & associate
# FIXME: add test that shows posting a user w/o id to /organizations/2/admins/ can create a new one & associate
# FIXME: add test that shows posting a projects w/o id to /organizations/2/projects/ can create a new one & associate

View File

@ -85,6 +85,7 @@ class OrganizationsUsersList(BaseSubList):
parent_model = Organization
relationship = 'users'
postable = True
inject_primary_key_on_post_as = 'organization'
def _get_queryset(self):
''' to list users in the organization, I must be a superuser or org admin '''
@ -101,6 +102,7 @@ class OrganizationsAdminsList(BaseSubList):
parent_model = Organization
relationship = 'admins'
postable = True
inject_primary_key_on_post_as = 'organization'
def _get_queryset(self):
''' to list admins in the organization, I must be a superuser or org admin '''
@ -117,6 +119,7 @@ class OrganizationsProjectsList(BaseSubList):
parent_model = Organization # for sub list
relationship = 'projects' # " "
postable = True
inject_primary_key_on_post_as = 'organization'
def _get_queryset(self):
''' to list projects in the organization, I must be a superuser or org admin '''
@ -133,6 +136,7 @@ class OrganizationsTagsList(BaseSubList):
parent_model = Organization # for sub list
relationship = 'tags' # " "
postable = True
inject_primary_key_on_post_as = 'organization'
def _get_queryset(self):
''' to list tags in the organization, I must be a superuser or org admin '''