Package: django-odk
django-odkDjango data collection tool usingODK-collectmobile app.PrerequisiteDjango web site up and runningSmartphone or tablet withODK-Collect installedXLSFormfile with 3 tabs 'survey', 'choices', 'settings'NEW from version 1.0.2 (xls2xml & create final model)Since most of Xforms are usinggeopoint, the database must be set upwith vector geodatabase functionality: PostGIS, Oracle Spatial, SQLite/SpatiaLiteJava Runtime Environment (JRE)installed$ sudo apt install default-jrefor XForm validation used byxlsconvInstallationRun$pipinstalldjango-odk
$pythonmanage.pymigrate
$pythonmanage.pycreatesuperuserAdd odk and odkdata to your INSTALLED_APPS settingsINSTALLED_APPS=(...'odk','odkdata',)Add LOCALE_PATHS and appropriate language_code in settingsLOCALE_PATHS=[os.path.join(BASE_DIR,'odk','locale')]LANGUAGE_CODE='en'# translated LANGUAGE_CODE: frAdd appropriate AUTH_USER_MODEL in settings.pyAUTH_USER_MODEL='auth.user'For a more interactive app, configureloggingas explained inLincoln Loopandmessagesas explained inDjangoForlogging, addodkandodkdataentry tologgerskey of your logging file and adapthandlersaccording to yours.'loggers':{...'odk':{'handlers':['console','debugger','warning','error'],'level':'DEBUG'ifDEBUGelse'INFO','propagate':False,},'odkdata':{'handlers':['console','debugger','warning','error'],'level':'DEBUG'ifDEBUGelse'INFO','propagate':False,},}Addis_odk_adminandis_odk_userproperty to your AUTH_USER_MODEL (django.contrib.auth.models file or specific accounts.models)@propertydefis_odk_admin(self):returnself.groups.filter(name='odk-admin').exists()@propertydefis_odk_user(self):returnself.groups.filter(name='odk-user').exists()Add odk.urls to the main urls.py file:urlpatterns=[...path('odk/',include('odk.urls'),name='odk'),]Add menu or buttons to accessAvailable form# bootstrap5 menu item example<li><aclass="dropdown-item"href="{% url 'odk:xform_list' %}">{%trans"ODK available forms"%}</a></li>Add menu or buttons to accessSubmitted form# bootstrap5 menu item example<li><aclass="dropdown-item"href="{% url 'odk:xformsubmit_list' %}">{%trans"ODK submitted forms"%}</a></li>Connect to the Django admin sitecreate a group 'odk-admin' with create, read, update access on odk objectsAssociate this group to the appropriate usersAvailable form: Build, Upload, Convert, CreateConnect to django-odk =>Available form=> Add and follow 4 steps:Buildan XLSForm file with 3 tabs 'survey', 'choices', 'settings'Cfr documentation. Do not forget to add 'today' & 'username' fields in Survey tab!Uploadxlsx file (XForm) by clicking on 'Choose file' and SaveConvertxlsx file to xml XForm compatible fileThanks pyxform!If it is not working in production (504 Geteway timeout), xml (previously created fromXLSForm Online) can be uploaded manually from admin site.From this point, you are ready to go with form encoding on your smartphone!FollowODK instructionsto configure the connexion to the serverGet, fill-in and submit datausing ODK CollectCreateModel in odkdata to get submitted data in a model formatted like xlsx form.Thanks xlsconv!! Model creation is done into Appodkdatawith table name followed by_origsuffix when converted by xlsconv.Submitted formGo toSubmitted formmenu of your server to see submitted data in XML format. On record view, click onInsertbutton to insert submitted XML data intoodkdata.modelscreated on step 4 hereabove.Several record insert is available through admin interface. Select appropriate records (ie: those without insert date) and chooseInsert in odkdata modelfrom action dropdown list and click on 'Send' button.What next?Create a new app in you project likeodkdata2withtemplates, views(importing odkdata.models info) andurlsto manage display/map/export-xls/update/analyse submitted data from ODK-Collect!Do not forget to addodkdata2logger specifications in settings.pyComments/Improvements welcome!InvestigateWQ Frameworkbut I still don't see how to deploy offline forms on smartphone.