Coder Social home page Coder Social logo

freedomofpress / pressfreedomtracker.us Goto Github PK

View Code? Open in Web Editor NEW
11.0 13.0 5.0 21.75 MB

Code for the U.S. Press Freedom Tracker project website

Home Page: https://pressfreedomtracker.us

License: GNU Affero General Public License v3.0

JavaScript 11.78% Python 80.44% HTML 4.77% Makefile 0.34% Shell 0.21% Sass 2.45%

pressfreedomtracker.us's Introduction

Note

By contributing to this project, you agree to abide by our Code of Conduct.

U.S. Press Freedom Tracker

https://circleci.com/gh/freedomofpress/pressfreedomtracker.us.svg?style=svg

This is the code that powers the U.S. Press Freedom Tracker website. It is built with Wagtail and served at pressfreedomtracker.us.

Development

Prerequisites

The installation instructions below assume you have the following software on your machine:

Local Development instructions

When you want to play with the environment, you will be using docker-compose. Your guide to understand all the nuances of docker-compose can be found in the official docs. To start the environment, run the following your first run:

# One-time command to run and forget
make dev-init

# Starts up the environment
docker-compose up

# Inject development data (also only needs to be run once)
docker-compose exec django ./manage.py createdevdata

# NOTE: temporarily not available due to incompatibility with wagtail 2.7
# Add wagtail inventory to search wagtail pages by block type
docker-compose exec django ./manage.py block_inventory

You should be able to hit the web server interface by running make open-browser

If you run into any issues starting the application locally, check the troubleshooting doc for solutions to common problems.

Note: the createdevdata command fetches images from the internet by default. To disable this behavior, run the command with the --no-download argument, e.g.:

docker-compose exec django ./manage.py createdevdata --no-download

To reset your database back to its initial state, I recommend removing the postgresql docker container and re-running the dev data command. First, stop your containers by pressing control+c if they are running. Then run these two commands.

docker-compose rm -f postgresql && docker-compose up --build
docker-compose exec django ./manage.py createdevdata

To test your frontend code with jest, you can run the following command:

docker-compose exec node npm test

If tests need to be updated, you can run the following command:

docker-compose exec node npm test-update

Debugging

If you want to use the PDB program for debugging, it is possible. First, add this line to an area of the code you wish to debug:

import ipdb; ipdb.set_trace()

Second, attach to the running Django container. This must be done in a shell, and it is within this attached shell that you will be able to interact with the debugger. The command to attach is docker attach <ID_OF_DJANGO_CONTAINER>, and on UNIX-type systems, you can look up the ID and attach to the container with this single command:

docker attach $(docker-compose ps -q django)

Once you have done this, you can load the page that will run the code with your import ipdb and the debugger will activate in the shell you attached. To detach from the shell without stopping the container press Control+P followed by Control+Q.

Debug Toolbar

Another debugging aid is the django debug toolbar It is disabled by default for performance reasons. To enable it, add

ENABLE_DEBUG_TOOLBAR = True

To tracker/settings/local.py (you may need to create this file if it does not exist in your local working copy). After reloading the page, there should be a tab in the upper-right corner of the page to open the toolbar.

Profiling

There are a couple of options preconfigured in this repo for profiling the application. They are django-cprofile-middleware, silk middleware, and pyinstrument.

Profiling is not enabled by default, as it does add potential performance overhead if you don't actively need it. To enable silk (and cprofile), set DJANGO_PROFILE=yes when starting docker compose. To enable pyinstrument, set PYINSTRUMENT=yes:

PYINSTRUMENT=yes DJANGO_PROFILE=yes docker compose up

This will enable both middlewares. To view the cProfile information for any url, append ?prof to the url (or add it to an existing query string with &prof). This can give you fairly detailed information about which lines of code are causing your view to be slow. Additional information about the information provided is available in the Python documentation.

Pyinstrument functions similarly to cProfile, but it has a much nicer interface. Append ?profile (or &profile) to any URL to load it.

