Skip to content

Instantly share code, notes, and snippets.

from django import forms
from django.db import models
from south.modelsinspector import add_introspection_rules
class ParsleyDecimalFormField(forms.DecimalField):
def widget_attrs(self, widget):
attrs = super().widget_attrs(widget)
# ...
['/home/nick/Development/Django/myproject', '/home/nick/Apps/pycharm-3.0.2/helpers/pydev', '/home/nick/.virtualenvs/myproject/local/lib/python3.3/dist-packages/setuptools-1.1.5-py3.3.egg', '/home/nick/.virtualenvs/myproject/local/lib/python3.3/dist-packages/pip-1.4.1-py3.3.egg', '/usr/local/lib/python3.3/dist-packages/setuptools-1.1.5-py3.3.egg', '/usr/local/lib/python3.3/dist-packages/pip-1.4.1-py3.3.egg', '/usr/lib/python3.3', '/usr/lib/python3.3/plat-i386-linux-gnu', '/usr/lib/python3.3/lib-dynload', '/home/nick/.virtualenvs/myproject/local/lib/python3.3/dist-packages', '/usr/local/lib/python3.3/dist-packages', '/usr/lib/python3/dist-packages', '/home/nick/Development/Django/myproject', '/home/nick/Apps/pycharm-3.0.2/helpers/pycharm', '/home/nick/Apps/pycharm-3.0.2/helpers/pydev']
foo = ParsleyDecimalField(max_digits=18, decimal_places=8, blank=True, default=0)
# using blank=True here because I'm also using django-parsley which decorates an html form with
# declaritive validation rules, if I don't mark this as blank=True then parsley attaches a required=true to the form.
# this is a problem because I want to allow empty values which automatically get saved as the number 0
def save(self, *args, **kwargs):
if self.value is None:
self.value = 0
super().save(*args, **kwargs)
__pycache__/
*.py[cod]
*.log
*.pot
*.sqlite3
logs/
docs/_build/
build/
from django.contrib import admin
from leads.models import Lead
admin.site.register(Lead)
...
[i686-linux-gnu-gcc -pthread] plugins/transformation_template/tt.o
[i686-linux-gnu-gcc -pthread] plugins/stats_pusher_socket/plugin.o
*** uWSGI linking ***
i686-linux-gnu-gcc -pthread -o /usr/bin/uwsgi -L/usr/lib core/utils.o core/protocol.o core/socket.o core/logging.o core/master.o core/master_utils.o core/emperor.o core/notify.o core/mule.o core/subscription.o core/stats.o core/sendfile.o core/async.o core/master_checks.o core/fifo.o core/offload.o core/io.o core/static.o core/websockets.o core/spooler.o core/snmp.o core/exceptions.o core/config.o core/setup_utils.o core/clock.o core/init.o core/buffer.o core/reader.o core/writer.o core/alarm.o core/cron.o core/hooks.o core/plugins.o core/lock.o core/cache.o core/daemons.o core/errors.o core/hash.o core/master_events.o core/chunked.o core/queue.o core/event.o core/signal.o core/strings.o core/progress.o core/timebomb.o core/ini.o core/fsmon.o core/mount.o core/metrics.o core/plugins_builder.o core/sharedarea.o core/rpc.o core/gateway.o core/loop.o
(myproject) nick@devbox:~/Development/Django/myproject$ /home/nick/Downloads/uwsgi-2.0/uwsgi --http :8000 --ini myproject/uwgsi.ini
[uWSGI] getting INI configuration from myproject/uwgsi.ini
;uWSGI instance configuration
[uwsgi]
http = :8000
ini = myproject/uwgsi.ini
chdir = /home/nick/Development/Django/myproject/
module = myproject.wsgi
socket = /tmp/myproject.sock
$ aptitude search python3~i
i A libpython3-dev - header files and a static library for Pyth
i libpython3-stdlib - interactive high-level object-oriented lan
i libpython3.3 - Shared Python runtime library (version 3.3
i A libpython3.3-dev - Header files and a static library for Pyth
i libpython3.3-minimal - Minimal subset of the Python language (ver
i libpython3.3-stdlib - Interactive high-level object-oriented lan
i python3 - interactive high-level object-oriented lan
i A python3-apport - Python 3 library for Apport crash report h
i python3-apt - Python 3 interface to libapt-pkg
Environment:
Request Method: GET
Request URL: http://192.168.1.7:8000/leads/
Django Version: 1.6.1
Python Version: 3.3.2
Installed Applications:
('django.contrib.admin',