Skip to content

Instantly share code, notes, and snippets.

@frnhr
frnhr / svgimagefield.py
Last active Oct 28, 2020 — forked from ObserverOfTime/svgimagefield.py
A form field to handle validation of image + svg, Django 3.1
View svgimagefield.py
from django.core import validators
from lxml import etree
from django.core.exceptions import ValidationError
from django.forms import ImageField
# monkeypatch allowed file extensions:
_original = validators.get_available_image_extensions
validators.get_available_image_extensions = lambda: _original() + ["svg"]
View gist:b9d597458c73c7a33f1bc18f0dc652e5
#taken from //community.webfaction.com/questions/4888/install-nodejs-with-express-framework
#the "forever" part taken from //shkfon.tumblr.com/post/27178918675/real-world-nodejs-part-1
#thanks to [Ryan s](http://community.webfaction.com/users/16/ryans/) and [Dave Stevens](http://shkfon.tumblr.com/)
mkdir -p $HOME/src
cd $HOME/src
wget 'http://nodejs.org/dist/v0.8.9/node-v0.8.9.tar.gz'
tar -xzf node-v0.8.9.tar.gz
cd node-v0.8.9