Skip to content

Instantly share code, notes, and snippets.

@loic
loic / -
Created September 23, 2016 11:47
{
"locations": [],
"settings": {
"exportForm": {
"server": "https://scope-trn.wfp.org/triplex/mobile/registration/v1/"
},
"features": {
"captureIris": true,
"captureFingerprints": true,
"updateToken": true
diff --git a/scope/foodnet/apps/mobile/importer.py b/scope/foodnet/apps/mobile/importer.py
index 2ce4f0e..c1a8c0c 100644
--- a/scope/foodnet/apps/mobile/importer.py
+++ b/scope/foodnet/apps/mobile/importer.py
@@ -76,18 +76,22 @@ class MobileHouseholdImporter(object):
member = Person(uuid=member_uuid)
created = True
- member.last_name = member_data.get('lastName', '')
- member.first_name = member_data.get('firstName', '')
diff --git a/scope/foodnet/apps/mobile/importer.py b/scope/foodnet/apps/mobile/importer.py
index 2ce4f0e..f6db43c 100644
--- a/scope/foodnet/apps/mobile/importer.py
+++ b/scope/foodnet/apps/mobile/importer.py
@@ -76,6 +76,10 @@ class MobileHouseholdImporter(object):
member = Person(uuid=member_uuid)
created = True
+ # Backwards compat for < 1.0.3
+ if 'info' not in member_data:
If I remember well, we discussed at some point with you and charettes about
removing the string version (as opposed to callable) of RunPython, if we do it,
it may be better to do it early on in the release cycle.
For some reason MyModel.objects.create() returned an object with pk=None,
I could confirm the object was created with a call to MyModel.objects.all().
I'm not totally sure if it's a bug or a side effect of the fake ORM.
I was bitten quite badly by the fact that custom Manager and custom save()
methods aren't called, https://github.com/django/django/blob/master/docs/topics/migrations.txt#L296-L297
print_tb()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 249, in remove
del self.data[k]
print_exc()
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 249, in remove
del self.data[k]
KeyError: <weakref at 0x10eeeb310; dead>
print_tb()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 249, in remove
WeakKeyDictionary
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 260, in remove
del self.data[k]
KeyError: <weakref at 0x10be01a48; dead>
self.data:
{}
k:
<weakref at 0x10be01a48; dead>
@loic
loic / -
Created January 26, 2014 08:03
# This is an example test settings file for use with the Django test suite.
#
# The 'sqlite3' backend requires only the ENGINE setting (an in-
# memory database will be used). All other backends will require a
# NAME and potentially authentication information. See the
# following section in the docs for more information:
#
# https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/
#
# The different databases that Django supports behave differently in certain
# This is an example test settings file for use with the Django test suite.
#
# The 'sqlite3' backend requires only the ENGINE setting (an in-
# memory database will be used). All other backends will require a
# NAME and potentially authentication information. See the
# following section in the docs for more information:
#
# https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/
#
# The different databases that Django supports behave differently in certain
# This is an example test settings file for use with the Django test suite.
#
# The 'sqlite3' backend requires only the ENGINE setting (an in-
# memory database will be used). All other backends will require a
# NAME and potentially authentication information. See the
# following section in the docs for more information:
#
# https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/
#
# The different databases that Django supports behave differently in certain
@loic
loic / gist:8576940
Created January 23, 2014 11:17
Django custom index types.
ML thread:
https://groups.google.com/d/topic/django-developers/hVTLAp_jLzQ/discussion
2013-10-03:
20:15 loic84: akaariai: what's your opinion no the recent ML thread regarding custom index types?
20:18 akaariai: loic84: write the SQL by hand... Or, maybe you could have a VirtualField that just creates indexes for you.
20:20 loic84: akaariai: I've been thinking about integrating PG arrays and JSON support in my projects.