Skip to content

Instantly share code, notes, and snippets.

Andy Chosak chosak

Block or report user

Report or block chosak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chosak
chosak / notes.md
Created May 3, 2019
PyCon US 2019 Wagtail open session
View notes.md

We had a nice open session this afternoon at PyCon US, organized by Sean Harrison from Caktus Group. There were about 15 people in the room. The session agenda was generally to discuss improving Wagtail for developers.

StreamField data migrations

Adding fields or blocks won't cause problems as long as you don't rename or removing anything.

Sean presented a nice multi-step approach that he recommends when migrating StreamFields. This way you can run each step independently and verify that it worked correctly.

  1. First add the new field or block (example).
  2. Make a migration that copies the data from old fields to new fields, but don't remove anything yet (example).
@chosak
chosak / home_page.html
Last active Feb 12, 2019
Prototype solution to prevent caching of Wagtail previews - https://github.com/wagtail/wagtail/issues/5074
View home_page.html
{# home/templates/home/home_page.html #}
{# Uses safecache instead of cache to prevent caching of preview content #}
{% load safecache %}
{# Usage of cache tag remains the same #}
{% cache 3600 homepage_charfield %}
{{ self.a_charfield }}
{% endcache %}
@chosak
chosak / export.py
Created Jan 18, 2017
Wordpress export script
View export.py
#!/usr/bin/env python
from __future__ import absolute_import, print_function, unicode_literals
import argparse
import os
import re
import requests
from getpass import getpass
@chosak
chosak / index.html
Created Jul 12, 2016
Indy PZ tweet timeline
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>projects/indy/data/tweets/indy-0.json</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js"></script>
<style>
.axis text {
font: 10px sans-serif;
}
You can’t perform that action at this time.