Beispiel #1
0
    def get_context_data(self, **kwargs):
        preprint = PreprintService.load(self.kwargs.get('guid'))
        # TODO - we shouldn't need this serialized_preprint value -- https://openscience.atlassian.net/browse/OSF-7743
        kwargs['serialized_preprint'] = serialize_preprint(preprint)
        kwargs['change_provider_form'] = ChangeProviderForm(instance=preprint)
        kwargs.update({'SPAM_STATUS': SpamStatus})  # Pass spam status in to check against

        return super(PreprintView, self).get_context_data(**kwargs)
 def delete(self, request, *args, **kwargs):
     if not request.user.has_perm('auth.mark_spam'):
         raise PermissionDenied(
             'You do not have permission to update a preprint flagged as spam.'
         )
     preprint_ids = [
         pid for pid in request.POST.keys() if pid != 'csrfmiddlewaretoken'
     ]
     for pid in preprint_ids:
         preprint = PreprintService.load(pid)
         osf_admin_change_status_identifier(preprint)
         preprint.confirm_spam(save=True)
         update_admin_log(user_id=self.request.user.id,
                          object_id=pid,
                          object_repr='PreprintService',
                          message='Confirmed SPAM: {}'.format(pid),
                          action_flag=CONFIRM_SPAM)
     return redirect('preprints:flagged-spam')
Beispiel #3
0
 def delete(self, request, *args, **kwargs):
     if not request.user.has_perm('auth.mark_spam'):
         raise PermissionDenied('You do not have permission to update a preprint flagged as spam.')
     preprint_ids = [
         pid for pid in request.POST.keys()
         if pid != 'csrfmiddlewaretoken'
     ]
     for pid in preprint_ids:
         preprint = PreprintService.load(pid)
         osf_admin_change_status_identifier(preprint)
         preprint.confirm_spam(save=True)
         update_admin_log(
             user_id=self.request.user.id,
             object_id=pid,
             object_repr='PreprintService',
             message='Confirmed SPAM: {}'.format(pid),
             action_flag=CONFIRM_SPAM
         )
     return redirect('preprints:flagged-spam')
Beispiel #4
0
 def get_object(self, queryset=None):
     return PreprintService.load(self.kwargs.get('guid'))