If the specific lines of python code are not enough to determine what's causing the slowdown, it might be the database. To view more detailed profiling data about database queries, I recommend silk. The silk middleware logs all queries generated on a per-request basis. To see this, make a request to the view you want to profile, wait for it to complete, then load the silk admin at http://localhost:8000/silk.

Dependency Management

Adding new requirements

New requirements should be added to *requirements.in files, for use with pip-compile. There are two Python requirements files:

  • requirements.in production application dependencies
  • dev-requirements.in local testing and CI requirements

Add the desired dependency to the appropriate .in file, then run:

make compile-pip-dependencies

All requirements files will be regenerated based on compatible versions. Multiple .in files can be merged into a single .txt file, for use with pip. The Makefile target handles the merging of multiple files.

This process is the same if a requirement needs to be changed (i.e. its version number restricted) or removed. Make the appropriate change in the correct requirements.in file, then run the above command to compile the dependencies.

Upgrading existing requirements

There are separate commands to upgrade a package without changing the requirements.in files. The command

make pip-update PACKAGE=package-name

will update the package named package-name to the latest version allowed by the constraints in requirements.in and compile a new dev-requirements.txt and requirements.txt based on that version.

If the package appears only in dev-requirements.in, then you must use this command:

make pip-dev-update PACKAGE=package-name

which will update the package named package-name to the latest version allowed by the constraints in requirements.in and compile a new dev-requirements.txt.

Advanced actions against the database

Database import

Drop a postgres database dump into the root of the repo and rename it to import.db. To import it into a running dev session (ensure make dev-go has already been started) run make dev-import-db. Note that this will not pull in images that are referenced from an external site backup.

Connect to postgresql service from host

The postgresql service is exposed to your host on port 15432. If you have a GUI database manipulation application you'd like to utilize, your settings will be:

  • username - tracker
  • password - trackerpassword
  • dbname - trackerdb
  • the host/port can be determined by running docker-compose port postgresql 5432
Mimic CI and production environment

You can mimic a production environment where django is deployment with gunicorn, reverse nginx proxy, and debug mode off using the following command:

docker-compose -f prod-docker-compose.yaml up

All subsequent docker-compose files will need that explicit -f flag pointing to the production-like compose file.

Database snapshots

When developing, it is often required to switch branches. These different branches can have mutually incompatible changes to the database, which can render the application inoperable. It is therefore helpful to be able to easily restore the database to a known-good state when making experimental changes. There are two commands provided to assist in this.

make dev-save-db: Saves a snapshot of the current state of the database to a file in the db-snapshots folder. This file is named for the currently checked-out git branch.

make dev-restore-db: Restores the most recent snapshot for the currently checked-out git branch. If none can be found, that is, make dev-save-db has never been run for the current branch, this command will do nothing. If a saved database is found, all data in database will be replaced with that from the file. Note that this command will terminate all connections to the database and delete all data there, so care is encouraged.

Workflow suggestions. I find it helpful to have one snapshot for each active branch I'm working on or reviewing, as well as for develop. Checking out a new branch and running its migrations should be followed by running make dev-save-db to give you a baseline to return to when needed.

When checking out a new branch after working on another, it can be helpful to restore your snapshot from develop, so that the migrations for the new branch, which were presumably based off of develop, will have a clean starting point.

Deployment

Important Note: We want to make PFT customizable for organizations who wish to deploy it as a tool for regions outside the US, but this work is still in progress. Please see #647 for the current status and how you can help.

Building

The development docker-compose setup includes separate application and Node.js containers for hot-reloading purposes. To build a container for production use, run:

docker build --build-arg USERID=1000 -t TAG -f devops/docker/ProdDjangoDockerfile .

Running

This setup can also be tested locally with docker-compose by using:

docker-compose -f prod-docker-compose.yaml up

This setup will configure the app with production-like settings. In particular, whitenoise is used to serve static files.

Setup

When deploying the container to your actual production environment, refer to the environment variables in prod-docker-compose.yaml, changing things appropriately:

  • DJANGO_DB_* for your database
  • Based on your deployment domain/hostname:
    • DJANGO_BASE_URL
    • DJANGO_ALLOWED_HOSTS
    • DJANGO_CSRF_TRUSTED_ORIGINS
    • if applicable, DJANGO_ONION_HOSTNAME
  • If you are using a read-only filesystem, give these a path to a read-write tmpfs:
    • DJANGO_GCORN_HEARTBT_DIR
    • DJANGO_GCORN_UPLOAD_DIR
    • TMPDIR
  • Replace these dummied out secrets:
    • DJANGO_SECRET_KEY (generate a random one)
    • RECAPTCHA_*
  • Using an object storage service for media files is recommended; for Google Storage:
    • GS_BUCKET_NAME
    • GS_CREDENTIALS (path to a JSON file)
    • GS_CUSTOM_ENDPOINT (if you have a CNAME pointing to your bucket)

This list is incomplete; please open an issues if you run into something missing.

Adobe Font Licenses

Licenses for Source Serif Pro and Source Sans Pro are available at the paths below.

  • common/static/fonts/LICENSE.SourceSansPro.txt
  • common/static/fonts/LICENSE.SourceSerifPro.txt

Design decision notes

Search

The search bar on the site is a shortcut to using incident search. This is because the site is primarily incident-related, and using incident search provides more powerful filtering as well as enhanced previews. As a result, there is no generic wagtail search view which includes other content such as blog posts. See #592.

pressfreedomtracker.us's People

Contributors

caesarsol avatar chigby avatar conorsch avatar dkaoster avatar eloquence avatar emilyhorsman avatar emkll avatar harrislapiroff avatar kevinhowbrook avatar maeve-fpf avatar melinath avatar msheiny avatar nmorduch avatar prateekj117 avatar raq929 avatar saptaks avatar shanejdonnelly avatar ssempervirens avatar urlsangel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pressfreedomtracker.us's Issues

Fix webpack sass compilation

Currently running npm run start gives me this :(

ERROR in ./common/static/css/common.sass
Module parse failed: /Users/harris/Projects/Clients/PressFreedom/pressfreedom/common/static/css/common.sass Unexpected token (2:10)
You may need an appropriate loader to handle this file type.
| body
| 	font-size: 20px
| 
 @ ./common/static/js/common.js 1:0-27

[Statistics] Create statistics app

This app's purpose will be to define functions that query the case database and return simple statistical data. It will also provide the glue that allows these functions to be used in site content by an editor using the Wagtail admin.

This will be a fairly minimal app. I imagine it will include:

  • registry.py provide a function decorator @statistic that registers a function as a statistic that can be used throughout the site
  • A number of files of simple functions that generate statistics. We'll probably want to standardize a few simple formats for what these functions can return. I imagine at least these two:
    1. a number (useful everywhere)
    2. a dict of <time period>: <number> pairs (useful for histograms)
  • A template filter that will process a string and replace any tokens like {{ 2017ARRESTS }} with the corresponding up-to-date data
  • Maybe a wagtail hook that plugs into the admin and lets the editor look up what statistical functions are available (e.g., for allowing functions to be selected from dropdown lists or for having javascript insert function tokens into text fields)

SVG logo

Let's use an inline SVG as django template for the logo! Here it is!

<svg
	xmlns="http://www.w3.org/2000/svg"
	viewBox="0 0 279.89 59.43"
	{% if width %}width="{{ width }}"{% endif %}
	{% if height %}height="{{ height }}"{% endif %}
>
	<g>
		<path d="M15.78,14.76c0,4.54-3.43,7.6-7.91,7.6S0,19.3,0,14.76V.19H3.34V14.61c0,2.93,1.79,4.76,4.54,4.76s4.57-1.82,4.57-4.76V.19h3.34Z"/>
		<path d="M22.64,22.17H18.87V18.41h3.77Z"/>
		<path d="M40.9,2.5,38.8,4.6a6.56,6.56,0,0,0-4.85-1.7c-2.59,0-4,1.42-4,3.43a2.55,2.55,0,0,0,.8,2,4.27,4.27,0,0,0,2.41,1l2.63.4a7.14,7.14,0,0,1,4.08,1.64,5.86,5.86,0,0,1,1.79,4.51c0,4-3.27,6.46-7.91,6.46-3.3,0-5.65-.77-7.78-2.9l2.19-2.19a7.39,7.39,0,0,0,5.65,2.13c2.9,0,4.54-1.24,4.54-3.4a2.81,2.81,0,0,0-.86-2.29,4.34,4.34,0,0,0-2.41-.93l-2.59-.37a7.42,7.42,0,0,1-4.14-1.76,5.47,5.47,0,0,1-1.64-4.23C26.72,2.59,29.5,0,34.07,0A9.11,9.11,0,0,1,40.9,2.5Z"/>
		<path d="M47.91,22.17H44.14V18.41h3.77Z"/>
		<path d="M68.95.19c4.29,0,7,2.84,7,6.67s-2.75,6.64-7,6.64h-5v8.68H60.61V.19Zm-5,3V10.5h4.82c2.35,0,3.89-1.33,3.89-3.64s-1.54-3.68-3.89-3.68Z"/>
		<path d="M88.56.19c4.17,0,6.83,2.69,6.83,6.42A5.77,5.77,0,0,1,91,12.45l5.06,9.73H92.17l-4.63-9.27H83.37v9.27H80V.19Zm-5.19,3v6.89h4.94c2.22,0,3.74-1.27,3.74-3.43s-1.51-3.46-3.74-3.46Z"/>
		<path d="M114.32,3.18H103.61V9.6h9.14v3h-9.14v6.58h10.72v3H100.27V.19h14.05Z"/>
		<path d="M131.87,2.5l-2.1,2.1a6.56,6.56,0,0,0-4.85-1.7c-2.59,0-4,1.42-4,3.43a2.55,2.55,0,0,0,.8,2,4.27,4.27,0,0,0,2.41,1l2.63.4a7.14,7.14,0,0,1,4.08,1.64,5.86,5.86,0,0,1,1.79,4.51c0,4-3.27,6.46-7.91,6.46-3.3,0-5.65-.77-7.78-2.9l2.19-2.19a7.39,7.39,0,0,0,5.65,2.13c2.9,0,4.54-1.24,4.54-3.4a2.81,2.81,0,0,0-.86-2.29,4.34,4.34,0,0,0-2.41-.93l-2.59-.37a7.43,7.43,0,0,1-4.14-1.76,5.47,5.47,0,0,1-1.64-4.23C117.69,2.59,120.47,0,125,0A9.11,9.11,0,0,1,131.87,2.5Z"/>
		<path d="M149.94,2.5l-2.1,2.1A6.56,6.56,0,0,0,143,2.9c-2.59,0-4,1.42-4,3.43a2.55,2.55,0,0,0,.8,2,4.27,4.27,0,0,0,2.41,1l2.63.4a7.14,7.14,0,0,1,4.08,1.64,5.86,5.86,0,0,1,1.79,4.51c0,4-3.27,6.46-7.91,6.46-3.3,0-5.65-.77-7.78-2.9l2.19-2.19a7.39,7.39,0,0,0,5.65,2.13c2.9,0,4.54-1.24,4.54-3.4a2.81,2.81,0,0,0-.86-2.29,4.34,4.34,0,0,0-2.41-.93l-2.59-.37a7.43,7.43,0,0,1-4.14-1.76,5.47,5.47,0,0,1-1.64-4.23c0-3.83,2.78-6.42,7.35-6.42A9.11,9.11,0,0,1,149.94,2.5Z"/>
		<path d="M14.39,40.25H3.68V47h9.14v3H3.68v9.3H.34v-22H14.39Z"/>
		<path d="M26.93,37.25c4.17,0,6.83,2.69,6.83,6.42a5.77,5.77,0,0,1-4.39,5.84l5.06,9.73H30.55L25.92,50H21.75v9.27H18.41v-22Zm-5.19,3v6.89h4.94c2.22,0,3.74-1.27,3.74-3.43s-1.51-3.46-3.74-3.46Z"/>
		<path d="M52.7,40.25H42v6.42h9.14v3H42v6.58H52.7v3H38.64v-22H52.7Z"/>
		<path d="M71.32,40.25H60.61v6.42h9.14v3H60.61v6.58H71.32v3H57.27v-22H71.32Z"/>
		<path d="M83.62,37.25A7.35,7.35,0,0,1,89.86,40c1.61,2,1.67,4.69,1.67,8.21s-.06,6.24-1.67,8.21a7.35,7.35,0,0,1-6.24,2.78H75.9v-22Zm-4.39,3v16h4A4.62,4.62,0,0,0,87,54.77c1.08-1.2,1.17-3.24,1.17-6.52S88.1,42.94,87,41.73a4.62,4.62,0,0,0-3.77-1.48Z"/>
		<path d="M109.26,39.29c2.16,2.16,2.22,4.35,2.22,9s-.06,6.79-2.22,9a8.37,8.37,0,0,1-11.37,0c-2.16-2.16-2.22-4.35-2.22-9s.06-6.79,2.22-9a8.37,8.37,0,0,1,11.37,0Zm-9,2.1c-1.08,1.17-1.3,2.5-1.3,6.86s.22,5.65,1.3,6.83a4.62,4.62,0,0,0,6.55,0c1.11-1.14,1.3-2.47,1.3-6.83s-.19-5.71-1.3-6.86a4.7,4.7,0,0,0-6.55,0Z"/>
		<path d="M135.82,59.24h-3.34V44.54l-5.06,10.72h-2.47l-5.19-10.72v14.7h-3.34v-22h3.34l6.42,13.68,6.3-13.68h3.34Z"/>
		<path d="M162.48,40.25h-6.05v19h-3.33v-19H147v-3h15.44Z"/>
		<path d="M174.81,37.25c4.17,0,6.83,2.69,6.83,6.42a5.77,5.77,0,0,1-4.39,5.84l5.06,9.73h-3.89L173.79,50h-4.17v9.27h-3.34v-22Zm-5.19,3v6.89h4.94c2.22,0,3.74-1.27,3.74-3.43s-1.51-3.46-3.74-3.46Z"/>
		<path d="M202.7,59.24h-3.55l-1.51-4.42H189l-1.51,4.42h-3.55l8.06-22h2.69ZM189.91,52h6.76l-3.4-9.76Z"/>
		<path d="M220.46,43.83h-3.4a4.36,4.36,0,0,0-4.45-3.77,4.28,4.28,0,0,0-3.24,1.33c-1.11,1.17-1.33,2.5-1.33,6.86s.22,5.68,1.33,6.86a4.28,4.28,0,0,0,3.24,1.33,4.36,4.36,0,0,0,4.45-3.77h3.4c-.77,4.35-3.83,6.76-7.84,6.76a7.67,7.67,0,0,1-5.68-2.22c-2.13-2.16-2.22-4.35-2.22-9s.09-6.79,2.22-9a7.67,7.67,0,0,1,5.68-2.22C216.66,37.07,219.69,39.48,220.46,43.83Z"/>
		<path d="M234.18,45.87l7.88,13.37h-3.92L232,48.4l-3.71,4.45v6.39h-3.34v-22h3.34V48.31l9-11.06h4.08Z"/>
		<path d="M259.29,40.25H248.57v6.42h9.14v3h-9.14v6.58h10.72v3H245.24v-22h14.05Z"/>
		<path d="M272.39,37.25c4.17,0,6.83,2.69,6.83,6.42a5.77,5.77,0,0,1-4.39,5.84l5.06,9.73H276L271.37,50H267.2v9.27h-3.34v-22Zm-5.19,3v6.89h4.94c2.22,0,3.74-1.27,3.74-3.43s-1.51-3.46-3.74-3.46Z"/>
	</g>
</svg>

[search] Complex Filtering

I'm unsure of whether this should be integrated into the search view or written into IncidentIndexPage, but we're going to need a view that provides filtering on as many possible intersections of IncidentPage fields as reasonable. Ideally this view would also provide some sort of intelligent summary data in the sidebar (e.g., "Total cases", "Total arrests w/o charges" [if relevant], maybe a graph of cases broken down by month, if it's relevant/feasible).

Let's mostly put this off till phase 2, but we can start brainstorming/thinking about the best way to implement this now.

Fix webpack build

Currently npm run build craps out with Unknown argument: optimize-occurence-order. I assume we can probably fix this by removing the --optimize-occurence-order flag from the command, but I'm assigning to @emilyhorsman in case there are side effect of that to be aware of.

prod environment and CI tests

This ticket involves two pieces:

  1. Take what is in the README, and turn that into scripts to fire up a local developer environment.
  2. Expand on that to add flags to deploy to a local prod-like environment.

All the LW peeps are on OS/X boxes so will need to be able to run the prod env. with virtualbox. To ease CI tests, will probably want it to also be docker compatible... Errrgggg I'm thinking of using our good friend molcule for this. Will make another ticket for the CI piece.

Multi-Category Incidents

Let's restructure our models such that incidents can live in multiple categories. I think this will require the following changes (though I'm not looking at the code right now, so no need for robotic adherence to these steps if they don't make sense):

  • Create a new IncidentIndexPage—this may also ultimately be the page that search and filtering lives on as described in #8
  • Set IncidentPage so that it has only IncidentIndexPage as an allowed parent and vice versa.
  • Set CategoryPage to have default children options.
  • Create a new IncidentCategorization model that extends from Orderable, has a ParentalKey to an IncidentPage and a ParentalKey to a CategoryPage
  • Add an InlinePanel to IncidentPage to make IncidentCategorizations editable
  • Determine CSS classes for color based on the first IncidentCategorization on an Incident

Blog Post Template

We don't have a design for this yet, so keep it fairly simple, but make sure the template is present and has the necessary information on it.

Fix styling on incident page

screen shot 2017-04-27 at 11 57 06 am

This should look like the mockup. It's a result of changing classes on the main part of the incident page, but not removing them for this block. This block needs it's own styling.

Fonts

Include font files for Source Sans and Source Serif in the repo. Add an SVG for the FF DIN logo.

Django HTML and CSS for incidents page

detail page

Draft up Django HTML and CSS for an incidents page. Since this will be the first HTML and CSS on this site, here are numerous conventions to be aware of 😝

I recommend familiarizing yourself with Django Template Language and BEM before getting started.

HTML

  • Common templates live in common/templates/

  • App-specific templates live in <appname>/templates/<appname>/

  • "Layout" templates (i.e., templates that other templates will extend from using {% extend %}) live in common/templates/layouts/ or <appname>/templates/<appname>/layouts/. The is one base.html template and maybe a few different templates for different column layouts.

  • "Partial" templates (i.e., templates that other templates will include using {% include %}) start with an underscore

  • In general, with the exception of layout templates, keep templates in a flat directory structure within their app. This is not a hard rule. If you find you're writing a lot of templates that benefit from being grouped together and the directory is getting unwieldy, go ahead and make subdirectories.

  • When defining {% block %} sections in layout templates, think of them as the same way you'd think of a method on a python superclass: most of the time, instead of fully overriding that method on subclasses, you call it with super(...) and append to it. Similarly, the {% block %} content in a layout template should either be blank (most of the time, this is what you want) or content that you will want prepended most of the time on subtemplates, using {{ block.super }}. For example, with CSS links, that would look like this:

    base.html

    {% block styles %}
        <link rel="stylesheet" type="text/css" href="base.css" />
    {% endblock %}

    specific_page.html

    {% block styles %}
        {{ block.super }}
        <link rel="stylesheet" type="text/css" href="specific_page.css" />
    {% endblock %}

    (Obviously we're not including any CSS files directly in this project, so this example is less strictly relevant, but you get the idea.)

SASS

  • Let's make @emilyhorsman mad and use the SASS indented syntax
  • For not, let's keep all css and js in common/static/. We might try separating it out by app later, but I'm worried about making imports complicated
  • Let's go full BEM on this project. No Bootstrap. We've never done full BEM on a project before, so this is sort of experimental :D
  • Feel free to include normalize.css.
  • Speaking of dependencies, they should all be installed with npm. Our webpack config makes sure node modules are available for import
  • Every BEM block should be its own SASS partial with file name and block name being the same
  • A single pressfreedom.sass file should import all of these partials

Generally

  • There is a strong possibility that BEM blocks will correspond to Django template partials!
  • When in doubt, refer to the freedom.press repo as an example. There are some differences between that repo and this one (particularly BEM and compiling SASS with webpack instead of django-compressor) but it otherwise is a pretty good example of how we do things
  • Feel free to have at @harrislapiroff if anything is ambiguous, assumes knowledge you don’t have, or seems questionable

Fix tag categories

I don't think there's currently a way to add categories to a tag, although they are on the model.

[mobile] Adapt footer for mobile

Currently:
screen shot 2017-05-02 at 3 25 49 pm

I think the steps should probably be:

  • Make the footer BEM elements be on top of each other instead of side-by-side
  • If necessary, make categories into one column instead of two
  • Adjust Seach bar styles as necessary so things are not overlapping

Python 3 requirement issue

Hey Peeps, we are currently deploying these applications to Debian Jessie which runs Python 3.4.2. Can we drop the python3 requirement in the developer documentation to that so there arent an unexpected surprises? Currently according to the README it is at Python 3.5.x

Update incident template to deal with multi-category incidents

This will mostly be updating the template to find the first category and code the css with that category. Determine CSS classes for color based on the first IncidentCategorization on an Incident.

@harrislapiroff I assume we will display the other categories somewhere as well? Where do you want to do that?

(This is a continuation of the part of #15 not included in the PR that will close it.)

Initial data script

We should create a createdevdata management command that creates basic model instances for us so we can nuke our dev databases freely. I think this should create:

  • a homepage
  • all category pages
  • header menu with menu items
  • numerous gibberish incidents
  • submit form page
  • some about pages

Homepage Models

The home app models should be updated to reflect the needs of the mockup. Let's ignore the statistics stuff until #16 is completed.

homepage 2

HomePage

The homepage model needs the following fields:

  • about - a rich text field
  • about_page - a ForeignKey to any page with a page chooser panel
  • blog_index - a ForeignKey to a BlogIndex page
  • incidents_index - a ForeignKey to an IncidentsIndex page—this will be used to generate the link to "more incidents" as well as, potentially, the search form.

It needs the following additional InlinePanels

  • homepagecategories - see below
  • homepageincidents - see below

HomePageCategory

  • A simple Orderable that connects one HomePage to one CategoryPage to be used for generating the list of categories

HomePageIncident

  • A simple Orderable that connects one HomePage to one IncidentPage to be used for generating the four incident previews on the homepage (these incidents must be curated)
  • A simple Orderable that connects one HomePage to one

Blog Index Template

We don't have a design for this yet so keep it fairly simple, but make sure the template is present and has a list of blog posts on it.

Update to Wagtail 1.9.1

Wagtail has updated with what looks like a security patch, and nothing that would break anything we're doing, so we should probably update it.
Release notes

Get Ansible prod scripts running in CI environment

Leaning on using CircleCI again, this ticket depends on getting #49 done first.

Basic tasks are:

  • Get ansible prod scripts deployed in CI environment (produce fail if ansible bombs out).
  • Run some basic testinfra tests to confirm system state -- thinking just that the web-server is listening and that we can scrape out some basic text from the page. Very minimal functional test (i'll leave any application level django tests you want to do to you all).

Add a developer readme

Should go through installing deps, configuring a database, running django migrations, running django devserver, and running webpack.

Category Models

arrest

CategoryPage needs to be verified to have the following fields:

  • description - (optional) char field
  • methodology - rich text field

We also need an inline panel to the following:

An Orderable model QuickFact with:

  • page - ParentalKey to any page (we'll only use this on category pages right now, but no need to limit it)
  • body - rich text field
  • link_url - (optional) for a link to the fact info

Blog Category Template

We don't have a design for this yet so keep it fairly simple, but make sure the template is present and has a list of blog posts on it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.