Skip to content

Instantly share code, notes, and snippets.

@ismith
Created September 2, 2019 22:43
Show Gist options
  • Save ismith/34a931633024bedbbbb31cadac635bbb to your computer and use it in GitHub Desktop.
Save ismith/34a931633024bedbbbb31cadac635bbb to your computer and use it in GitHub Desktop.
from django import template
from django.template.defaultfilters import stringfilter
from django.db.models import Q, Exists, OuterRef
from django.utils.safestring import mark_safe
from ..models import Submission, Review
import re
replacements = [
("University of Michigan", "school"),
("She Codes Now", "tech affinity organization"),
("She's Coding", "tech affinity organization"),
("he", "they"),
("she", "they"),
("her", "their"),
("his", "their"),
("UW-Milwaukee", "university"),
("Hawthorn School for Girls", "school"),
("http://ntmbayfield.github.io", "url"),
("East African", "[]"),
("Burning Man", "Burning Man"),
("girls who code", "tech affinity organization"),
("Girl Scout", "group"),
("Rails Girls", "tech affinity organization"),
("railsgirls", "tech affinity organization"),
("Girl Geek Dinners", "event"),
("Girl Geek Dinner", "event"),
("women of color", "type of people"),
("Women Who Code", "tech affinity organization"),
("Black Girls Code", "tech affinity organization"),
("Girl Develop It", "tech affinity organization"),
("WomenTechMakers Lead", "tech affinity organization"),
("Boston", "city"),
("Grow With Google", "[]"),
("Google", "company"),
("women", "type of people"),
("LGBTQIA", "type of people"),
("gender-nonconforming", "type of people"),
("Transgender", "type of person"),
("Gender-queer trans-female identified", "type of person"),
("PyLadies", "tech affinity organization"),
("Chicago", "city"),
("Python Software Foundation", "non-profit"),
("Sprout Social", "company"),
("Latin American Latino Studies", "humanities field"),
("Django Girls", "tech affinity group"),
("Charla", "talk"),
("PyCon", "conference"),
("Portland State University", "school"),
("Portland Community College", "school"),
("Portland, OR", "city"),
("Portland", "city"),
("Coinbase", "company"),
("woman of color", "type of person"),
("females", "type of people"),
("African-American", "type of person"),
("African American", "type of person"),
("men", "type of people"),
("Coder Dojo", "tech organization"),
("NCWIT", "acronym"),
("Thorn", "non-profit"),
("VMWare", "comany"),
("girls", "type of people"),
("Simon Fraser University", "school"),
("Ada Developers Academy", "bootcamp"),
("people of non-binary gender", "type of people"),
("SODO (\"Ship On Day One\")", "company"),
("Seattle", "city"),
("Facebook", "company"),
("woman", "type of person"),
("person of color", "type of person"),
("Talkdesk", "company"),
("Porto", "city"),
("Asian", "type of person"),
("Dev Bootcamp", "bootcamp"),
("Gamut", "company"),
("Grainger", "company"),
("Anca", "name"),
("Romanian", "type of person"),
("Ada Developer's Academy", "bootcamp"),
("gender minorities", "type of people"),
("Tessitura Network", "company"),
("Ada", "bootcamp"),
("Mongolia", "country"),
("Northwestern University", "school"),
("Northwestern Universities", "school"),
("Black Code Collective", "tech affinity group"),
("engineers of color", "[type of person] engineers"),
("developers of color", "[type of person] developers"),
("University of Virginia", "school"),
("Crowdskout", "company"),
("black", "type of person"),
("female", "type of person"),
("DC Fem Tech", "[City] [tech affinity group]"),
("St Louis", "city"),
("Redline Performance Solution", "company"),
("Kevala Analytics", "company"),
("Kevala", "company"),
("San Francisco", "city"),
("SF", "[]"),
("http://www.cleanenergyprogress.com", "url"),
("pregnancy", "[]"),
("University of Missouri - St. Louis", "school"),
("St. Louis Community College", "school"),
("Kansas City", "city"),
("girl", "type of person"),
("Coding & Cupcakes", "[]"),
("https://github.com/KansasCityWomeninTechnology/jewelbots", "url"),
("PythonKC", "[]"),
("https://hackaday.io/project/20459-talker", "url"),
("https://github.com/amendment19/PeopleCounter", "url"),
("gender diverse", "type of person"),
("bay area", "city"),
("3scan", "company"),
("Springfield", "city"),
("midwest", "region"),
("Ozarks Technical Community College", "school"),
("African", "type of person"),
("Cincinnati", "city"),
("Develop It Cincinnati", "[tech affinity group][city]"),
("Launchcode- coderGirl", "bootcamp"),
("Launchcode-coderGirl", "bootcamp"),
("SIUE", "school"),
("Edward Jones", "school"),
("St. Louis", "school"),
("Neo4j", "company/tool"),
("PDXWITH", "[city][tech affinity group]"),
("Ruby Receptionists", "company"),
("LGBTQ individuals", "type of person"),
("non-binary humans", "type of person"),
("Techtonica", "bootcamp"),
("Tech Ladies", "tech affinity organization"),
("China", "country"),
("Texas", "state"),
("Alpha Sigma PI Fraternity", "group"),
("Deaf/Hard of Hearing", "type of person"),
("Deafverse", "project"),
("Deaf", "type of person"),
("man", "type of person"),
("https://openawg.github.io", "url"),
("http://biocraft.herokuapp.com/", "url"),
("sign language interpreters", "service"),
("codergirl", "bootcamp"),
("launchcode", "organization"),
("Mountainview, California", "city"),
("New York", "city"),
("Technoloxia", "conference"),
("Bhubaneswar", "city"),
("India", "country"),
("Chingu", "[]"),
("non binary individuals", "type of person"),
("husband", "spouse"),
("wife", "spouse"),
("WWCode", "tech affinity group"),
("https://github.com/slohmes/tiny-node-browser", "url"),
("people of color", "type of people"),
("Latino", "type of people"),
("http://fortune.com/2017/03/22/tech-employees-overestimate-how-well-their-companies-promote-diversity", "url"),
("Open Sesame Inc", "company"),
("Invenio Solutions", "company"),
("Austin, TX", "city"),
("RollCall.org", "company"),
("Arizona", "state"),
("Eller School of Management", "school"),
("University of Alabama in Huntsville", "school"),
("IIIT-Delhi", "school"),
("IIT-Delhi", "school"),
("NIT Srinagar", "school"),
("Srinagar", "City"),
("Goldman Sachs", "company"),
("ChickTech", "tech affinity group"),
("Vanderbilt University", "school"),
("Vanderbilt", "school"),
("Nashville", "city"),
("PyTennessee", "conference"),
("Zillow", "company"),
("Feminist Book Club", "[]"),
("NewTechNW", "tech organization"),
("Rochester, NY", "city"),
("Rochester Institute of Technology", "school"),
("STL Cyber", "[city] [organization]"),
("https://github.com/AndreaCrotti/yasnippet-snippets", "url"),
("https://www.youtube.com/watch?v=pXduirOmnJg", "url"),
("https://www.youtube.com/watch?v=EGPkxmJdS7M", "url"),
("https://www.youtube.com/watch?v=OC2KVaLQihs", "url"),
("http://shop.oreilly.com/product/0636920027072.do", "url"),
("https://dev.to/gabivoicu/refactoring-an-overgrown-notifications-class-in-django-4m4h", "url"),
("DawnSignPress", "company"),
("San Diego", "city"),
("PDX", "city"),
("Write/Speak/Code", "tech affinity group"),
("CDK Global", "company"),
("MIT Media Lab", "school"),
("MIT", "school"),
("North Carolina State University", "school"),
("North Carolina", "state"),
("daughter", "child"),
("son", "child"),
("Saint Louis University", "school"),
("Saint Louis", "city"),
("ladies", "type of people"),
("Hungary", "country"),
("Howard University", "school"),
("Washington, DC", "city"),
("Baltimore City", "city"),
("Baltimore", "city"),
("Lesbians Who Tech", "tech affinity organization"),
("across the LGBTQ spectrum", "group"),
("Trinidad and Tobago", "country"),
("Microsoft", "company"),
("W. Montague Cobb Research Laboratory", "company"),
("The Cobb Barcoder", "[]"),
("www.cobbresearchlab.com", "url"),
("Yammer", "company"),
("Tubs Kitchen", "company"),
("Authentic Jamaican food in DC", "company"),
("Swypeshark", "company"),
("Seamless Money", "company"),
("BHealth", "company"),
("Upsilon Pi Epsilon", "group"),
("Caribbean", "country"),
("Georgetown University", "school"),
("Salesforce", "company"),
("(www.cobbresearchlab.com)", "url"),
("Dev/Color", "conference"),
("Havard", "school"),
("South County Tech", "region"),
("Harvard", "school"),
("Missouri", "state"),
("Silver Spring", "city"),
("DCFemTech", "tech affinity organization"),
("maternity", "parenthood"),
("ReasonML", "project"),
("STL", "[]"),
("QAcademy", "[]"),
("LaunchCoders", "[]"),
("Unigroup", "company"),
("Slalom Consulting", "company"),
("Purina Better With Pets", "company"),
("Boise", "city"),
("Idaho", "state"),
("El Salvador", "country"),
("ReBootU", "bootcamp"),
("University of Phoenix", "school"),
("jSTL", "[]"),
("Paradowski Creative", "company"),
("Monsanto", "company"),
("STLCC", "school"),
("Laumier", "company"),
("Washington University", "school"),
("LGBT", "group"),
("queer", "type of person"),
("intersex", "type of person"),
("Pittsburgh", "city"),
("Community College of Allegheny County", "school"),
("Lauchcode", "company"),
("Rocky Mountain College of Art and Design", "school"),
("The Zany Zanimal Zoo", "[]"),
("STL", "city"),
("Tock", "[]"),
("CWRU", "school"),
("Charter Communications (aka Spectrum)", "company"),
("Charter Communications", "company"),
("mom", "parent"),
("dad", "parent"),
("Virginia", "state"),
("Moms Can: Code", "tech affinity organization"),
("Fresno", "city"),
("Root Access", "[]"),
("Chris Sorenson's Gallery", "[]"),
("Central Valley Dev Fest", "conference"),
("University of Rochester", "school"),
("RocHack", "[]"),
("DandyHacks", "[]"),
("LeadersUp", "company"),
("Hackbright Academy", "bootcamp"),
("Hackbright", "bootcamp"),
("Austin", "city"),
("EverlyWell", "company"),
("Swaziland", "city"),
("Elizabeth Glazer Pediatric AIDS Foundation", "company"),
("Burkina Faso", "country"),
("Burkina", "country"),
("Congo DRC", "country"),
("mother", "parent"),
("father", "parent"),
("Detroit, MI", "city"),
("Launch Code LC101", "bootcamp"),
("UMSL", "school"),
("LC101", "[]"),
("St.Louis", "city"),
("NYC", "city"),
("iOSoho", "[]"),
("Crib Check", "[]"),
("https://www.linkedin.com/in/lljiang/", "url"),
("https://twitter.com/imnotlostrui", "url"),
("https://www.instagram.com/imnotlostru/", "url"),
("https://medium.com/@lisajiang", "url"),
("the Illinois Institute of Technology", "school"),
("The Difference Engine", "company"),
("https://github.com/anna-liao", "url"),
("http://www.cybera.ca/", "url"),
("Canadian National Research and Education Network", "[]"),
("Albertans", "[]"),
("https://github.com/anna-liao/writeLED-rs", "url"),
("Towson University", "school"),
("https://blog.smartlogic.io/2018-bwit-micro-grant-recipients/", "url"),
("Houston", "city"),
("mdlogix", "city"),
("Maryland", "state"),
("Code in the Schools", "organization"),
("folks of color", "type of people"),
("Bangkok", "city"),
("Thailand", "country"),
("Thai", "country"),
("Community College of Baltimore County (CCBC)", "school"),
("west baltimore", "city"),
("Flatiron School", "bootcamp"),
("Position Development", "company"),
("MergeSort", "[]"),
("feminist", "[]"),
("University of Illinois from Urbana Champaign", "school"),
("University of Illinois", "school"),
("Udacity", "company"),
("Grow With Google", "[]"),
("Big Nerd Ranch", "company"),
("Atlanta, GA", "city"),
("Atlanta", "city"),
("We Rise", "[]"),
("HubTran", "company"),
("Claflin University", "school"),
("NSBE", "[]"),
("University of Georgia", "school"),
("Georgia Tech", "school"),
("ExRx.net", "company"),
("EMG", "company"),
("Rackspace", "company"),
("Robinhood", "company"),
("Code2040", "[]"),
("DevColor", "[]"),
("Ohio", "state"),
("Stanford", "school"),
("Coinstocks.io", "company"),
("GitHub", "[]"),
("Developer Pack", "[]"),
("LadyHacks", "[]"),
("Hackathon 2.0", "[]"),
("Samsung SDS", "company"),
("8th Light", "company"),
("Express Scripts", "company"),
("https://www.carleton.edu/admissions", "url"),
("Abbott Labs", "company"),
("LGBTQ+", "[]"),
("Newport Beach, CA", "city"),
("TechGirlz", "tech affinity organization"),
("TechGirls", "tech affinity organization"),
("TechBlazers", "tech affinity organization"),
("Grinnell College", "school"),
("Acenture's Liquid Studio", "company"),
("Taylor University", "school"),
("Indiana", "state"),
("https://dl.acm.org/citation.cfm?id=3007239", "url"),
("Lagos, Nigeria", "country"),
("Atlanta, Ga", "city"),
("ATLien", "[]"),
("Delta Airlines", "company"),
("http://www.theworksofkb.com/", "url"),
("DiegoRBaquero", "[]"),
("mutode", "[]"),
("DC Femtech", "[tech affinity organization]"),
("Mapbox", "company"),
("Ocelot Consulting", "company"),
("Ocelot", "company"),
("Nordstrom", "company"),
("ChicagoRuby", "[]"),
("California School for the Deaf", "school"),
("Fremont", "city"),
("CSDF", "school"),
("Slack Technologies", "company"),
("CUNY Queens College", "school"),
("Queens College", "school"),
("Long Island", "city"),
("Stefana Muller", "[]"),
("SheHacks", "tech affinity group"),
("EF Academy", "school"),
("Thornwood, NY", "city"),
("Flushing, NY", "city"),
("Citibank", "company"),
("Twin Cities", "city"),
("Stack Overflow", "company"),
("UXPA", "[]"),
("trans*", "type of people"),
("Kidblog Inc", "company"),
("Kidblog", "company"),
("ClojureBridgeMN", "tech affinity group"),
("Bertelsmann", "[]"),
("Rebecca CoderDojo", "[]"),
("UCI", "school"),
("University of California, Irvine", "school"),
("Rwanda", "country"),
("POC", "[]"),
("Latina", "[]"),
("California", "state"),
("UC Berkeley", "school"),
("Hack Reactor", "bootcamp"),
("Madison, WI", "city"),
("Wisconsin", "state"),
("Functional Art and Sculptural Objects in Interior Design", "[]"),
("Galvanize", "bootcamp"),
("Code Tenderloin", "tech affinity group"),
("http://www.magneticpoetry2_0.surge.sh", "url"),
("http://www.evilgeniuscooperative.surge.sh", "url"),
("http://www.egnameapp.surge.sh", "url"),
("biracial", "type of person"),
("trans/non-binary", "[]"),
("Epicodus", "bootcamp"),
("Oregon", "state"),
("PDXWIT", "tech affinity group"),
("trans & nonbinary", "[]"),
("Flatiron", "bootcamp"),
("WWT", "[]"),
("NPower", "[]"),
("Hawthorn", "school"),
("PeopleVine", "company"),
("https://www.linkedin.com/in/jerliyahcraig/", "url"),
("Enigma (enigma.com)", "company"),
("Georgia Institute of Technology", "school"),
("Iowa State University", "school"),
("Iowa State", "school"),
("KCWiT", "tech affinity group"),
("Coding and Cupcakes", "[]"),
("Coding and Cocktails", "[]"),
("Red Nova Labs", "company"),
("Elias Garcia", "[]"),
("Tennessee", "state"),
("UMKC", "school"),
("Truman State University", "school"),
("Truman", "school"),
("Cerner Corporation", "company"),
("Cerner", "company"),
("Digital Intent", "company"),
("World Wide Technology", "company"),
("Uber", "company"),
("Fleets Data & Intelligence", "[]"),
("PyOhio", "Py[state]"),
("Dalhousie University", "school"),
("Arcturus Studios", "company"),
("Halifax", "city"),
("Equal Rights Advocates", "company"),
("Direct Supply", "company"),
("Romania", "country"),
("mindquieter.com", "url"),
("Ekon Benefits", "company"),
("simplicity.ashevillenc.gov", "url"),
("cityofashevillenc.github.io/wheres-parking", "url"),
("fruiz7", "[]"),
("GA Tech", "school"),
("https://www.linkedin.com/in/mauricerabb/", "url"),
("Puget Sound", "city"),
("Tableau Software", "company"),
("NBCUniversal", "company"),
("Buzzfeed", "company"),
("https://community.lawyer/cl-about", "url"),
("community.lawyer", "company"),
("Slate.com", "company"),
("Democracy Works", "company"),
("TurboVote", "[]"),
("Ballot Scout", "[]"),
("Watt runner", "[]"),
("PyGotham", "Py[city]"),
("BrooklynJS", "[city]JS"),
("Filipino-Mexican-American", "type of person"),
("UC Irvine", "school"),
("Pluto VR", "company"),
("https://pikachubff.itch.io/wombutts", "url"),
("WWC", "[]"),
("GirlDevelopIt", "tech affinity organization"),
("GDI", "tech affinity organization"),
("first generation Latinx", "type of person"),
("womxn of color", "type of people"),
("womxn", "type of person"),
("Latinx", "type of person"),
("Milwaukee", "city"),
("daughters", "children"),
("Redfin", "company"),
("Health Carousel", "company"),
("Dynamics CRM", "[]"),
("General Assembly", "[]"),
("Breaking Ground", "company"),
("SUNY Empire State College", "school"),
("Comas", "city"),
("https://github.com/CestDiego/nand2tetris.el", "url"),
("https://github.com/CestDiego/sweetgreen.el", "url"),
("https://www.youtube.com/watch?v=puHMpEgojkA&t=2s", "url"),
("San Jose", "city"),
("Peru", "country"),
("Walden University", "school"),
("Florida State University", "school"),
("Baruch College", "school"),
("Spain", "country"),
("CUNY", "school"),
("Blink Health", "company"),
("WiTNY", "[]"),
("Manhattan", "[]"),
("Mizzou", "school"),
("hispanic", "type of person"),
("non-binary gendered", "type of people"),
("TIQC", "[]"),
("MLH", "[]"),
("XX Coders", "tech affinity group"),
("Paris", "city"),
("French", "country"),
("France", "country"),
("École Normale Supérieure", "school"),
("agender", "type of person"),
("Selina Musuta", "name"),
("South African", "country person"),
("Kenyan", "country person"),
("Philadelphia", "city"),
("Albuquerque", "city"),
("Minneapolis", "city"),
("PODC", "conference"),
("Cambridge", "city"),
("RIT", "school"),
("PagerDuty", "company"),
("Middle Georgia State University", "school"),
("PeopleVine", "company"),
("WillowTree Apps", "company")
]
replacements.sort(key=lambda tup: len(tup[0]), reverse=True)
repl_regexes = [(re.compile("\\b{}\\b".format(fromstr), re.IGNORECASE), to) for
(fromstr, to) in replacements]
register = template.Library()
@register.filter
@stringfilter
def scrub(str):
for (regex, to) in repl_regexes:
str = re.sub(regex, "<span style='color:blue'>[{}]</span>".format(to), str)
return mark_safe(str)
@register.simple_tag
def count_submissions_to_review(user):
"""
Templatetag to return the remaining submissions a user needs to review
"""
return Submission.upcoming_objects.get_queryset(user).filter(
Q(conference__status='pre-review') | Q(conference__status='reviewing')
).annotate(has_review=Exists(
Review.objects.filter(
submission=OuterRef('pk'),
user=user,
)
),
).filter(has_review=False).count()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment