<commit_before>from django.forms.models import model_to_dict
from django.shortcuts import get_object_or_404, render
from django.views.decorators.cache import cache_page

from shared.request import make_response

from .models import Proposal, Document, Event, Image

#@make_response()
#def

def proposal_json(proposal, include_images=True):
    pdict = model_to_dict(proposal, exclude=["location"])
    pdict["location"] = {"lat": proposal.location.y,
                         "lng": proposal.location.x}
    # TODO: If the document has been copied to the server, return
    # document.document.url instead of document.url as the URL.
    pdict["documents"] = [model_to_dict(d, exclude=["event", "document"]) \
                          for d in proposal.document_set.all()]
<commit_msg>Exclude FileFields when serving JSON view<commit_after>from django.forms.models import model_to_dict
from django.shortcuts import get_object_or_404, render
from django.views.decorators.cache import cache_page

from shared.request import make_response

from .models import Proposal, Document, Event, Image

#@make_response()
#def

def proposal_json(proposal, include_images=True):
    pdict = model_to_dict(proposal, exclude=["location", "fulltext"])
    pdict["location"] = {"lat": proposal.location.y,
                         "lng": proposal.location.x}
    # TODO: If the document has been copied to the server, return
    # document.document.url instead of document.url as the URL.
    pdict["documents"] = [model_to_dict(d, exclude=["event", "document",
                                                    "fulltext", "thumbnail"]) \
                          for d in proposal.document_set.all()]

{'fraction_non_alphanumeric': 0.10361160449970397, 'fraction_numerical': 0.003552397868561279, 'mean_word_length': 3.3669250645994833, 'pattern_counts': {'":': 4, '<': 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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4299284', 'n_tokens_mistral': 477, 'n_tokens_neox': 468, 'n_words': 134}