<commit_before>from rest_framework.filters import OrderingFilter
from rest_framework.generics import ListAPIView
from rest_framework.generics import GenericAPIView
from iati.models import Activity
from api.export import serializers as export_serializers
from api.activity import filters
from api.activity.filters import SearchFilter
from api.generics.views import DynamicListView
from api.generics.utils import get_serializer_fields
from common.util import difference

from rest_framework.filters import DjangoFilterBackend

from api.transaction.serializers import TransactionSerializer
from api.transaction.filters import TransactionFilter
from api.renderers import XMLRenderer

from api.pagination import IatiXMLPagination

class IATIActivityList(ListAPIView):

    """IATI representation for activities"""
        
    queryset = Activity.objects.all()
    filter_backends = (SearchFilter, DjangoFilterBackend, filters.RelatedOrderingFilter,)
    filter_class = filters.ActivityFilter
    serializer_class = export_serializers.ActivityXMLSerializer
    pagination_class = IatiXMLPagination

    renderer_classes = (XMLRenderer, )

    fields = difference(
        get_serializer_fields(serializer_class),
        ['url', 'activity_aggregation', 'child_aggregation', 'activity_plus_child_aggregation']
    )

    ordering_fields = (
        'title',
        'planned_start_date',
        'actual_start_date',
        'planned_end_date',
        'actual_end_date',
        'start_date',
        'end_date',
        'activity_budget_value',
        'activity_incoming_funds_value',
        'activity_disbursement_value',<commit_msg>allow browsable API in /export/activities<commit_after>from rest_framework.filters import OrderingFilter
from rest_framework.generics import ListAPIView
from rest_framework.generics import GenericAPIView
from iati.models import Activity
from api.export import serializers as export_serializers
from api.activity import filters
from api.activity.filters import SearchFilter
from api.generics.views import DynamicListView
from api.generics.utils import get_serializer_fields
from common.util import difference

from rest_framework.filters import DjangoFilterBackend

from api.transaction.serializers import TransactionSerializer
from api.transaction.filters import TransactionFilter

from api.renderers import XMLRenderer
from rest_framework.renderers import BrowsableAPIRenderer

from api.pagination import IatiXMLPagination

class IATIActivityList(ListAPIView):

    """IATI representation for activities"""
        
    queryset = Activity.objects.all()
    filter_backends = (SearchFilter, DjangoFilterBackend, filters.RelatedOrderingFilter,)
    filter_class = filters.ActivityFilter
    serializer_class = export_serializers.ActivityXMLSerializer
    pagination_class = IatiXMLPagination

    renderer_classes = (BrowsableAPIRenderer, XMLRenderer )

    fields = difference(
        get_serializer_fields(serializer_class),
        ['url', 'activity_aggregation', 'child_aggregation', 'activity_plus_child_aggregation']
    )

    ordering_fields = (
        'title',
        'planned_start_date',
        'actual_start_date',
        'planned_end_date',
        'actual_end_date',
        'start_date',
        'end_date',
        'activity_budget_value',
        'activity_incoming_funds_value',
        'activity_disbursement_value',
{'fraction_non_alphanumeric': 0.06257413997627521, 'fraction_numerical': 0.0, 'mean_word_length': 4.716949152542373, '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': '7624909', 'n_tokens_mistral': 904, 'n_tokens_neox': 889, 'n_words': 208}