<commit_before>from rest_framework import permissions


class IsAdminOrReadOnly(permissions.BasePermission):
    """
    Custom permission to only allow admins edit it.
    """

    def has_object_permission(self, request, view, obj):
        # Read permissions are allowed to any request,
        # so we'll always allow GET, HEAD or OPTIONS requests.
        if request.method in permissions.IsAdminUser:
            return True

        # Write permissions are only allowed to admins.
        return obj.owner == request.user
<commit_msg>fixing news permissions<commit_after>from rest_framework import permissions


class IsAdminOrReadOnly(permissions.BasePermission):
    """
    Custom permission to only allow admins edit it.
    """

    def has_object_permission(self, request, view, obj):
        # Read permissions are allowed to any request,
        # so we'll always allow GET, HEAD or OPTIONS requests.
        if request.method in permissions.IsAdminUser:
            return True

        # Write permissions are only allowed to owners.
        return request.user.is_staff

{'fraction_non_alphanumeric': 0.0625, 'fraction_numerical': 0.0, 'mean_word_length': 2.96, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3470872', 'n_tokens_mistral': 275, 'n_tokens_neox': 264, 'n_words': 103}