def post(self, user, data=None): if data is None: data = { 'name': 'A test image', 'description': 'Test image description', 'file': get_image() } url = reverse( 'api:grouping_media', kwargs={ 'project_id': self.project.id, 'grouping_id': self.grouping.id, 'contribution_id': self.contribution.id } ) request = self.factory.post(url, data) force_authenticate(request, user) view = GroupingContributionsMediaApiView.as_view() return view( request, project_id=self.project.id, grouping_id=self.grouping.id, contribution_id=self.contribution.id ).render()
def get(self, user): url = reverse('api:grouping_media', kwargs={ 'project_id': self.project.id, 'grouping_id': self.grouping.id, 'contribution_id': self.contribution.id }) request = self.factory.get(url) force_authenticate(request, user) view = GroupingContributionsMediaApiView.as_view() return view(request, project_id=self.project.id, grouping_id=self.grouping.id, contribution_id=self.contribution.id).render()
def get(self, user): url = reverse( 'api:grouping_media', kwargs={ 'project_id': self.project.id, 'grouping_id': self.grouping.id, 'contribution_id': self.contribution.id } ) request = self.factory.get(url) force_authenticate(request, user) view = GroupingContributionsMediaApiView.as_view() return view( request, project_id=self.project.id, grouping_id=self.grouping.id, contribution_id=self.contribution.id ).render()
def post(self, user, data=None): if data is None: data = { 'name': 'A test image', 'description': 'Test image description', 'file': get_image() } url = reverse('api:grouping_media', kwargs={ 'project_id': self.project.id, 'grouping_id': self.grouping.id, 'contribution_id': self.contribution.id }) request = self.factory.post(url, data) force_authenticate(request, user) view = GroupingContributionsMediaApiView.as_view() return view(request, project_id=self.project.id, grouping_id=self.grouping.id, contribution_id=self.contribution.id).render()