<commit_before>#from django import forms
#from django.http import HttpResponseRedirect

from mezzanine.pages.page_processors import processor_for
from .models import Organization, Residency

#class AuthorForm(forms.Form):
    #name = forms.CharField()
    #email = forms.EmailField()

@processor_for(Organization)
def organization_display(request, page):
    reslist = Residency.objects.all()
    return {"reslist": reslist}

@processor_for('list-of-organizations')
def organization_list(request,page):
    orglist = Organization.objects.all()
    return {"orglist": orglist}

@processor_for('list-of-residencies')
def residency_list(request,page):
    reslist = Residency.objects.all()
    return {"reslist": reslist}

#### this is from the docs.http://mezzanine.jupo.org/docs/content-architecture.html
#### basically exactly what I need :-/

#from django import forms
#from django.http import HttpResponseRedirect
#from mezzanine.pages.page_processors import processor_for
#from .models import Author

#class AuthorForm(forms.Form):
    #name = forms.CharField()
    #email = forms.EmailField()
#
#@processor_for(Author)
#def author_form(request, page):
    #form = AuthorForm()
    #if request.method == "POST":
        #form = AuthorForm(request.POST)
        #if form.is_valid():
            ## Form processing goes here.
            #redirect = request.path + "?submitted=true"
            #return HttpResponseRedirect(redirect)
    ##return {"form": form}<commit_msg>Filter residency opportunities shown on the organization page Fixes #20<commit_after>#from django import forms
#from django.http import HttpResponseRedirect

import sys
from mezzanine.pages.page_processors import processor_for
from .models import Organization, Residency

#class AuthorForm(forms.Form):
    #name = forms.CharField()
    #email = forms.EmailField()

@processor_for(Organization)
def organization_display(request, page):
    reslist = Residency.objects.filter(organization=page.id)
    return {"reslist": reslist}

@processor_for('list-of-organizations')
def organization_list(request,page):
    orglist = Organization.objects.all()
    return {"orglist": orglist}

@processor_for('list-of-residencies')
def residency_list(request,page):
    reslist = Residency.objects.all()
    # this is where we could do the offer/requires formatting, but 
    # I am doing it in a template_tag. 
    #for res in reslist:
    #    pass    
    return {"reslist": reslist}

#### this is from the docs.http://mezzanine.jupo.org/docs/content-architecture.html
#### basically exactly what I need :-/

#from django import forms
#from django.http import HttpResponseRedirect
#from mezzanine.pages.page_processors import processor_for
#from .models import Author

#class AuthorForm(forms.Form):
    #name = forms.CharField()
    #email = forms.EmailField()
#
#@processor_for(Author)
#def author_form(request, page):
    #form = AuthorForm()
    #if request.method == "POST":
        #form = AuthorForm(request.POST)
        #if form.is_valid():
            ## Form processing goes here.
            #redirect = request.path + "?submitted=true"
            #return HttpResponseRedirect(redirect)
    ##return {"form": form}
{'fraction_non_alphanumeric': 0.11626449388906299, 'fraction_numerical': 0.0006267627702914447, 'mean_word_length': 4.224222585924713, 'pattern_counts': {'":': 10, '<': 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': '4898576', 'n_tokens_mistral': 952, 'n_tokens_neox': 921, 'n_words': 242}