Beispiel #1
0
  def get_obj_permissions(self, obj_perms=None, perm_to=None):
  	permissions = get_objects_perms(obj_perms)
  	
  	if permissions and perm_to is not None:
  		return permissions.get(perm_to)
 
  	return None
    def update_serializer_obj_perms(self, perms_to: str):

        if perms_to:
            permissions = get_objects_perms(perms_to)
            self.context['permissions'] = permissions
            return self.context

        return
Beispiel #3
0
class UserView(BaseApiView):
    serializer_class = UserSerializer
    is_user = True
    permissions = get_objects_perms('user_perms')
    fields_to_update = get_model_fields('user_model_fields')

    def get_queryset(self):
        return User.objects.exclude(first_name="Anonymous").filter(
            is_confirmed=True).filter(is_superuser=False)
class CreateDraftEditorContentsView(CreateMixin, BaseApiView):
	queryset = DraftEditorMediaContent.objects.all()
	serializer_class = DraftEditorContentsSerializer
	permissions = get_objects_perms('draft_editor_contents_perms')

	def post(self, request):
		editor_file = request.data.get('draft_editor_file')
		
		data = {
		  'draft_editor_file' : editor_file,
		}

		serializer = self.create(data)

		return serializer
Beispiel #5
0
class PostView(BaseApiView):
    queryset = Post.objects.all()
    serializer_class = PostSerializer
    permissions = get_objects_perms('post_perms')
    fields_to_update = get_model_fields('post_fields')
Beispiel #6
0
class AnswerReplyView(BaseApiView):
    queryset = AnswerReply.objects.all()
    serializer_class = AnswerReplySerializer
    permissions = get_objects_perms('answer_reply_perms')
    fields_to_update = get_model_fields('answer_reply_fields')
Beispiel #7
0
class AnswerCommentView(BaseApiView):
    queryset = AnswerComment.objects.all()
    serializer_class = AnswerCommentSerializer
    permissions = get_objects_perms('answer_comment_perms')

    fields_to_update = get_model_fields('answer_comment_fields')
Beispiel #8
0
class QuestionView(BaseApiView):
    queryset = Question.objects.all()
    serializer_class = QuestionSerializer
    permissions = get_objects_perms('question_perms')
    fields_to_update = get_model_fields('question_model_fields')