Skip to content

Instantly share code, notes, and snippets.

View jakul's full-sized avatar
🏳️‍🌈
LGBT and proud

Craig Blaszczyk jakul

🏳️‍🌈
LGBT and proud
View GitHub Profile
(Pdb) s
--Call--
> /home/administrator/.virtualenvs/mandrake/local/lib/python2.7/site-packages/dirtyfields/dirtyfields.py(113)save()
-> def save(self, *args, **kwargs):
(Pdb) n
> /home/administrator/.virtualenvs/mandrake/local/lib/python2.7/site-packages/dirtyfields/dirtyfields.py(114)save()
-> if not self._state.adding:
(Pdb) n
> /home/administrator/.virtualenvs/mandrake/local/lib/python2.7/site-packages/dirtyfields/dirtyfields.py(115)save()
-> kwargs['update_fields'] = self.dirty_fields
$ cat /etc/hosts
127.0.0.1 localhost
127.0.0.1 api-vagrant-craig
127.0.0.1 api-vagrant-craig.networklocum.com
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
<div class="control-group offset1{% if form.emails.errors %} error{% endif %}">
<label class="control-label" for="id_emails">Emails:</label>
<div class="controls">
{{ form.email }}
<span class="help-block">Enter a comma separated list of emails of patients you would like feedback from.</span>
{% if form.emails.errors %}<span class="help-inline">{% for error in form.emails.errors %}{{ error }}{% endfor %}</span>{% endif %}
</div>
</div>
@jakul
jakul / gist:7322099
Created November 5, 2013 16:52
Get the job days for a specific set of practices
APRIL_1 = datetime.date(2013,4,1)
OCTOBER_31 = datetime.date(2013, 10, 31)
practice_names = PracticeProfile.objects.filter(Q(name__icontains='way medical ctr') | Q(name__icontains='cranwich road surgery') | Q(name__icontains='purley') | Q(name__icontains='forest') | Q(name__icontains='brennan & partners')).values_list('name', flat=True)
jds = JobDay.objects.filter(job__practice__name__in=practice_names, date__gte=APRIL_1, date__lte=OCTOBER_31)
for jd in jds:
print ','.join([str(aa) for aa in [jd.job.id, jd.job.practice.name, jd.id, jd.date, jd.start_time, jd.stop_time, jd.date.weekday()]])
@jakul
jakul / gist:7230568
Last active December 26, 2015 23:29
return (
'www/terms_and_conditions/'
'terms_and_conditions_practices_v' + self.kwargs['pk'] + '.html'
)
log.info(
"here is a really long log message that has lots of "
"interesting stuff in it and is going to be read by lots "
"of people who are clever"
def homepage():
if user.Is_logged_In:
return logged_in_hompeaage()
else:
return logged_out_homepage()
@cache_this
def logged_out_hompage():
In [7]: list(notifications_db.find({"practice_id": 40}))
Out[7]:
[{u'_id': ObjectId('51f69b3b61ea2f3e7e5a0642'),
u'created': datetime.datetime(2013, 7, 29, 17, 41, 31, 150000),
u'locum': {u'last_name': u'ramu'},
u'practice_id': 40,
u'type': u'suggest_favourite',
u'uid': u'b8e25df8f86d11e2bc6f00163e000001',
u'user_id': 604},
{u'_id': ObjectId('51fb521861ea2f795d494208'),
> db.notifications.find({"user_id":947.0})
{ "_id" : ObjectId("51fb521861ea2f795d494208"), "user_id" : 947, "uid" : "11ea15eafb3d11e2b23200163e000001", "created" : ISODate("2013-08-02T07:30:48.667Z"), "practice_id" : 40, "locum" : { "last_name" : "Naseem" }, "type" : "suggest_favourite" }
{ "_id" : ObjectId("520c758861ea2f7f8810e9e8"), "user_id" : 947, "uid" : "2fa0d5ce057411e3834300163e000001", "created" : ISODate("2013-08-15T07:30:32.466Z"), "practice_id" : 113, "locum" : { "last_name" : "Naseem" }, "type" : "suggest_favourite" }
{ "_id" : ObjectId("5252ed3b98ed642da66c3dca"), "user_id" : 947, "uid" : "22517b622a9f11e39d04080027a260e1", "created" : ISODate("2013-10-01T14:41:11.518Z"), "practice_id" : 21, "locum" : { "last_name" : "Naseem" }, "type" : "suggest_favourite" }
{ "_id" : ObjectId("5252ed3d98ed642da66c3dcb"), "user_id" : 947, "uid" : "22517b622a9f11e39d04080027a260e1", "created" : ISODate("2013-10-01T14:41:11.518Z"), "practice_id" : 21, "locum" : { "last_name" : "Naseem" }, "type" : "suggest_favou
[www.networklocum.com] Executing task 'manage_command'
[www.networklocum.com] sudo: cd /srv/networklocum/;source bin/activate; cd releases/16fbb0e2e140f2ea72b2ea36d39205bfdcce246a/networklocum/networklocum ; /srv/networklocum/bin/python manage.py report_on_locum_funnel
[www.networklocum.com] out: Traceback (most recent call last):
[www.networklocum.com] out: File "manage.py", line 14, in <module>
[www.networklocum.com] out: execute_manager(settings)
[www.networklocum.com] out: File "/srv/networklocum/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
[www.networklocum.com] out: utility.execute()
[www.networklocum.com] out: File "/srv/networklocum/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
[www.networklocum.com] out: self.fetch_command(subcommand).run_from_argv(self.argv)
[www.networklocum.com] out: File "/srv/networklocum/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_a
// update KISSmetrics
if (typeof(_kmq) != "undefined") {
_kmq.push(function() {
KM.record('locum_createinvoice_complete', {
'locum_id': $modal.data('userid'),
'job_id': $modal.data('jobid')
});
} );
}