diff --git a/.failing-travis.yml b/.failing-travis.yml deleted file mode 100644 index a4952e6e6..000000000 --- a/.failing-travis.yml +++ /dev/null @@ -1,48 +0,0 @@ -language: python -addons: - postgresql: 9.3 -cache: - apt: true - directories: - - $HOME/.pip-cache/ -services: - - mongodb -python: - - '2.7' -before_install: - - ./script/database/install_postgis onadata_test postgres 127.0.0.1 - - ./script/install/ubuntu - # faster pandas install - # https://gist.github.com/dan-blanchard/7045057 - - wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh - - chmod +x miniconda.sh - - ./miniconda.sh -b - - export PATH=/home/travis/miniconda/bin:$PATH - - conda update --yes conda - - conda create --yes -n condaenv python=2.7 - - conda install --yes -n condaenv pip - - source activate condaenv - - sudo rm -rf /dev/shm - - sudo ln -s /run/shm /dev/shm -env: - - TESTFOLDER=onadata/apps/main -install: - - conda install --yes python=$TRAVIS_PYTHON_VERSION numpy pandas=0.12.0 - - pip install -r requirements/base.pip --allow-all-external - - pip install flake8 - - python manage.py syncdb --noinput --settings=onadata.settings.travis_test - - python manage.py migrate --noinput --settings=onadata.settings.travis_test - # make ~/tmp dir writable for npm downloads - # - if [[ "$TESTFOLDER" == onadata/apps/api* ]] ; then sudo chmod a+w $HOME/tmp ; fi - # - if [[ "$TESTFOLDER" == onadata/apps/api* ]] ; then npm install ; fi - # - if [[ "$TESTFOLDER" == onadata/apps/api* ]] ; then bower install --force-latest ; fi -script: - - python manage.py test $TESTFOLDER --noinput --settings=onadata.settings.travis_test - - if [[ "$TESTFOLDER" == onadata/apps/api* ]] ; then karma start onadata/libs/javascript/tests/karma.conf.js ; fi -notifications: - email: - - tech+travis@ona.io - hipchat: - rooms: - secure: cfWcsNSVAq9vs0pFrT5VKrd7Be6uE8eDPuaOBVT+sGjRKoF7UgaY+jwHK6yaO+Iv+/4aBEsMb5Sc0qp0vQ7vwP9X9THO4Y+giFolQByKO74rnMEp/cn5Hdyv8r5UsHXLYj4MtipLAuD9wkZBOWjsbYfhhDZ6zJ7ZFztvYn/Fxoc= - irc: 'irc.freenode.org#onatest' diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 000000000..98cd84d09 --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,55 @@ +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: pytest + +on: + push: + branches: + - master + - beta + pull_request: + branches: + - master + - beta + +jobs: + build: + runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: ['3.8'] + services: + postgres: + image: postgis/postgis:9.5-2.5 + env: + POSTGRES_USER: kobo + POSTGRES_PASSWORD: kobo + POSTGRES_DB: kobocat_test + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + redis_cache: + image: redis:3.2 + ports: + - 6380:6379 + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Upgrade pip + run: python -m pip install --upgrade pip + - name: Update apt package lists + run: sudo apt update + - name: Install apt dependencies + run: sudo apt-get install ghostscript libxml2-dev libxslt-dev python3-dev gdal-bin libproj-dev gettext postgresql-client openjdk-11-jre + - name: Install Python dependencies + run: pip install -r dependencies/pip/dev.txt + - name: Run pytest + run: pytest -vv -rf + env: + DJANGO_SECRET_KEY: ${{ secrets.DJANGO_SECRET_KEY }} + TEST_DATABASE_URL: postgis://kobo:kobo@localhost:5432/kobocat_test + REDIS_SESSION_URL: redis://localhost:6380/2 + USE_POSTGRESQL: True diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 158206601..000000000 --- a/.travis.yml +++ /dev/null @@ -1,61 +0,0 @@ -# Don't double-build PR commits. See: http://stackoverflow.com/a/31882307/1877326 -branches: - only: - - master -dist: xenial -sudo: required -language: python -python: - - "2.7" -services: - - postgresql - - redis-server -addons: - postgresql: "9.5" - chrome: stable - apt: - packages: - - build-essential - - fontforge - - gettext - - git-core - - libpcre3 - - libpcre3-dev - - libpq-dev - - libgnutls28-dev - - binutils - - default-jre-headless - - gdal-bin - - libpcre3-dev - - libpq-dev - - libproj-dev - - libxml2 - - libxml2-dev - - libxslt1-dev - - libjpeg-dev - - libffi-dev - - postgresql-client - - postgresql-9.5-postgis-2.5 - - libsqlite3-mod-spatialite -cache: - directories: - - $HOME/.pip-download-cache -before_script: - - psql -c 'create database travis_ci_test;' -U postgres - - psql -U postgres -c "create extension postgis" -script: - - pytest -vv -env: - # All about YAML line breaks: https://stackoverflow.com/a/21699210 - - >- - PIP_DOWNLOAD_CACHE=$HOME/.pip-download-cache - DJANGO_DEBUG=False - DJANGO_SECRET_KEY=o4xbmwsyTJicFmjhQc4Xm - DJANGO_SETTINGS_MODULE=onadata.settings.test_environ - DJANGO_LANGUAGE_CODES="en ar es fr hi ku pl pt zh-hans" - DATABASE_URL="postgres://postgres@localhost:5432/travis_ci_test" - REDIS_SESSION_URL="redis://localhost:6379" - TRAVIS_NODE_VERSION="8" -install: - - pip install --upgrade 'pip>=10,<11' - - pip install -r requirements/travis.pip diff --git a/Dockerfile b/Dockerfile index 28eeec81b..db9e4fe8e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,69 +1,112 @@ -FROM kobotoolbox/kobocat_base:latest +FROM nikolaik/python-nodejs:python3.8-nodejs10 -ENV KOBOCAT_SRC_DIR=/srv/src/kobocat \ +# Declare environment variables +ENV DEBIAN_FRONTEND=noninteractive +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 + +ENV VIRTUAL_ENV=/opt/venv \ + KOBOCAT_LOGS_DIR=/srv/logs \ + DJANGO_SETTINGS_MODULE=onadata.settings.prod \ + # The mountpoint of a volume shared with the `nginx` container. Static files will + # be copied there. + NGINX_STATIC_DIR=/srv/static \ + KOBOCAT_SRC_DIR=/srv/src/kobocat \ BACKUPS_DIR=/srv/backups \ - KOBOCAT_LOGS_DIR=/srv/logs - -# Install post-base-image `apt` additions from `apt_requirements.txt`, if modified. -COPY ./apt_requirements.txt "${KOBOCAT_TMP_DIR}/current_apt_requirements.txt" -RUN if ! diff "${KOBOCAT_TMP_DIR}/current_apt_requirements.txt" "${KOBOCAT_TMP_DIR}/base_apt_requirements.txt"; then \ - apt-get update && \ - apt-get install -y $(cat "${KOBOCAT_TMP_DIR}/current_apt_requirements.txt") && \ - apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ - ; fi - -# Version 8 of pip doesn't really seem to upgrade packages when switching from -# PyPI to editable Git -RUN pip install --upgrade 'pip>=10,<11' - -# Install post-base-image `pip` additions/upgrades from `requirements/base.pip`, if modified. -COPY ./requirements/ "${KOBOCAT_TMP_DIR}/current_requirements/" -# FIXME: Replace this with the much simpler command `pip-sync ${KOBOCAT_TMP_DIR}/current_requirements/base.pip`. -RUN if ! diff "${KOBOCAT_TMP_DIR}/current_requirements/base.pip" "${KOBOCAT_TMP_DIR}/base_requirements/base.pip"; then \ - pip install --src "${PIP_EDITABLE_PACKAGES_DIR}/" -r "${KOBOCAT_TMP_DIR}/current_requirements/base.pip" \ - ; fi - -# Install post-base-image `pip` additions/upgrades from `requirements/s3.pip`, if modified. -RUN if ! diff "${KOBOCAT_TMP_DIR}/current_requirements/s3.pip" "${KOBOCAT_TMP_DIR}/base_requirements/s3.pip"; then \ - pip install --src "${PIP_EDITABLE_PACKAGES_DIR}/" -r "${KOBOCAT_TMP_DIR}/current_requirements/s3.pip" \ - ; fi - -# Uninstall `pip` packages installed in the base image from `requirements/uninstall.pip`, if present. -# FIXME: Replace this with the much simpler `pip-sync` command equivalent. -RUN if [ -e "${KOBOCAT_TMP_DIR}/current_requirements/uninstall.pip" ]; then \ - pip uninstall --yes -r "${KOBOCAT_TMP_DIR}/current_requirements/uninstall.pip" \ - ; fi - -# Wipe out the base image's `kobocat` dir (**including migration files**) and copy over this directory in its current state. -RUN rm -rf "${KOBOCAT_SRC_DIR}" + TMP_DIR=/srv/tmp \ + UWSGI_USER=kobo \ + UWSGI_GROUP=kobo \ + SERVICES_DIR=/etc/service \ + CELERY_PID_DIR=/var/run/celery \ + INIT_PATH=/srv/init + +# Install Dockerize +ENV DOCKERIZE_VERSION v0.6.1 +RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz -P /tmp \ + && tar -C /usr/local/bin -xzvf /tmp/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ + && rm /tmp/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz + +# Create needed directories +RUN mkdir -p ${NGINX_STATIC_DIR} && \ + mkdir -p ${KOBOCAT_SRC_DIR} && \ + mkdir -p ${TMP_DIR} && \ + mkdir -p ${BACKUPS_DIR} && \ + mkdir -p ${CELERY_PID_DIR} && \ + mkdir -p ${SERVICES_DIR}/uwsgi && \ + mkdir -p ${SERVICES_DIR}/uwsgi_wrong_port_warning && \ + mkdir -p ${SERVICES_DIR}/celery && \ + mkdir -p ${SERVICES_DIR}/celery_beat && \ + mkdir -p ${KOBOCAT_LOGS_DIR}/ && \ + mkdir -p ${KOBOCAT_SRC_DIR}/emails && \ + mkdir -p ${INIT_PATH} + +# Install `apt` packages. +RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - + +RUN apt-get -qq update && \ + apt-get -qq -y install \ + gdal-bin \ + libproj-dev \ + gettext \ + postgresql-client \ + libsqlite3-mod-spatialite \ + openjdk-11-jre \ + locales \ + runit-init \ + rsync \ + less \ + vim \ + gosu \ + cron && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Install locales +RUN echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen && \ + locale-gen && dpkg-reconfigure locales -f noninteractive + +# Create local user UWSGI_USER` +RUN adduser --disabled-password --gecos '' "$UWSGI_USER" + +# Copy KoBoCAT directory COPY . "${KOBOCAT_SRC_DIR}" -# Prepare for execution. -# TODO: Remove the wrong port warning and related files, say, at the start of 2021 (see kobotoolbox/kobo-docker#301) -RUN mkdir -p /etc/service/uwsgi_wrong_port_warning && \ - cp "${KOBOCAT_SRC_DIR}/docker/run_uwsgi_wrong_port_warning.bash" /etc/service/uwsgi_wrong_port_warning/run && \ - mkdir -p /etc/service/uwsgi && \ - cp "${KOBOCAT_SRC_DIR}/docker/run_uwsgi.bash" /etc/service/uwsgi/run && \ - mkdir -p /etc/service/celery && \ - ln -s "${KOBOCAT_SRC_DIR}/docker/run_celery.bash" /etc/service/celery/run && \ - mkdir -p /etc/service/celery_beat && \ - ln -s "${KOBOCAT_SRC_DIR}/docker/run_celery_beat.bash" /etc/service/celery_beat/run && \ - cp "${KOBOCAT_SRC_DIR}/docker/init.bash" /etc/my_init.d/10_init_kobocat.bash && \ - cp "${KOBOCAT_SRC_DIR}/docker/sync_static.sh" /etc/my_init.d/11_sync_static.bash && \ - mkdir -p "${KOBOCAT_SRC_DIR}/emails/" && \ - chown -R "${UWSGI_USER}" "${KOBOCAT_SRC_DIR}/emails/" && \ - mkdir -p "${BACKUPS_DIR}" && \ - mkdir -p "${KOBOCAT_LOGS_DIR}" && \ - chown -R "${UWSGI_USER}" "${KOBOCAT_LOGS_DIR}" - -RUN echo "db:*:*:kobo:kobo" > /root/.pgpass && \ - chmod 600 /root/.pgpass +# Install `pip` packages +RUN virtualenv "$VIRTUAL_ENV" +ENV PATH="$VIRTUAL_ENV/bin:$PATH" +RUN pip install --quiet --upgrade pip && \ + pip install --quiet pip-tools +COPY ./dependencies/pip/prod.txt "${TMP_DIR}/pip_dependencies.txt" +RUN pip-sync "${TMP_DIR}/pip_dependencies.txt" 1>/dev/null && \ + rm -rf ~/.cache/pip # Using `/etc/profile.d/` as a repository for non-hard-coded environment variable overrides. -RUN echo 'source /etc/profile' >> /root/.bashrc +RUN echo "export PATH=${PATH}" >> /etc/profile && \ + echo 'source /etc/profile' >> /root/.bashrc && \ + echo 'source /etc/profile' >> /home/${UWSGI_USER}/.bashrc + +# Remove getty* services to avoid errors of absent tty at sv start-up +RUN rm -rf /etc/runit/runsvdir/default/getty-tty* +# Create symlinks for runsv services +RUN ln -s "${KOBOCAT_SRC_DIR}/docker/run_uwsgi_wrong_port_warning.bash" "${SERVICES_DIR}/uwsgi_wrong_port_warning/run" && \ + ln -s "${KOBOCAT_SRC_DIR}/docker/run_uwsgi.bash" "${SERVICES_DIR}/uwsgi/run" && \ + ln -s "${KOBOCAT_SRC_DIR}/docker/run_celery.bash" "${SERVICES_DIR}/celery/run" && \ + ln -s "${KOBOCAT_SRC_DIR}/docker/run_celery_beat.bash" "${SERVICES_DIR}/celery_beat/run" + +# Add/Restore `UWSGI_USER`'s permissions +RUN chown -R ":${UWSGI_GROUP}" ${CELERY_PID_DIR} && \ + chmod g+w ${CELERY_PID_DIR} && \ + chown -R "${UWSGI_USER}:${UWSGI_GROUP}" ${KOBOCAT_SRC_DIR}/emails/ && \ + chown -R "${UWSGI_USER}:${UWSGI_GROUP}" ${KOBOCAT_LOGS_DIR} && \ + chown -R "${UWSGI_USER}:${UWSGI_GROUP}" ${TMP_DIR} && \ + chown -R "${UWSGI_USER}:${UWSGI_GROUP}" ${VIRTUAL_ENV} && \ + chown -R "${UWSGI_USER}:${UWSGI_GROUP}" ${BACKUPS_DIR} WORKDIR "${KOBOCAT_SRC_DIR}" # TODO: Remove port 8000, say, at the start of 2021 (see kobotoolbox/kobo-docker#301 and wrong port warning above) EXPOSE 8001 8000 + +CMD ["/bin/bash", "-c", "exec ${KOBOCAT_SRC_DIR}/docker/init.bash"] diff --git a/Dockerfile.kobocat_base b/Dockerfile.kobocat_base deleted file mode 100644 index 5f85a779b..000000000 --- a/Dockerfile.kobocat_base +++ /dev/null @@ -1,33 +0,0 @@ -# Base image to take care of installing `apt` and `pip` requirements. - -FROM kobotoolbox/base-kobos:latest - - -ENV KOBOCAT_TMP_DIR=/srv/kobocat_tmp \ - # Store editable packages (pulled from VCS repos) in their own directory. - PIP_EDITABLE_PACKAGES_DIR=/srv/pip_editable_packages \ - UWSGI_USER=wsgi \ - UWSGI_GROUP=wsgi - - -########################### -# Install `apt` packages. # -########################### - -COPY ./apt_requirements.txt ${KOBOCAT_TMP_DIR}/base_apt_requirements.txt -RUN apt-get update && \ - apt-get upgrade -y && \ - apt-get install -y $(cat ${KOBOCAT_TMP_DIR}/base_apt_requirements.txt) && \ - apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - - -########################### -# Install `pip` packages. # -########################### - -COPY ./requirements/ ${KOBOCAT_TMP_DIR}/base_requirements/ -RUN mkdir -p ${PIP_EDITABLE_PACKAGES_DIR} && \ - pip install --upgrade 'pip>=10,<11' && \ - pip install --src ${PIP_EDITABLE_PACKAGES_DIR}/ -r ${KOBOCAT_TMP_DIR}/base_requirements/base.pip && \ - pip install --src ${PIP_EDITABLE_PACKAGES_DIR}/ -r ${KOBOCAT_TMP_DIR}/base_requirements/s3.pip && \ - rm -rf ~/.cache/pip diff --git a/README.md b/README.md index 01cddb3a1..93125f882 100644 --- a/README.md +++ b/README.md @@ -90,16 +90,11 @@ For all other users, enter the container using this command $ docker exec -it {{kobocat container}} /bin/bash ``` -Run pip install the development dependancies +Run pip install the development dependencies ``` sh $ pip install -r requirements/dev.pip ``` -Install libsqlite3-mod-spatialite for the testing database - -``` sh -$ apt-get update && apt-get install libsqlite3-mod-spatialite -``` Run pytest to run all automated tests diff --git a/REMOVALS.md b/REMOVALS.md index 3ecccafa8..fded2bb3f 100644 --- a/REMOVALS.md +++ b/REMOVALS.md @@ -1,3 +1,90 @@ +# KoBoCAT endpoint removals as of release 2.021.22 + +The last release to contain any of the endpoints listed below was [2.021.21](https://github.com/kobotoolbox/kpi/releases/tag/2.021.21). + +## Submission Data Access and Management + +URL Pattern | View Class or Function | Description | Available in KPI +-- | -- | -- | -- +`//exports/.csv` | `onadata.apps.export.views._wrapper` | Old version of formpack (not legacy) exports | Yes +`//exports/.html` | `onadata.apps.export.views._wrapper` | Old version of formpack (not legacy) exports | Yes +`//exports/.xlsx` | `onadata.apps.export.views._wrapper` | Old version of formpack (not legacy) exports | Yes +`//exports//` | `onadata.apps.export.views._wrapper` | Old version of formpack (not legacy) exports | Yes +`//forms//add-submission-with` | `onadata.apps.viewer.views.add_submission_with` | Unknown (no hits in access log, undocumented, no UI, no significant development since 2013) | No +`//forms//data.sav.zip` | `onadata.apps.viewer.views.data_export` | SPSS SAV data export (dropped from UI in 2015) | No +`//forms//delete_data` | `onadata.apps.main.views.delete_data` | Delete an individual submission | Yes +`//forms//edit-data/` | `onadata.apps.logger.views.edit_data` | Edit a submission in Enketo | Yes +`//forms//enter-data` | `onadata.apps.logger.views.enter_data` | Add a submission with Enketo | Yes +`//forms//instance` | `onadata.apps.viewer.views.instance` | View a single instance | Yes +`//forms//map` | `onadata.apps.viewer.views.map_view` | View submissions on a map | Yes +`//forms//map_embed` | `onadata.apps.viewer.views.map_embed_view` | View submissions on a map | Yes +`//forms//view-data` | `onadata.apps.viewer.views.data_view` | View submissions in a table | Yes +`//reports//digest.html` | `onadata.apps.survey_report.views._wrapper` | “Analyze data” (outdated version of KPI’s “Reports”) | Yes +`//reports//digest/` | `onadata.apps.survey_report.views._wrapper` | Old version of formpack (not legacy) exports | Yes +`//reports//export.csv` | `onadata.apps.survey_report.views._wrapper` | Old version of formpack (not legacy) exports | Yes +`//reports//export.html` | `onadata.apps.survey_report.views._wrapper` | Old version of formpack (not legacy) exports | Yes +`//reports//export.xlsx` | `onadata.apps.survey_report.views._wrapper` | Old version of formpack (not legacy) exports | Yes +`//reports//export/` | `onadata.apps.survey_report.views._wrapper` | Old version of formpack (not legacy) exports | Yes +`//reports//submission/.html` | `onadata.apps.survey_report.views._wrapper` | Old version of formpack (not legacy) exports | Yes + +## Project Management + +URL Pattern | View Class or Function | Description | Available in KPI +-- | -- | -- | -- +`///toggle_downloadable/` | `onadata.apps.logger.views.toggle_downloadable` | Switch data collection on and off for a project | Yes, as “archive” +`//cloneform` | `onadata.apps.main.views.clone_xlsform` | Unused and undocumented form cloning feature | Yes +`//delete//` | `onadata.apps.logger.views.delete_xform` | Delete an entire project | Yes +`//forms//delete-doc/` | `onadata.apps.main.views.delete_metadata` | Delete background documents | No +`//forms//perms` | `onadata.apps.main.views.set_perm` | Set project permissions | Yes +`//forms//preview` | `onadata.apps.main.views.enketo_preview` | Preview a form in Enketo | Yes +`//forms//public_api` | `onadata.apps.main.views.public_api` | Basic form metadata: title, owner’s username, date created/modified, id_string, uuid, sharing status, archival status | Yes, but only if public access to the project is explicitly granted +`//forms//qrcode` | `onadata.apps.main.views.qrcode` | QR code (as a HTML page) containing Enketo data-entry URL | No +`//forms//update` | `onadata.apps.main.views.update_xform` | Overwrite a project with new XLSForm | Yes +`/api/v1/forms//enketo` | `onadata.apps.api.viewsets.xform_viewset.XFormViewSet` | Retrieve Enketo data entry URL | Yes + +## Already Unused or Non-functional + +URL Pattern | View Class or Function | Description | Available in KPI +-- | -- | -- | -- +`//activity` | `onadata.apps.main.views.activity` | Audit log entries (non-functional) | No +`//activity/api` | `onadata.apps.main.views.activity_api` | Audit log entries (non-functional) | No +`//forms//gdocs` | `onadata.apps.viewer.views.google_xls_export` | Google Docs export (non-functional) | No +`//forms//sms_multiple_submissions` | `onadata.apps.sms_support.views.import_multiple_submissions_for_form` | Data collection via SMS (non-functional) | No +`//forms//sms_submission` | `onadata.apps.sms_support.views.import_submission_for_form` | Data collection via SMS (non-functional) | No +`//forms//sms_submission//` | `onadata.apps.sms_support.providers.import_submission_for_form` | Data collection via SMS (non-functional) | No +`//forms//thank_you_submission` | `onadata.apps.viewer.views.thank_you_submission` | Data collection via SMS (non-functional) | No +`//sms_multiple_submissions` | `onadata.apps.sms_support.views.import_multiple_submissions` | Data collection via SMS (non-functional) | No +`//sms_submission` | `onadata.apps.sms_support.views.import_submission` | Data collection via SMS (non-functional) | No +`//sms_submission//` | `onadata.apps.sms_support.providers.import_submission` | Data collection via SMS (non-functional) | No +`/about-us/` | `onadata.apps.main.views.about_us` | Unused informational page | Yes (on kobotoolbox.org) +`/accounts/activate//` | `registration.backends.default.views.ActivationView` | Unused user management | Yes (always was) +`/accounts/activate/complete/` | `django.views.generic.base.TemplateView` | Unused user management | Yes (always was) +`/accounts/password/change/` | `django.contrib.auth.views.password_change` | Unused user management | Yes (always was) +`/accounts/password/change/done/` | `django.contrib.auth.views.password_change_done` | Unused user management | Yes (always was) +`/accounts/password/reset/` | `django.contrib.auth.views.password_reset` | Unused user management | Yes (always was) +`/accounts/password/reset/complete/` | `django.contrib.auth.views.password_reset_complete` | Unused user management | Yes (always was) +`/accounts/password/reset/confirm///` | `django.contrib.auth.views.password_reset_confirm` | Unused user management | Yes (always was) +`/accounts/password/reset/done/` | `django.contrib.auth.views.password_reset_done` | Unused user management | Yes (always was) +`/accounts/register/` | `onadata.apps.main.registration_views.FHRegistrationView` | Unused user management | Yes (always was) +`/accounts/register/complete/` | `django.views.generic.base.TemplateView` | Unused user management | Yes (always was) +`/activity/fields` | `onadata.apps.main.views.activity_fields` | Schema for audit log | No +`/api/v1/profiles//change_password` | `onadata.apps.api.viewsets.user_profile_viewset.UserProfileViewSet` | Unused user management | Yes (always was) +`/api/v1/profiles//change_password./` | `onadata.apps.api.viewsets.user_profile_viewset.UserProfileViewSet` | Unused user management | Yes (always was) +`/faq/` | `onadata.apps.main.views.faq` | Unused informational page | Yes (on kobotoolbox.org) +`/gauthtest/` | `onadata.apps.main.google_export.google_oauth2_request` | Google authentication (non-functional) | No +`/getting_started/` | `onadata.apps.main.views.getting_started` | Unused informational page | Yes (on kobotoolbox.org) +`/gwelcome/` | `onadata.apps.main.google_export.google_auth_return` | Google authentication (non-functional) | No +`/people/` | `onadata.apps.main.views.members_list` | Unused informational page | Yes (on kobotoolbox.org) +`/privacy/` | `onadata.apps.main.views.privacy` | Unused informational page | Yes +`/resources/` | `onadata.apps.main.views.resources` | Unused informational page | Yes (on kobotoolbox.org) +`/support/` | `onadata.apps.main.views.support` | Unused informational page | Yes (on kobotoolbox.org) +`/syntax/` | `onadata.apps.main.views.syntax` | Unused informational page | Yes (on kobotoolbox.org) +`/tos/` | `onadata.apps.main.views.tos` | Unused informational page | Yes +`/tutorial/` | `onadata.apps.main.views.tutorial` | Unused informational page | Yes (on kobotoolbox.org) +`/typeahead_usernames` | `onadata.apps.main.views.username_list` | Username autocompletion for legacy permissions UI (not API endpoint for external use) | No (removed for privacy) +`/xls2xform/` | `onadata.apps.main.views.xls2xform` | Unused informational page | Yes (on kobotoolbox.org) + + # KoBoCAT endpoint removals as of release [2.020.40](https://github.com/kobotoolbox/kobocat/releases/tag/2.020.40) The last release to contain any of the endpoints listed below was https://github.com/kobotoolbox/kobocat/releases/tag/2.020.39. diff --git a/conftest.py b/conftest.py index 6e0fbd711..e3402a72c 100644 --- a/conftest.py +++ b/conftest.py @@ -1,5 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import import os import pytest import sys @@ -20,16 +19,10 @@ 'peter', ] -try: - INTERRUPTED = pytest.ExitCode.INTERRUPTED # pytest 5 -except AttributeError: - INTERRUPTED = 2 - def stderr_prompt(message): sys.stderr.write(message) - # FIXME: Python 3 compatibility - return raw_input().strip() + return input().strip() def toggle_capturing(capture_manager, stop): @@ -63,7 +56,7 @@ def setup(request): if response.lower() != 'yes': if is_global_capturing: toggle_capturing(capture_manager, stop=False) - pytest.exit('User interrupted tests', INTERRUPTED) + pytest.exit('User interrupted tests', pytest.ExitCode.INTERRUPTED) if 'instances' in settings.MONGO_DB.collection_names(): response = stderr_prompt( @@ -77,7 +70,7 @@ def setup(request): else: if is_global_capturing: toggle_capturing(capture_manager, stop=False) - pytest.exit('User interrupted tests', INTERRUPTED) + pytest.exit('User interrupted tests', pytest.ExitCode.INTERRUPTED) if is_global_capturing: toggle_capturing(capture_manager, stop=False) diff --git a/dependencies/pip/dev.in b/dependencies/pip/dev.in new file mode 100644 index 000000000..8bf348510 --- /dev/null +++ b/dependencies/pip/dev.in @@ -0,0 +1,14 @@ +-r requirements.in + +ipdb +ipython +shell_command +Werkzeug +sqlparse +pytest +pytest-django +pytest-env +mongomock +mock +httmock +django-nose diff --git a/dependencies/pip/dev.txt b/dependencies/pip/dev.txt new file mode 100644 index 000000000..d9913d66b --- /dev/null +++ b/dependencies/pip/dev.txt @@ -0,0 +1,358 @@ +# +# This file is autogenerated by pip-compile +# To update, run: +# +# pip-compile dependencies/pip/dev.in +# +-e git+https://github.com/dimagi/django-digest@52ba7edeb326efd97d5670273bb6fa8b0539e501#egg=django_digest + # via -r dependencies/pip/requirements.in +-e git+https://github.com/jnm/django-storages@s3boto3_accurate_tell#egg=django_storages + # via -r dependencies/pip/requirements.in +-e git+https://github.com/dimagi/python-digest@5c94bb74516b977b60180ee832765c0695ff2b56#egg=python_digest + # via -r dependencies/pip/requirements.in +-e git+https://github.com/kobotoolbox/ssrf-protect@755efe16694273ce66060a51e04f973dc034ca4e#egg=ssrf_protect + # via -r dependencies/pip/requirements.in +amqp==2.6.0 + # via + # -r dependencies/pip/requirements.in + # kombu +argparse==1.4.0 + # via unittest2 +attrs==19.3.0 + # via + # jsonschema + # pytest +backcall==0.2.0 + # via ipython +backports.csv==1.0.7 + # via formpack +begins==0.9 + # via formpack +billiard==3.6.3.0 + # via celery +boto3==1.14.44 + # via -r dependencies/pip/requirements.in +botocore==1.17.44 + # via + # boto3 + # s3transfer +celery[redis]==4.4.6 + # via + # -r dependencies/pip/requirements.in + # django-celery-beat +certifi==2020.6.20 + # via + # requests + # sentry-sdk +chardet==3.0.4 + # via requests +cssselect==1.1.0 + # via pyquery +decorator==4.4.2 + # via + # ipython + # traitlets +defusedxml==0.6.0 + # via djangorestframework-xml +dict2xml==1.7.0 + # via -r dependencies/pip/requirements.in +dj-database-url==0.5.0 + # via -r dependencies/pip/requirements.in +django-celery-beat==2.0.0 + # via -r dependencies/pip/requirements.in +django-cors-headers==3.4.0 + # via -r dependencies/pip/requirements.in +django-db-readonly==0.6.0 + # via -r dependencies/pip/requirements.in +django-extensions==3.0.3 + # via -r dependencies/pip/requirements.in +django-filter==2.3.0 + # via -r dependencies/pip/requirements.in +django-guardian==2.3.0 + # via + # -r dependencies/pip/requirements.in + # djangorestframework-guardian +django-nose==1.4.7 + # via -r dependencies/pip/dev.in +django-oauth-toolkit==1.3.2 + # via -r dependencies/pip/requirements.in +django-pure-pagination==0.3.0 + # via -r dependencies/pip/requirements.in +django-redis-sessions==0.6.1 + # via -r dependencies/pip/requirements.in +django-registration-redux==2.8 + # via -r dependencies/pip/requirements.in +django-render-block==0.7 + # via django-templated-email +django-reversion==3.0.1 + # via -r dependencies/pip/requirements.in +django-taggit==1.3.0 + # via -r dependencies/pip/requirements.in +django-templated-email==2.3.0 + # via -r dependencies/pip/requirements.in +django-timezone-field==4.0 + # via + # -r dependencies/pip/requirements.in + # django-celery-beat +django==2.2.14 + # via + # -r dependencies/pip/requirements.in + # django-celery-beat + # django-cors-headers + # django-filter + # django-guardian + # django-oauth-toolkit + # django-render-block + # django-reversion + # django-storages + # django-taggit + # django-timezone-field + # djangorestframework + # djangorestframework-guardian + # jsonfield +djangorestframework-csv==2.1.0 + # via -r dependencies/pip/requirements.in +djangorestframework-guardian==0.3.0 + # via -r dependencies/pip/requirements.in +djangorestframework-jsonp==1.0.2 + # via -r dependencies/pip/requirements.in +djangorestframework-xml==2.0.0 + # via -r dependencies/pip/requirements.in +djangorestframework==3.11.0 + # via + # -r dependencies/pip/requirements.in + # djangorestframework-csv + # djangorestframework-guardian +docutils==0.15.2 + # via + # botocore + # statistics +dpath==2.0.1 + # via -r dependencies/pip/requirements.in +ecdsa==0.15 + # via tlslite-ng +elaphe3==0.2.0 + # via -r dependencies/pip/requirements.in +et-xmlfile==1.0.1 + # via openpyxl +formencode==1.3.1 + # via pyxform +git+https://github.com/kobotoolbox/formpack.git@52f77e3519fd1079ce3451f9a5c7c27002e9f3f0#egg=formpack + # via -r dependencies/pip/requirements.in +future==0.18.2 + # via celery +gdata-python3==3.0.1 + # via -r dependencies/pip/requirements.in +geojson-rewind==0.2.0 + # via formpack +gitdb==4.0.5 + # via gitpython +gitpython==3.1.7 + # via transifex-client +httmock==1.3.0 + # via -r dependencies/pip/dev.in +idna==2.10 + # via requests +ipdb==0.13.3 + # via -r dependencies/pip/dev.in +ipython-genutils==0.2.0 + # via traitlets +ipython==7.16.1 + # via + # -r dependencies/pip/dev.in + # ipdb +jdcal==1.4.1 + # via openpyxl +jedi==0.17.2 + # via ipython +jmespath==0.10.0 + # via + # boto3 + # botocore +jsonfield==3.1.0 + # via -r dependencies/pip/requirements.in +jsonschema==3.2.0 + # via formpack +kombu==4.6.11 + # via celery +linecache2==1.0.0 + # via traceback2 +lxml==4.5.2 + # via + # -r dependencies/pip/requirements.in + # formpack + # gdata-python3 + # pyquery +markdown==3.2.2 + # via -r dependencies/pip/requirements.in +mock==4.0.2 + # via -r dependencies/pip/dev.in +modilabs-python-utils==0.1.5 + # via -r dependencies/pip/requirements.in +mongomock==3.19.0 + # via -r dependencies/pip/dev.in +more-itertools==8.4.0 + # via pytest +nose==1.3.7 + # via django-nose +numpy==1.19.0 + # via pandas +oauthlib==3.1.0 + # via django-oauth-toolkit +openpyxl==3.0.4 + # via -r dependencies/pip/requirements.in +packaging==20.4 + # via pytest +pandas==1.0.5 + # via -r dependencies/pip/requirements.in +parso==0.7.0 + # via jedi +path.py==12.4.0 + # via formpack +path==13.1.0 + # via path.py +pexpect==4.8.0 + # via ipython +pickleshare==0.7.5 + # via ipython +pillow==7.2.0 + # via + # -r dependencies/pip/requirements.in + # elaphe3 +pluggy==0.13.1 + # via pytest +prompt-toolkit==3.0.5 + # via ipython +psycopg2-binary==2.8.5 + # via -r dependencies/pip/requirements.in +ptyprocess==0.6.0 + # via pexpect +py==1.9.0 + # via pytest +pygments==2.6.1 + # via ipython +pymongo==3.10.1 + # via -r dependencies/pip/requirements.in +pyparsing==2.4.7 + # via packaging +pyquery==1.4.1 + # via formpack +pyrsistent==0.16.0 + # via jsonschema +pytest-django==3.9.0 + # via -r dependencies/pip/dev.in +pytest-env==0.6.2 + # via -r dependencies/pip/dev.in +pytest==5.4.3 + # via + # -r dependencies/pip/dev.in + # pytest-django + # pytest-env +python-crontab==2.5.1 + # via django-celery-beat +python-dateutil==2.8.1 + # via + # botocore + # pandas + # python-crontab +python-slugify==4.0.1 + # via transifex-client +pytz==2020.1 + # via + # -r dependencies/pip/requirements.in + # celery + # django + # django-timezone-field + # pandas +pyxform==1.5.1 + # via + # -r dependencies/pip/requirements.in + # formpack +redis==3.5.3 + # via + # -r dependencies/pip/requirements.in + # celery + # django-redis-sessions +requests==2.24.0 + # via + # django-oauth-toolkit + # httmock + # transifex-client +s3transfer==0.3.3 + # via boto3 +https://bitbucket.org/fomcl/savreaderwriter/downloads/savReaderWriter-3.3.0.zip#egg=savreaderwriter + # via -r dependencies/pip/requirements.in +sentinels==1.0.0 + # via mongomock +sentry-sdk==0.16.5 + # via -r dependencies/pip/requirements.in +shell-command==0.1 + # via -r dependencies/pip/dev.in +simplejson==3.17.2 + # via -r dependencies/pip/requirements.in +six==1.15.0 + # via + # django-extensions + # django-templated-email + # djangorestframework-csv + # ecdsa + # jsonschema + # mongomock + # packaging + # pyrsistent + # python-dateutil + # ssrf-protect + # traitlets + # transifex-client + # unittest2 +smmap==3.0.4 + # via gitdb +sqlparse==0.3.1 + # via + # -r dependencies/pip/dev.in + # django +statistics==1.0.3.5 + # via formpack +text-unidecode==1.3 + # via python-slugify +tlslite-ng==0.7.5 + # via gdata-python3 +traceback2==1.4.0 + # via unittest2 +traitlets==4.3.3 + # via ipython +transifex-client==0.13.11 + # via -r dependencies/pip/requirements.in +unicodecsv==0.14.1 + # via + # djangorestframework-csv + # pyxform +unittest2==1.1.0 + # via pyxform +urllib3==1.25.9 + # via + # botocore + # requests + # sentry-sdk + # transifex-client +vine==1.3.0 + # via + # amqp + # celery +wcwidth==0.2.5 + # via + # prompt-toolkit + # pytest +werkzeug==1.0.1 + # via -r dependencies/pip/dev.in +xlrd==1.2.0 + # via + # -r dependencies/pip/requirements.in + # pyxform +xlsxwriter==1.2.9 + # via formpack +xlwt==1.3.0 + # via -r dependencies/pip/requirements.in + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/dependencies/pip/prod.in b/dependencies/pip/prod.in new file mode 100644 index 000000000..bd6f83b94 --- /dev/null +++ b/dependencies/pip/prod.in @@ -0,0 +1,3 @@ +-r requirements.in + +uWSGI diff --git a/dependencies/pip/prod.txt b/dependencies/pip/prod.txt new file mode 100644 index 000000000..2ac0260ab --- /dev/null +++ b/dependencies/pip/prod.txt @@ -0,0 +1,283 @@ +# +# This file is autogenerated by pip-compile +# To update, run: +# +# pip-compile dependencies/pip/prod.in +# +-e git+https://github.com/dimagi/django-digest@52ba7edeb326efd97d5670273bb6fa8b0539e501#egg=django_digest + # via -r dependencies/pip/requirements.in +-e git+https://github.com/jnm/django-storages@s3boto3_accurate_tell#egg=django_storages + # via -r dependencies/pip/requirements.in +-e git+https://github.com/dimagi/python-digest@5c94bb74516b977b60180ee832765c0695ff2b56#egg=python_digest + # via -r dependencies/pip/requirements.in +-e git+https://github.com/kobotoolbox/ssrf-protect@755efe16694273ce66060a51e04f973dc034ca4e#egg=ssrf_protect + # via -r dependencies/pip/requirements.in +amqp==2.6.0 + # via + # -r dependencies/pip/requirements.in + # kombu +argparse==1.4.0 + # via unittest2 +attrs==19.3.0 + # via jsonschema +backports.csv==1.0.7 + # via formpack +begins==0.9 + # via formpack +billiard==3.6.3.0 + # via celery +boto3==1.14.44 + # via -r dependencies/pip/requirements.in +botocore==1.17.44 + # via + # boto3 + # s3transfer +celery[redis]==4.4.6 + # via + # -r dependencies/pip/requirements.in + # django-celery-beat +certifi==2020.6.20 + # via + # requests + # sentry-sdk +chardet==3.0.4 + # via requests +cssselect==1.1.0 + # via pyquery +defusedxml==0.6.0 + # via djangorestframework-xml +dict2xml==1.7.0 + # via -r dependencies/pip/requirements.in +dj-database-url==0.5.0 + # via -r dependencies/pip/requirements.in +django-celery-beat==2.0.0 + # via -r dependencies/pip/requirements.in +django-cors-headers==3.4.0 + # via -r dependencies/pip/requirements.in +django-db-readonly==0.6.0 + # via -r dependencies/pip/requirements.in +django-extensions==3.0.3 + # via -r dependencies/pip/requirements.in +django-filter==2.3.0 + # via -r dependencies/pip/requirements.in +django-guardian==2.3.0 + # via + # -r dependencies/pip/requirements.in + # djangorestframework-guardian +django-oauth-toolkit==1.3.2 + # via -r dependencies/pip/requirements.in +django-pure-pagination==0.3.0 + # via -r dependencies/pip/requirements.in +django-redis-sessions==0.6.1 + # via -r dependencies/pip/requirements.in +django-registration-redux==2.8 + # via -r dependencies/pip/requirements.in +django-render-block==0.7 + # via django-templated-email +django-reversion==3.0.1 + # via -r dependencies/pip/requirements.in +django-taggit==1.3.0 + # via -r dependencies/pip/requirements.in +django-templated-email==2.3.0 + # via -r dependencies/pip/requirements.in +django-timezone-field==4.0 + # via + # -r dependencies/pip/requirements.in + # django-celery-beat +django==2.2.14 + # via + # -r dependencies/pip/requirements.in + # django-celery-beat + # django-cors-headers + # django-filter + # django-guardian + # django-oauth-toolkit + # django-render-block + # django-reversion + # django-storages + # django-taggit + # django-timezone-field + # djangorestframework + # djangorestframework-guardian + # jsonfield +djangorestframework-csv==2.1.0 + # via -r dependencies/pip/requirements.in +djangorestframework-guardian==0.3.0 + # via -r dependencies/pip/requirements.in +djangorestframework-jsonp==1.0.2 + # via -r dependencies/pip/requirements.in +djangorestframework-xml==2.0.0 + # via -r dependencies/pip/requirements.in +djangorestframework==3.11.0 + # via + # -r dependencies/pip/requirements.in + # djangorestframework-csv + # djangorestframework-guardian +docutils==0.15.2 + # via + # botocore + # statistics +dpath==2.0.1 + # via -r dependencies/pip/requirements.in +ecdsa==0.15 + # via tlslite-ng +elaphe3==0.2.0 + # via -r dependencies/pip/requirements.in +et-xmlfile==1.0.1 + # via openpyxl +formencode==1.3.1 + # via pyxform +git+https://github.com/kobotoolbox/formpack.git@52f77e3519fd1079ce3451f9a5c7c27002e9f3f0#egg=formpack + # via -r dependencies/pip/requirements.in +future==0.18.2 + # via celery +gdata-python3==3.0.1 + # via -r dependencies/pip/requirements.in +geojson-rewind==0.2.0 + # via formpack +gitdb==4.0.5 + # via gitpython +gitpython==3.1.7 + # via transifex-client +idna==2.10 + # via requests +jdcal==1.4.1 + # via openpyxl +jmespath==0.10.0 + # via + # boto3 + # botocore +jsonfield==3.1.0 + # via -r dependencies/pip/requirements.in +jsonschema==3.2.0 + # via formpack +kombu==4.6.11 + # via celery +linecache2==1.0.0 + # via traceback2 +lxml==4.5.2 + # via + # -r dependencies/pip/requirements.in + # formpack + # gdata-python3 + # pyquery +markdown==3.2.2 + # via -r dependencies/pip/requirements.in +modilabs-python-utils==0.1.5 + # via -r dependencies/pip/requirements.in +numpy==1.19.0 + # via pandas +oauthlib==3.1.0 + # via django-oauth-toolkit +openpyxl==3.0.4 + # via -r dependencies/pip/requirements.in +pandas==1.0.5 + # via -r dependencies/pip/requirements.in +path.py==12.5.0 + # via formpack +path==15.0.0 + # via path.py +pillow==7.2.0 + # via + # -r dependencies/pip/requirements.in + # elaphe3 +psycopg2-binary==2.8.5 + # via -r dependencies/pip/requirements.in +pymongo==3.10.1 + # via -r dependencies/pip/requirements.in +pyquery==1.4.1 + # via formpack +pyrsistent==0.16.0 + # via jsonschema +python-crontab==2.5.1 + # via django-celery-beat +python-dateutil==2.8.1 + # via + # botocore + # pandas + # python-crontab +python-slugify==4.0.1 + # via transifex-client +pytz==2020.1 + # via + # -r dependencies/pip/requirements.in + # celery + # django + # django-timezone-field + # pandas +pyxform==1.5.1 + # via + # -r dependencies/pip/requirements.in + # formpack +redis==3.5.3 + # via + # -r dependencies/pip/requirements.in + # celery + # django-redis-sessions +requests==2.24.0 + # via + # django-oauth-toolkit + # transifex-client +s3transfer==0.3.3 + # via boto3 +https://bitbucket.org/fomcl/savreaderwriter/downloads/savReaderWriter-3.3.0.zip#egg=savreaderwriter + # via -r dependencies/pip/requirements.in +sentry-sdk==0.16.5 + # via -r dependencies/pip/requirements.in +simplejson==3.17.2 + # via -r dependencies/pip/requirements.in +six==1.15.0 + # via + # django-extensions + # django-templated-email + # djangorestframework-csv + # ecdsa + # jsonschema + # pyrsistent + # python-dateutil + # ssrf-protect + # transifex-client + # unittest2 +smmap==3.0.4 + # via gitdb +sqlparse==0.3.1 + # via django +statistics==1.0.3.5 + # via formpack +text-unidecode==1.3 + # via python-slugify +tlslite-ng==0.7.5 + # via gdata-python3 +traceback2==1.4.0 + # via unittest2 +transifex-client==0.13.11 + # via -r dependencies/pip/requirements.in +unicodecsv==0.14.1 + # via + # djangorestframework-csv + # pyxform +unittest2==1.1.0 + # via pyxform +urllib3==1.25.9 + # via + # botocore + # requests + # sentry-sdk + # transifex-client +uwsgi==2.0.19.1 + # via -r dependencies/pip/prod.in +vine==1.3.0 + # via + # amqp + # celery +xlrd==1.2.0 + # via + # -r dependencies/pip/requirements.in + # pyxform +xlsxwriter==1.2.9 + # via formpack +xlwt==1.3.0 + # via -r dependencies/pip/requirements.in + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/requirements/py3.pip b/dependencies/pip/requirements.in similarity index 62% rename from requirements/py3.pip rename to dependencies/pip/requirements.in index c79012012..f1e4691ea 100644 --- a/requirements/py3.pip +++ b/dependencies/pip/requirements.in @@ -1,14 +1,36 @@ +# File for use with `pip-compile`; see https://github.com/nvie/pip-tools +# https://github.com/bndr/pipreqs is a handy utility, too. + +# More up-to-date version of django-digest than PyPI seems to have. +# Also, python-digest is an unlisted dependency thereof. +-e git+https://github.com/dimagi/python-digest@5c94bb74516b977b60180ee832765c0695ff2b56#egg=python_digest +-e git+https://github.com/dimagi/django-digest@52ba7edeb326efd97d5670273bb6fa8b0539e501#egg=django_digest + +# formpack exports +# ToDo Remove when `kobokitten-remove-ui-CUD-actions-unicode is merged. +git+https://github.com/kobotoolbox/formpack.git@52f77e3519fd1079ce3451f9a5c7c27002e9f3f0#egg=formpack + +# spss +https://bitbucket.org/fomcl/savreaderwriter/downloads/savReaderWriter-3.3.0.zip#egg=savreaderwriter + +# ssrf +-e git+https://github.com/kobotoolbox/ssrf-protect@755efe16694273ce66060a51e04f973dc034ca4e#egg=ssrf_protect + +# jnm's django storages +# Necessary to use this fork until the resolution of +# https://github.com/jschneier/django-storages/issues/566 +-e git+https://github.com/jnm/django-storages@s3boto3_accurate_tell#egg=django_storages + +# Regular PyPI packages pytz -Django>=2.2,<3 +Django>=2,<3 dj-database-url -django-guardian django-registration-redux django-templated-email -gdata -httplib2 +dpath +gdata-python3 modilabs-python-utils Pillow -# poster psycopg2-binary pymongo lxml @@ -17,32 +39,17 @@ django-reversion<3.0.2 xlrd xlwt openpyxl - celery>=4.0,<5.0 celery[redis] -django-celery-beat -# amqp -# vine==1.2.0 -django-nose -raven - -# More up-to-date version of django-digest than PyPI seems to have. -# Also, python-digest is an unlisted dependency thereof. --e git+https://github.com/dimagi/python-digest@5c94bb74516b977b60180ee832765c0695ff2b56#egg=python_digest --e git+https://github.com/dimagi/django-digest@52ba7edeb326efd97d5670273bb6fa8b0539e501#egg=django_digest - +amqp # new export code relies on pandas>=0.12.0 -elaphe -# request +elaphe3 -# formpack exports -git+https://github.com/kobotoolbox/formpack.git@a08b7626507c2ceff35b816f1e1e0845c85cce26#egg=formpack django-pure-pagination -path.py # sms support -# dict2xml==1.3 +dict2xml # api support djangorestframework @@ -55,22 +62,11 @@ django-cors-headers Markdown django-filter -# captcha -recaptcha-client==1.0.6 -# unicodecsv==0.9.4 -dpath - # tagging django-taggit -# oath2 support -django-oauth-toolkit - -# spss -https://bitbucket.org/fomcl/savreaderwriter/downloads/savReaderWriter-3.3.0.zip#egg=savreaderwriter - # JSON data type support -# jsonfield<1.0 +jsonfield django-db-readonly transifex-client @@ -82,5 +78,18 @@ django-extensions django-redis-sessions redis -# ssrf --e git+https://github.com/kobotoolbox/ssrf-protect@755efe16694273ce66060a51e04f973dc034ca4e#egg=ssrf_protect +# Compatibility Django 2.2 +django-guardian +django-timezone-field +django-celery-beat +django-oauth-toolkit + +# Added packages +simplejson +djangorestframework-guardian + +# Django Storage AWS +boto3 + +# Sentry +sentry-sdk diff --git a/dependencies/pip/requirements.txt b/dependencies/pip/requirements.txt new file mode 100644 index 000000000..745f4ba93 --- /dev/null +++ b/dependencies/pip/requirements.txt @@ -0,0 +1,281 @@ +# +# This file is autogenerated by pip-compile +# To update, run: +# +# pip-compile dependencies/pip/requirements.in +# +-e git+https://github.com/dimagi/django-digest@52ba7edeb326efd97d5670273bb6fa8b0539e501#egg=django_digest + # via -r dependencies/pip/requirements.in +-e git+https://github.com/jnm/django-storages@s3boto3_accurate_tell#egg=django_storages + # via -r dependencies/pip/requirements.in +-e git+https://github.com/dimagi/python-digest@5c94bb74516b977b60180ee832765c0695ff2b56#egg=python_digest + # via -r dependencies/pip/requirements.in +-e git+https://github.com/kobotoolbox/ssrf-protect@755efe16694273ce66060a51e04f973dc034ca4e#egg=ssrf_protect + # via -r dependencies/pip/requirements.in +amqp==2.6.0 + # via + # -r dependencies/pip/requirements.in + # kombu +argparse==1.4.0 + # via unittest2 +attrs==19.3.0 + # via jsonschema +backports.csv==1.0.7 + # via formpack +begins==0.9 + # via formpack +billiard==3.6.3.0 + # via celery +boto3==1.14.44 + # via -r dependencies/pip/requirements.in +botocore==1.17.44 + # via + # boto3 + # s3transfer +celery[redis]==4.4.6 + # via + # -r dependencies/pip/requirements.in + # django-celery-beat +certifi==2020.6.20 + # via + # requests + # sentry-sdk +chardet==3.0.4 + # via requests +cssselect==1.1.0 + # via pyquery +defusedxml==0.6.0 + # via djangorestframework-xml +dict2xml==1.7.0 + # via -r dependencies/pip/requirements.in +dj-database-url==0.5.0 + # via -r dependencies/pip/requirements.in +django-celery-beat==2.0.0 + # via -r dependencies/pip/requirements.in +django-cors-headers==3.4.0 + # via -r dependencies/pip/requirements.in +django-db-readonly==0.6.0 + # via -r dependencies/pip/requirements.in +django-extensions==3.0.3 + # via -r dependencies/pip/requirements.in +django-filter==2.3.0 + # via -r dependencies/pip/requirements.in +django-guardian==2.3.0 + # via + # -r dependencies/pip/requirements.in + # djangorestframework-guardian +django-oauth-toolkit==1.3.2 + # via -r dependencies/pip/requirements.in +django-pure-pagination==0.3.0 + # via -r dependencies/pip/requirements.in +django-redis-sessions==0.6.1 + # via -r dependencies/pip/requirements.in +django-registration-redux==2.8 + # via -r dependencies/pip/requirements.in +django-render-block==0.7 + # via django-templated-email +django-reversion==3.0.1 + # via -r dependencies/pip/requirements.in +django-taggit==1.3.0 + # via -r dependencies/pip/requirements.in +django-templated-email==2.3.0 + # via -r dependencies/pip/requirements.in +django-timezone-field==4.0 + # via + # -r dependencies/pip/requirements.in + # django-celery-beat +django==2.2.14 + # via + # -r dependencies/pip/requirements.in + # django-celery-beat + # django-cors-headers + # django-filter + # django-guardian + # django-oauth-toolkit + # django-render-block + # django-reversion + # django-storages + # django-taggit + # django-timezone-field + # djangorestframework + # djangorestframework-guardian + # jsonfield +djangorestframework-csv==2.1.0 + # via -r dependencies/pip/requirements.in +djangorestframework-guardian==0.3.0 + # via -r dependencies/pip/requirements.in +djangorestframework-jsonp==1.0.2 + # via -r dependencies/pip/requirements.in +djangorestframework-xml==2.0.0 + # via -r dependencies/pip/requirements.in +djangorestframework==3.11.0 + # via + # -r dependencies/pip/requirements.in + # djangorestframework-csv + # djangorestframework-guardian +docutils==0.15.2 + # via + # botocore + # statistics +dpath==2.0.1 + # via -r dependencies/pip/requirements.in +ecdsa==0.15 + # via tlslite-ng +elaphe3==0.2.0 + # via -r dependencies/pip/requirements.in +et-xmlfile==1.0.1 + # via openpyxl +formencode==1.3.1 + # via pyxform +git+https://github.com/kobotoolbox/formpack.git@52f77e3519fd1079ce3451f9a5c7c27002e9f3f0#egg=formpack + # via -r dependencies/pip/requirements.in +future==0.18.2 + # via celery +gdata-python3==3.0.1 + # via -r dependencies/pip/requirements.in +geojson-rewind==0.2.0 + # via formpack +gitdb==4.0.5 + # via gitpython +gitpython==3.1.7 + # via transifex-client +idna==2.10 + # via requests +jdcal==1.4.1 + # via openpyxl +jmespath==0.10.0 + # via + # boto3 + # botocore +jsonfield==3.1.0 + # via -r dependencies/pip/requirements.in +jsonschema==3.2.0 + # via formpack +kombu==4.6.11 + # via celery +linecache2==1.0.0 + # via traceback2 +lxml==4.5.2 + # via + # -r dependencies/pip/requirements.in + # formpack + # gdata-python3 + # pyquery +markdown==3.2.2 + # via -r dependencies/pip/requirements.in +modilabs-python-utils==0.1.5 + # via -r dependencies/pip/requirements.in +numpy==1.19.0 + # via pandas +oauthlib==3.1.0 + # via django-oauth-toolkit +openpyxl==3.0.4 + # via -r dependencies/pip/requirements.in +pandas==1.0.5 + # via -r dependencies/pip/requirements.in +path.py==12.4.0 + # via formpack +path==13.1.0 + # via path.py +pillow==7.2.0 + # via + # -r dependencies/pip/requirements.in + # elaphe3 +psycopg2-binary==2.8.5 + # via -r dependencies/pip/requirements.in +pymongo==3.10.1 + # via -r dependencies/pip/requirements.in +pyquery==1.4.1 + # via formpack +pyrsistent==0.16.0 + # via jsonschema +python-crontab==2.5.1 + # via django-celery-beat +python-dateutil==2.8.1 + # via + # botocore + # pandas + # python-crontab +python-slugify==4.0.1 + # via transifex-client +pytz==2020.1 + # via + # -r dependencies/pip/requirements.in + # celery + # django + # django-timezone-field + # pandas +pyxform==1.5.1 + # via + # -r dependencies/pip/requirements.in + # formpack +redis==3.5.3 + # via + # -r dependencies/pip/requirements.in + # celery + # django-redis-sessions +requests==2.24.0 + # via + # django-oauth-toolkit + # transifex-client +s3transfer==0.3.3 + # via boto3 +https://bitbucket.org/fomcl/savreaderwriter/downloads/savReaderWriter-3.3.0.zip#egg=savreaderwriter + # via -r dependencies/pip/requirements.in +sentry-sdk==0.16.5 + # via -r dependencies/pip/requirements.in +simplejson==3.17.2 + # via -r dependencies/pip/requirements.in +six==1.15.0 + # via + # django-extensions + # django-templated-email + # djangorestframework-csv + # ecdsa + # jsonschema + # pyrsistent + # python-dateutil + # ssrf-protect + # transifex-client + # unittest2 +smmap==3.0.4 + # via gitdb +sqlparse==0.3.1 + # via django +statistics==1.0.3.5 + # via formpack +text-unidecode==1.3 + # via python-slugify +tlslite-ng==0.7.5 + # via gdata-python3 +traceback2==1.4.0 + # via unittest2 +transifex-client==0.13.11 + # via -r dependencies/pip/requirements.in +unicodecsv==0.14.1 + # via + # djangorestframework-csv + # pyxform +unittest2==1.1.0 + # via pyxform +urllib3==1.25.9 + # via + # botocore + # requests + # sentry-sdk + # transifex-client +vine==1.3.0 + # via + # amqp + # celery +xlrd==1.2.0 + # via + # -r dependencies/pip/requirements.in + # pyxform +xlsxwriter==1.2.9 + # via formpack +xlwt==1.3.0 + # via -r dependencies/pip/requirements.in + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/docker/dev_wrong_port_warning.py b/docker/dev_wrong_port_warning.py index 5403c72f8..5c083a613 100755 --- a/docker/dev_wrong_port_warning.py +++ b/docker/dev_wrong_port_warning.py @@ -5,20 +5,22 @@ provides a helpful message to anyone still trying to use port 8000 """ -import BaseHTTPServer import sys +from http.server import BaseHTTPRequestHandler, HTTPServer -class Handler(BaseHTTPServer.BaseHTTPRequestHandler): + +class Handler(BaseHTTPRequestHandler): def do_GET(self): self.send_response(503) self.end_headers() self.wfile.write( - 'Your development environment is trying to connect to the KoBoCAT ' - 'container on port 8000 instead of 8001. Please change this. See ' - 'https://github.com/kobotoolbox/kobo-docker/issues/301 ' - 'for more details.' + b'Your development environment is trying to connect to the KoBoCAT ' + b'container on port 8000 instead of 8001. Please change this. See ' + b'https://github.com/kobotoolbox/kobo-docker/issues/301 ' + b'for more details.' ) + server_address = ('', int(sys.argv[1])) -httpd = BaseHTTPServer.HTTPServer(server_address, Handler) +httpd = HTTPServer(server_address, Handler) httpd.serve_forever() diff --git a/docker/init.bash b/docker/init.bash index ff934fac2..0b635530c 100755 --- a/docker/init.bash +++ b/docker/init.bash @@ -5,35 +5,29 @@ source /etc/profile echo 'KoBoCAT intializing...' -oldpwd=$(pwd) cd "${KOBOCAT_SRC_DIR}" -echo 'Synchronizing database.' -python manage.py syncdb --noinput - -echo 'Running migrations.' -python manage.py migrate --noinput +if [[ -z $DATABASE_URL ]]; then + echo "DATABASE_URL must be configured to run this server" + echo "example: 'DATABASE_URL=postgres://hostname:5432/dbname'" + exit 1 +fi +# Wait for databases to be up & running before going further +/bin/bash "${INIT_PATH}/wait_for_mongo.bash" +/bin/bash "${INIT_PATH}/wait_for_postgres.bash" -rm -f /etc/cron.d/clean_up_tmp -cp docker/cron/clean_up_tmp /etc/cron.d/ -echo 'KoBoCat tmp clean-up cron installed' +echo 'Running migrations...' +gosu "${UWSGI_USER}" python manage.py migrate --noinput -rm -f /etc/cron.d/backup_media_crontab -if [[ -z "${KOBOCAT_MEDIA_BACKUP_SCHEDULE}" ]]; then - echo 'KoBoCAT media automatic backups disabled.' -else - # Should we first validate the schedule e.g. with `chkcrontab`? - cat "${KOBOCAT_SRC_DIR}/docker/backup_media_crontab.envsubst" | envsubst > /etc/cron.d/backup_media_crontab - echo "KoBoCAT media automatic backup schedule: ${KOBOCAT_MEDIA_BACKUP_SCHEDULE}" -fi +echo 'Setting up cron tasks...' +/bin/bash "${KOBOCAT_SRC_DIR}/docker/setup_cron.bash" +/bin/bash "${KOBOCAT_SRC_DIR}/docker/setup_pydev_debugger.bash" +/bin/bash "${KOBOCAT_SRC_DIR}/docker/sync_static.bash" -rm -rf /etc/profile.d/pydev_debugger.bash.sh -if [[ -d /srv/pydev_orig && ! -z "${KOBOCAT_PATH_FROM_ECLIPSE_TO_PYTHON_PAIRS}" ]]; then - echo 'Enabling PyDev remote debugging.' - "${KOBOCAT_SRC_DIR}/docker/setup_pydev.bash" -fi +echo 'Cleaning up Celery PIDs...' +rm -rf ${CELERY_PID_DIR}/*.pid echo 'KoBoCAT initialization complete.' -cd $oldpwd +exec /usr/bin/runsvdir "${SERVICES_DIR}" diff --git a/docker/restore_permissions.bash b/docker/restore_permissions.bash new file mode 100755 index 000000000..68c507c1f --- /dev/null +++ b/docker/restore_permissions.bash @@ -0,0 +1,7 @@ +#!/bin/bash +set -e +source /etc/profile + +echo "Restoring permissions for \`backup\` and \`log\` folders..." +chown -R "${UWSGI_USER}":"${UWSGI_USER}" "${BACKUPS_DIR}" +chown -R "${UWSGI_USER}":"${UWSGI_USER}" "${KOBOCAT_LOGS_DIR}" diff --git a/docker/run_celery.bash b/docker/run_celery.bash index d043a82a9..f5af0deef 100755 --- a/docker/run_celery.bash +++ b/docker/run_celery.bash @@ -4,7 +4,9 @@ source /etc/profile # Run the main Celery worker cd "${KOBOCAT_SRC_DIR}" -exec /sbin/setuser "${UWSGI_USER}" celery worker -A onadata -Ofair --loglevel=info \ +exec celery worker -A onadata -Ofair --loglevel=info \ --hostname=kobocat_main_worker@%h \ --logfile=${KOBOCAT_LOGS_DIR}/celery.log \ - --pidfile=/tmp/celery.pid + --pidfile=${CELERY_PID_DIR}/celery.pid \ + --uid=${UWSGI_USER} \ + --gid=${UWSGI_GROUP} diff --git a/docker/run_celery_beat.bash b/docker/run_celery_beat.bash index e777dff6c..faf270444 100755 --- a/docker/run_celery_beat.bash +++ b/docker/run_celery_beat.bash @@ -4,7 +4,9 @@ source /etc/profile # Run the main Celery beat worker cd "${KOBOCAT_SRC_DIR}" -exec /sbin/setuser "${UWSGI_USER}" celery beat -A onadata --loglevel=info \ +exec celery beat -A onadata --loglevel=info \ --logfile=${KOBOCAT_LOGS_DIR}/celery_beat.log \ - --pidfile=/tmp/celery_beat.pid \ - --scheduler django_celery_beat.schedulers:DatabaseScheduler + --pidfile=${CELERY_PID_DIR}/celery_beat.pid \ + --scheduler django_celery_beat.schedulers:DatabaseScheduler \ + --uid=${UWSGI_USER} \ + --gid=${UWSGI_GROUP} diff --git a/docker/run_tests.bash b/docker/run_tests.bash deleted file mode 100755 index 3fcce8c02..000000000 --- a/docker/run_tests.bash +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -set -e -source /etc/profile - -echo "print('Django shell loaded successfully.')" | python manage.py shell diff --git a/docker/run_uwsgi.bash b/docker/run_uwsgi.bash index 3ed7ee7ee..68ea70aa2 100755 --- a/docker/run_uwsgi.bash +++ b/docker/run_uwsgi.bash @@ -1,22 +1,50 @@ #!/usr/bin/env bash -set -e source /etc/profile - if [[ "$(stat -c '%U' ${KOBOCAT_LOGS_DIR})" != "${UWSGI_USER}" ]]; then echo 'Restoring ownership of Logs directory.' - chown -R "${UWSGI_USER}" "${KOBOCAT_LOGS_DIR}" + chown -R "${UWSGI_USER}":"${UWSGI_GROUP}" "${KOBOCAT_LOGS_DIR}" fi KOBOCAT_WEB_SERVER="${KOBOCAT_WEB_SERVER:-uWSGI}" -uwsgi_command="/sbin/setuser ${UWSGI_USER} /usr/local/bin/uwsgi --ini ${KOBOCAT_SRC_DIR}/docker/kobocat.ini" + if [[ "${KOBOCAT_WEB_SERVER,,}" == "uwsgi" ]]; then - echo 'Running `kobocat` container with uWSGI application server.' - exec ${uwsgi_command} + cd "${KOBOCAT_SRC_DIR}" + DIFF=$(diff "${KOBOCAT_SRC_DIR}/dependencies/pip/prod.txt" "${TMP_DIR}/pip_dependencies.txt") + if [[ -n "$DIFF" ]]; then + # Celery services need to be stopped to avoid raising errors + # during pip-sync + echo "Stopping Celery services..." + sv stop celery + sv stop celery_beat + echo "Syncing pip dependencies..." + pip-sync dependencies/pip/prod.txt 1>/dev/null + cp "dependencies/pip/prod.txt" "${TMP_DIR}/pip_dependencies.txt" + echo "Restarting Celery..." + sv start celery + sv start celery_beat + fi + echo "Running \`KoBoCAT\` container with uWSGI application server." + UWSGI_COMMAND="$(command -v uwsgi) --ini ${KOBOCAT_SRC_DIR}/docker/kobocat.ini" else - echo 'Running `kobocat` container with `runserver_plus` debugging application server.' cd "${KOBOCAT_SRC_DIR}" - pip install werkzeug==0.16.0 ipython - exec python manage.py runserver_plus 0:8001 + DIFF=$(diff "${KOBOCAT_SRC_DIR}/dependencies/pip/dev.txt" "${TMP_DIR}/pip_dependencies.txt") + if [[ -n "$DIFF" ]]; then + # Celery services need to be stopped to avoid raising errors during + # pip-sync + echo "Stopping Celery services..." + sv stop celery + sv stop celery_beat + echo "Syncing pip dependencies..." + gosu "${UWSGI_USER}" pip-sync dependencies/pip/dev.txt 1>/dev/null + cp "dependencies/pip/dev.txt" "${TMP_DIR}/pip_dependencies.txt" + echo "Restarting Celery..." + sv start celery + sv start celery_beat + fi + + echo "Running KoBoCAT container with \`runserver_plus\` debugging application server." + UWSGI_COMMAND="gosu $UWSGI_USER python manage.py runserver_plus 0:8001" fi +exec ${UWSGI_COMMAND} diff --git a/docker/run_uwsgi_wrong_port_warning.bash b/docker/run_uwsgi_wrong_port_warning.bash index ec8daca7d..61bae4375 100755 --- a/docker/run_uwsgi_wrong_port_warning.bash +++ b/docker/run_uwsgi_wrong_port_warning.bash @@ -5,10 +5,9 @@ source /etc/profile # Per kobotoolbox/kobo-docker#301, we have changed the uWSGI port to 8001. This # provides a helpful message to anyone still trying to use port 8000 - if [[ "${KOBOCAT_WEB_SERVER,,}" == "uwsgi" ]] then - exec /usr/local/bin/uwsgi --uid "${UWSGI_USER}" --socket :8000 --wsgi-file "${KOBOCAT_SRC_DIR}/docker/wrong_port_warning.wsgi" + exec $(command -v uwsgi) --uid "${UWSGI_USER}" --gid "${UWSGI_GROUP}" --socket :8000 --wsgi-file "${KOBOCAT_SRC_DIR}/docker/wrong_port_warning.wsgi" else - exec "${KOBOCAT_SRC_DIR}/docker/dev_wrong_port_warning.py" 8000 + exec gosu "${UWSGI_USER}" "${KOBOCAT_SRC_DIR}/docker/dev_wrong_port_warning.py" 8000 fi diff --git a/docker/setup_cron.bash b/docker/setup_cron.bash new file mode 100755 index 000000000..9ad6556fb --- /dev/null +++ b/docker/setup_cron.bash @@ -0,0 +1,15 @@ +#!/bin/bash +set -e + +rm -f /etc/cron.d/clean_up_tmp +cp docker/cron/clean_up_tmp /etc/cron.d/ +echo 'KoBoCAT tmp clean-up cron installed' + +rm -f /etc/cron.d/backup_media_crontab +if [[ -z "${KOBOCAT_MEDIA_BACKUP_SCHEDULE}" ]]; then + echo 'KoBoCAT media automatic backups disabled.' +else + # Should we first validate the schedule e.g. with `chkcrontab`? + cat "${KOBOCAT_SRC_DIR}/docker/backup_media_crontab.envsubst" | envsubst > /etc/cron.d/backup_media_crontab + echo "KoBoCAT media automatic backup schedule: ${KOBOCAT_MEDIA_BACKUP_SCHEDULE}" +fi diff --git a/docker/setup_pydev_debugger.bash b/docker/setup_pydev_debugger.bash new file mode 100755 index 000000000..c8f7dfc50 --- /dev/null +++ b/docker/setup_pydev_debugger.bash @@ -0,0 +1,9 @@ +#!/bin/bash +set -e + +# Keep it as is, not tested with Python3 +rm -rf /etc/profile.d/pydev_debugger.bash.sh +if [[ -d /srv/pydev_orig && -n "${KOBOCAT_PATH_FROM_ECLIPSE_TO_PYTHON_PAIRS}" ]]; then + echo 'Enabling PyDev remote debugging.' + "${KOBOCAT_SRC_DIR}/docker/setup_pydev.bash" +fi diff --git a/docker/sync_static.sh b/docker/sync_static.bash similarity index 73% rename from docker/sync_static.sh rename to docker/sync_static.bash index efb1b9ebf..d42afd64f 100755 --- a/docker/sync_static.sh +++ b/docker/sync_static.bash @@ -1,15 +1,11 @@ #!/bin/bash set -e -source /etc/profile - -oldpwd=$(pwd) -cd "${KOBOCAT_SRC_DIR}" - mkdir -p "${KOBOCAT_SRC_DIR}/onadata/static" +chown -R "${UWSGI_USER}" "${KOBOCAT_SRC_DIR}/onadata/static" echo "Collecting static files..." -python manage.py collectstatic -v 0 --noinput +gosu "${UWSGI_USER}" "${VIRTUAL_ENV}/bin/python" manage.py collectstatic -v 0 --noinput echo "Done" # `chown -R` becomes very slow once a fair amount of media has been collected, @@ -21,12 +17,10 @@ echo '%%%%%%% NOTICE %%%%%%%' echo '% To avoid long delays, we no longer reset ownership *recursively*' echo '% every time this container starts. If you have trouble with' echo '% permissions, please run the following command inside the' -echo '% `kobocat` container:' +echo '% KoBoCAT container:' echo "% chown -R \"${UWSGI_USER}\" \"${KOBOCAT_SRC_DIR}\"" echo '%%%%%%%%%%%%%%%%%%%%%%' echo "Syncing to nginx folder..." -rsync -aq ${KOBOCAT_SRC_DIR}/onadata/static/* /srv/static/ +rsync -aq --delete --chown=www-data "${KOBOCAT_SRC_DIR}/onadata/static/" "${NGINX_STATIC_DIR}/" echo "Done" - -cd $oldpwd diff --git a/kobocat-template/static/css/kobo-branding.css b/kobocat-template/static/css/kobo-branding.css index 45cfcc0fc..47306af30 100644 --- a/kobocat-template/static/css/kobo-branding.css +++ b/kobocat-template/static/css/kobo-branding.css @@ -330,7 +330,7 @@ section { .single-project__header .container, .projects-list__header .container, .data-page__header .container { - max-width: 984px; + max-width: 960px; } .single-project__header .fa-caret-right, @@ -681,4 +681,4 @@ i.fa-trash-o { td.footable-first-column { padding-right: 0px !important; } -} \ No newline at end of file +} diff --git a/kobocat-template/static/css/kobo-single-project.css b/kobocat-template/static/css/kobo-single-project.css index 69fd8bb66..c96ce6fd7 100644 --- a/kobocat-template/static/css/kobo-single-project.css +++ b/kobocat-template/static/css/kobo-single-project.css @@ -189,7 +189,7 @@ button.single-project__button-delete { } .dashboard__left { - width: 72%; + width: 60%; float: left; margin-left: 1%; } @@ -197,6 +197,7 @@ button.single-project__button-delete { .dashboard__right { width: 25%; float: left; + margin-left: -13%; } h2.dashboard__group-label { @@ -205,9 +206,8 @@ h2.dashboard__group-label { } .dashboard__submissions { - width: 55%; + width: 33%; float: left; - margin-right: 5%; position: relative; } @@ -268,7 +268,7 @@ a.dashboard__button-download-data:hover span { } .dashboard__submissions a.dashboard__button { - width: 30%; + width: 60%; } a.dashboard__button-twoline span { @@ -351,8 +351,8 @@ a.dashboard__formbutton-refresh { .dashboard__download__drop { position: absolute; - right: 22px; - bottom: -150px; + left: 0; + bottom: -128px; width: 124px; border: 1px solid #E7E8E9; background: white; @@ -629,4 +629,4 @@ span.poshytip { .dashboard__download__drop { bottom: -190px; } -} \ No newline at end of file +} diff --git a/kobocat-template/templates/base.html b/kobocat-template/templates/base.html index e67996755..2b63147b7 100644 --- a/kobocat-template/templates/base.html +++ b/kobocat-template/templates/base.html @@ -1,132 +1,142 @@ {% load static %} +{% with legacy_learn_more_url="https://community.kobotoolbox.org/t/changes-to-legacy-interface-self-serve-migration-feature-into-the-new-interface/18108" %} + - + {% block title %}{{ SITE_NAME }}{% endblock %} - + {% if GOOGLE_SITE_VERIFICATION %} - + {% endif %} - {% if csrf_token %}{% endif %} + {% if csrf_token %} + {% endif %} {% block styles %} - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + {% endblock %} {% block additional-headers %}{% endblock %} - - - {% block body %} - {% if not user.is_authenticated %} - - -
-
- We no longer recommend using the legacy interface. Please access all our new features in the new interface (new map, table, reports, labeled data exports, etc.). If you have deployed your project directly in the legacy interface, there is no way to use these new features. This legacy interface will be removed shortly. -
-
- -
-
- - Support -
-
- - {% else %} - - - {% include "topbar.html"%} - - {% endif %} - - {% block before-content %}{% endblock %} - -
- {% block message %} + + +{% block body %} + {% if not user.is_authenticated %} + + +
+
+ + Support +
+
+ + {% else %} + + + {% include "topbar.html" %} + + {% endif %} + +{% block before-content %}{% endblock %} + +
+ {% block message %} {% if message or messages or message_list %} - {% include "message.html" %} + {% include "message.html" %} {% endif %} - {% endblock %} - {% block content %} + {% endblock %} + {% block content %} {% if template %}{% include template %}{% endif %} {{ content|safe }} - {% endblock %} -
+ {% endblock %} +
- {% include "footer.html" %} +{% include "footer.html" %} - {% block below-content %}{% endblock %} +{% block below-content %}{% endblock %} - {% block javascript %} +{% block javascript %} - + - + - {% endblock %} +{% endblock %} - {% block additional-javascript %}{% endblock %} +{% block additional-javascript %}{% endblock %} - {% block google-analytics %} +{% block google-analytics %} {% if GOOGLE_ANALYTICS_PROPERTY_ID %} - + {% endif %} - {% endblock %} +{% endblock %} - - {% endblock %} + +{% endblock %} + +{% endwith %} {# legacy_learn_more_url #} diff --git a/kobocat-template/templates/dashboard.html b/kobocat-template/templates/dashboard.html index cfc087dca..2444f6959 100644 --- a/kobocat-template/templates/dashboard.html +++ b/kobocat-template/templates/dashboard.html @@ -64,12 +64,11 @@

{% blocktrans %}Publish a Form Upload XLSForm{% endblocktrans

- {{ content_user.username }} + {{ content_user.username }} {% if profile.name %} | {{ profile.name }} {% endif %}

- {% trans "View Profile Page" %}
diff --git a/kobocat-template/templates/data_view.html b/kobocat-template/templates/data_view.html deleted file mode 100644 index e3453f318..000000000 --- a/kobocat-template/templates/data_view.html +++ /dev/null @@ -1,97 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% load static %} - -{% block additional-headers %} -{% load i18n %} - - - - -{% endblock %} - -{% block before-content %} - - -
-
-

{% trans "Data View" %}

-
-
- -{% endblock %} - -{% block content %} -
-
- -
-
-
-
-
-
-{% endblock %} - -{% block javascript %} - {{ block.super }} - - - - - - - - - - - -{% endblock %} diff --git a/kobocat-template/templates/export_list.html b/kobocat-template/templates/export_list.html index a847e9977..b4c9f5d43 100644 --- a/kobocat-template/templates/export_list.html +++ b/kobocat-template/templates/export_list.html @@ -7,7 +7,7 @@ @@ -25,7 +25,7 @@

{{ export_type_name|upper }} {% blocktrans %}Exports{% endblocktrans %}

{% if user.is_authenticated %} -
+ {% csrf_token %}
@@ -40,7 +40,7 @@

{{ export_type_name|upper }} {% blocktrans %}Exports{% endblocktrans %}

{% endif %}
{% endif %} - - diff --git a/manage.py b/manage.py index 5345fa0d6..72a08ffb5 100755 --- a/manage.py +++ b/manage.py @@ -1,19 +1,14 @@ #!/usr/bin/env python # coding: utf-8 -from __future__ import print_function - import logging import os import sys -south_logger = logging.getLogger('south') -south_logger.setLevel(logging.INFO) - if __name__ == "__main__": # altered for new settings layout if not any([arg.startswith('--settings=') for arg in sys.argv]): os.environ.setdefault("DJANGO_SETTINGS_MODULE", - "onadata.settings.common") + "onadata.settings.base") print('Your environment is:"{}"'.format( os.environ['DJANGO_SETTINGS_MODULE'])) diff --git a/onadata/__init__.py b/onadata/__init__.py index e8398c0a1..a0538ebbe 100644 --- a/onadata/__init__.py +++ b/onadata/__init__.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import absolute_import, unicode_literals - # This will make sure the app is always imported when # Django starts so that shared_task will use this app. from .celery import app as celery_app diff --git a/onadata/apps/__init__.py b/onadata/apps/__init__.py index 134880430..57d631c3f 100644 --- a/onadata/apps/__init__.py +++ b/onadata/apps/__init__.py @@ -1,2 +1 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import diff --git a/onadata/apps/api/__init__.py b/onadata/apps/api/__init__.py index 134880430..57d631c3f 100644 --- a/onadata/apps/api/__init__.py +++ b/onadata/apps/api/__init__.py @@ -1,2 +1 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import diff --git a/onadata/apps/api/exceptions.py b/onadata/apps/api/exceptions.py index 8feeb2701..bace0bbcb 100644 --- a/onadata/apps/api/exceptions.py +++ b/onadata/apps/api/exceptions.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import absolute_import, unicode_literals - from django.utils.translation import ugettext_lazy as _ from rest_framework.exceptions import APIException from rest_framework.status import HTTP_400_BAD_REQUEST diff --git a/onadata/apps/api/migrations/0001_initial.py b/onadata/apps/api/migrations/0001_initial.py index 7272f2d13..24edf8acb 100644 --- a/onadata/apps/api/migrations/0001_initial.py +++ b/onadata/apps/api/migrations/0001_initial.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, absolute_import, print_function, division - import jsonfield.fields import taggit.managers from django.conf import settings @@ -21,9 +19,9 @@ class Migration(migrations.Migration): migrations.CreateModel( name='OrganizationProfile', fields=[ - ('userprofile_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='main.UserProfile')), + ('userprofile_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='main.UserProfile', on_delete=models.CASCADE)), ('is_organization', models.BooleanField(default=True)), - ('creator', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ('creator', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], options={ 'permissions': (('can_add_xform', 'Can add/upload an xform to organization'), ('view_organizationprofile', 'Can view organization profile')), @@ -39,8 +37,8 @@ class Migration(migrations.Migration): ('shared', models.BooleanField(default=False)), ('date_created', models.DateTimeField(auto_now_add=True)), ('date_modified', models.DateTimeField(auto_now=True)), - ('created_by', models.ForeignKey(related_name='project_creator', to=settings.AUTH_USER_MODEL)), - ('organization', models.ForeignKey(related_name='project_organization', to=settings.AUTH_USER_MODEL)), + ('created_by', models.ForeignKey(related_name='project_creator', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), + ('organization', models.ForeignKey(related_name='project_organization', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ('tags', taggit.managers.TaggableManager(to='taggit.Tag', through='taggit.TaggedItem', help_text='A comma-separated list of tags.', verbose_name='Tags')), ('user_stars', models.ManyToManyField(to=settings.AUTH_USER_MODEL)), ], @@ -52,19 +50,19 @@ class Migration(migrations.Migration): name='ProjectXForm', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('created_by', models.ForeignKey(to=settings.AUTH_USER_MODEL)), - ('project', models.ForeignKey(to='api.Project')), - ('xform', models.ForeignKey(to='logger.XForm')), + ('created_by', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), + ('project', models.ForeignKey(to='api.Project', on_delete=models.CASCADE)), + ('xform', models.ForeignKey(to='logger.XForm', on_delete=models.CASCADE)), ], ), migrations.CreateModel( name='Team', fields=[ - ('group_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='auth.Group')), + ('group_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='auth.Group', on_delete=models.CASCADE)), ('date_created', models.DateTimeField(auto_now_add=True, null=True)), ('date_modified', models.DateTimeField(auto_now=True, null=True)), - ('created_by', models.ForeignKey(related_name='team_creator', blank=True, to=settings.AUTH_USER_MODEL, null=True)), - ('organization', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ('created_by', models.ForeignKey(related_name='team_creator', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE)), + ('organization', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ('projects', models.ManyToManyField(to='api.Project')), ], options={ diff --git a/onadata/apps/api/migrations/0002_remove_not_used_models.py b/onadata/apps/api/migrations/0002_remove_not_used_models.py index 671d69191..c677fc2d1 100644 --- a/onadata/apps/api/migrations/0002_remove_not_used_models.py +++ b/onadata/apps/api/migrations/0002_remove_not_used_models.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals - from django.db import migrations, models diff --git a/onadata/apps/api/migrations/__init__.py b/onadata/apps/api/migrations/__init__.py index 134880430..57d631c3f 100644 --- a/onadata/apps/api/migrations/__init__.py +++ b/onadata/apps/api/migrations/__init__.py @@ -1,2 +1 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import diff --git a/onadata/apps/api/models/__init__.py b/onadata/apps/api/models/__init__.py index 134880430..57d631c3f 100644 --- a/onadata/apps/api/models/__init__.py +++ b/onadata/apps/api/models/__init__.py @@ -1,2 +1 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import diff --git a/onadata/apps/api/mongo_helper.py b/onadata/apps/api/mongo_helper.py index 7b7a35712..6b14e3392 100644 --- a/onadata/apps/api/mongo_helper.py +++ b/onadata/apps/api/mongo_helper.py @@ -1,21 +1,21 @@ -from __future__ import unicode_literals, print_function, division, absolute_import import re -import base64 + from onadata.libs.utils.common_tags import NESTED_RESERVED_ATTRIBUTES +from onadata.libs.utils.string import base64_encodestring -class MongoHelper(object): +class MongoHelper: KEY_WHITELIST = ['$or', '$and', '$exists', '$in', '$gt', '$gte', '$lt', '$lte', '$regex', '$options', '$all'] ENCODING_SUBSTITUTIONS = [ - (re.compile(r'^\$'), base64.encodestring('$').strip()), - (re.compile(r'\.'), base64.encodestring('.').strip()), + (re.compile(r'^\$'), base64_encodestring('$').strip()), + (re.compile(r'\.'), base64_encodestring('.').strip()), ] DECODING_SUBSTITUTIONS = [ - (re.compile(r'^' + base64.encodestring('$').strip()), '$'), - (re.compile(base64.encodestring('.').strip()), '.'), + (re.compile(r'^' + base64_encodestring('$').strip()), '$'), + (re.compile(base64_encodestring('.').strip()), '.'), ] @classmethod diff --git a/onadata/apps/api/permissions.py b/onadata/apps/api/permissions.py index 281cdd736..ea01f2c36 100644 --- a/onadata/apps/api/permissions.py +++ b/onadata/apps/api/permissions.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from rest_framework.permissions import ( DjangoObjectPermissions, IsAuthenticated, @@ -35,9 +33,7 @@ class ObjectPermissionsWithViewRestricted(DjangoObjectPermissions): https://www.django-rest-framework.org/api-guide/permissions/#djangoobjectpermissions """ def __init__(self, *args, **kwargs): - super(ObjectPermissionsWithViewRestricted, self).__init__( - *args, **kwargs - ) + super().__init__(*args, **kwargs) # Do NOT mutate `perms_map` from the parent class! Doing so will affect # *every* instance of `DjangoObjectPermissions` and all its subclasses self.perms_map = self.perms_map.copy() @@ -82,7 +78,7 @@ def has_permission(self, request, view): view.action and view.action == 'retrieve': return True - return super(XFormPermissions, self).has_permission(request, view) + return super().has_permission(request, view) def has_object_permission(self, request, view, obj): # Allow anonymous users to access shared data @@ -90,14 +86,13 @@ def has_object_permission(self, request, view, obj): if obj.shared: return True - return super(XFormPermissions, self).has_object_permission( - request, view, obj) + return super().has_object_permission(request, view, obj) class XFormDataPermissions(ObjectPermissionsWithViewRestricted): def __init__(self, *args, **kwargs): - super(XFormDataPermissions, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # Those who can edit submissions can also delete them, following the # behavior of `onadata.apps.main.views.delete_data` self.perms_map = self.perms_map.copy() @@ -115,7 +110,7 @@ def has_permission(self, request, view): if request.method in SAFE_METHODS and \ view.action in allowed_anonymous_action: return True - return super(XFormDataPermissions, self).has_permission(request, view) + return super().has_permission(request, view) def has_object_permission(self, request, view, obj): # Allow anonymous users to access shared data @@ -133,8 +128,7 @@ def has_object_permission(self, request, view, obj): user = request.user return user.has_perms([CAN_VALIDATE_XFORM], obj) - return super(XFormDataPermissions, self).has_object_permission( - request, view, obj) + return super().has_object_permission(request, view, obj) class MetaDataObjectPermissions(ObjectPermissionsWithViewRestricted): @@ -202,12 +196,12 @@ def __init__(self, *args, **kwargs): self.perms_map['GET'] = ['%(app_label)s.view_xform'] self.perms_map['OPTIONS'] = ['%(app_label)s.view_xform'] self.perms_map['HEAD'] = ['%(app_label)s.view_xform'] - return super(AttachmentObjectPermissions, self).__init__(*args, **kwargs) + return super().__init__(*args, **kwargs) def has_object_permission(self, request, view, obj): view.model = XForm - return super(AttachmentObjectPermissions, self).has_object_permission( + return super().has_object_permission( request, view, obj.instance.xform) @@ -224,14 +218,14 @@ def __init__(self, *args, **kwargs): self.perms_map['POST'] = ['%(app_label)s.change_xform'] self.perms_map['DELETE'] = ['%(app_label)s.change_xform'] - return super(NoteObjectPermissions, self).__init__(*args, **kwargs) + return super().__init__(*args, **kwargs) def has_permission(self, request, view): # Data will be filtered in `NoteViewSet` if request.method in SAFE_METHODS and view.action == 'retrieve': return True - return super(NoteObjectPermissions, self).has_permission(request, view) + return super().has_permission(request, view) def has_object_permission(self, request, view, obj): @@ -242,8 +236,7 @@ def has_object_permission(self, request, view, obj): if xform.shared_data: return True - return super(NoteObjectPermissions, self).has_object_permission( - request, view, xform) + return super().has_object_permission(request, view, xform) class ConnectViewsetPermissions(IsAuthenticated): @@ -252,8 +245,7 @@ def has_permission(self, request, view): if view.action == 'reset': return True - return super(ConnectViewsetPermissions, self)\ - .has_permission(request, view) + return super().has_permission(request, view) __permissions__ = [DjangoObjectPermissions, IsAuthenticated] diff --git a/onadata/apps/api/south_migrations/0001_initial.py b/onadata/apps/api/south_migrations/0001_initial.py deleted file mode 100644 index 9d46b3b8f..000000000 --- a/onadata/apps/api/south_migrations/0001_initial.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding model 'OrganizationProfile' - db.create_table('api_organizationprofile', ( - ('userprofile_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['main.UserProfile'], unique=True, primary_key=True)), - ('is_organization', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('creator', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), - )) - db.send_create_signal('api', ['OrganizationProfile']) - - # Adding model 'Team' - db.create_table('api_team', ( - ('group_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['auth.Group'], unique=True, primary_key=True)), - ('organization', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), - )) - db.send_create_signal('api', ['Team']) - - - - def backwards(self, orm): - # Deleting model 'OrganizationProfile' - db.delete_table('api_organizationprofile') - - # Deleting model 'Team' - db.delete_table('api_team') - - - models = { - 'api.organizationprofile': { - 'Meta': {'object_name': 'OrganizationProfile', '_ormbases': ['main.UserProfile']}, - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'is_organization': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'userprofile_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['main.UserProfile']", 'unique': 'True', 'primary_key': 'True'}) - }, - 'api.team': { - 'Meta': {'object_name': 'Team', '_ormbases': ['auth.Group']}, - 'group_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.Group']", 'unique': 'True', 'primary_key': 'True'}), - 'organization': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'projects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['models.Project']", 'symmetrical': 'False'}) - }, - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'main.userprofile': { - 'Meta': {'object_name': 'UserProfile'}, - 'address': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'city': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}), - 'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'home_page': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'organization': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'phonenumber': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'require_auth': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'twitter': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.User']"}) - }, - 'models.project': { - 'Meta': {'object_name': 'Project'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - } - } - - complete_apps = ['api'] diff --git a/onadata/apps/api/south_migrations/0002_auto__add_project__add_unique_project_name_organization.py b/onadata/apps/api/south_migrations/0002_auto__add_project__add_unique_project_name_organization.py deleted file mode 100644 index 69c2afe2c..000000000 --- a/onadata/apps/api/south_migrations/0002_auto__add_project__add_unique_project_name_organization.py +++ /dev/null @@ -1,121 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding model 'Project' - db.create_table('api_project', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=255)), - ('organization', self.gf('django.db.models.fields.related.ForeignKey')(related_name='project_organization', to=orm['auth.User'])), - ('created_by', self.gf('django.db.models.fields.related.ForeignKey')(related_name='project_creator', to=orm['auth.User'])), - ('date_created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - ('date_modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), - )) - db.send_create_signal('api', ['Project']) - - # Adding unique constraint on 'Project', fields ['name', 'organization'] - db.create_unique('api_project', ['name', 'organization_id']) - - # Adding M2M table for field projects on 'Team' - db.create_table('api_team_projects', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('team', models.ForeignKey(orm['api.team'], null=False)), - ('project', models.ForeignKey(orm['api.project'], null=False)) - )) - db.create_unique('api_team_projects', ['team_id', 'project_id']) - - - def backwards(self, orm): - # Removing unique constraint on 'Project', fields ['name', 'organization'] - db.delete_unique('api_project', ['name', 'organization_id']) - - # Deleting model 'Project' - db.delete_table('api_project') - - # Removing M2M table for field projects on 'Team' - db.delete_table('api_team_projects') - - - models = { - 'api.organizationprofile': { - 'Meta': {'object_name': 'OrganizationProfile', '_ormbases': ['main.UserProfile']}, - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'is_organization': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'userprofile_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['main.UserProfile']", 'unique': 'True', 'primary_key': 'True'}) - }, - 'api.project': { - 'Meta': {'unique_together': "(('name', 'organization'),)", 'object_name': 'Project'}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_creator'", 'to': "orm['auth.User']"}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'organization': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_organization'", 'to': "orm['auth.User']"}) - }, - 'api.team': { - 'Meta': {'object_name': 'Team', '_ormbases': ['auth.Group']}, - 'group_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.Group']", 'unique': 'True', 'primary_key': 'True'}), - 'organization': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'projects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['api.Project']", 'symmetrical': 'False'}) - }, - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'main.userprofile': { - 'Meta': {'object_name': 'UserProfile'}, - 'address': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'city': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}), - 'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'home_page': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'organization': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'phonenumber': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'require_auth': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'twitter': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.User']"}) - } - } - - complete_apps = ['api'] diff --git a/onadata/apps/api/south_migrations/0003_auto__add_projectxform__add_unique_projectxform_xform_project.py b/onadata/apps/api/south_migrations/0003_auto__add_projectxform__add_unique_projectxform_xform_project.py deleted file mode 100644 index e36461a83..000000000 --- a/onadata/apps/api/south_migrations/0003_auto__add_projectxform__add_unique_projectxform_xform_project.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding model 'ProjectXForm' - db.create_table('api_projectxform', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('xform', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['logger.XForm'])), - ('project', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['api.Project'])), - ('created_by', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), - )) - db.send_create_signal('api', ['ProjectXForm']) - - # Adding unique constraint on 'ProjectXForm', fields ['xform', 'project'] - db.create_unique('api_projectxform', ['xform_id', 'project_id']) - - - def backwards(self, orm): - # Removing unique constraint on 'ProjectXForm', fields ['xform', 'project'] - db.delete_unique('api_projectxform', ['xform_id', 'project_id']) - - # Deleting model 'ProjectXForm' - db.delete_table('api_projectxform') - - - models = { - 'api.organizationprofile': { - 'Meta': {'object_name': 'OrganizationProfile', '_ormbases': ['main.UserProfile']}, - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'is_organization': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'userprofile_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['main.UserProfile']", 'unique': 'True', 'primary_key': 'True'}) - }, - 'api.project': { - 'Meta': {'unique_together': "(('name', 'organization'),)", 'object_name': 'Project'}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_creator'", 'to': "orm['auth.User']"}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'organization': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_organization'", 'to': "orm['auth.User']"}) - }, - 'api.projectxform': { - 'Meta': {'unique_together': "(('xform', 'project'),)", 'object_name': 'ProjectXForm'}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['api.Project']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['logger.XForm']"}) - }, - 'api.team': { - 'Meta': {'object_name': 'Team', '_ormbases': ['auth.Group']}, - 'group_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.Group']", 'unique': 'True', 'primary_key': 'True'}), - 'organization': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'projects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['api.Project']", 'symmetrical': 'False'}) - }, - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'main.userprofile': { - 'Meta': {'object_name': 'UserProfile'}, - 'address': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'city': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}), - 'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'home_page': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'organization': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'phonenumber': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'require_auth': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'twitter': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.User']"}) - }, - 'logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '50'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['api'] diff --git a/onadata/apps/api/south_migrations/0004_auto__add_field_team_created_by__add_field_team_date_created__add_fiel.py b/onadata/apps/api/south_migrations/0004_auto__add_field_team_created_by__add_field_team_date_created__add_fiel.py deleted file mode 100644 index 4a4726693..000000000 --- a/onadata/apps/api/south_migrations/0004_auto__add_field_team_created_by__add_field_team_date_created__add_fiel.py +++ /dev/null @@ -1,165 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - -import datetime - -from south.db import db -from south.v2 import SchemaMigration - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Team.created_by' - db.add_column('api_team', 'created_by', - self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='team_creator', null=True, to=orm['auth.User']), - keep_default=False) - - # Adding field 'Team.date_created' - db.add_column('api_team', 'date_created', - self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, null=True, blank=True), - keep_default=False) - - # Adding field 'Team.date_modified' - db.add_column('api_team', 'date_modified', - self.gf('django.db.models.fields.DateTimeField')(auto_now=True, null=True, blank=True), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Team.created_by' - db.delete_column('api_team', 'created_by_id') - - # Deleting field 'Team.date_created' - db.delete_column('api_team', 'date_created') - - # Deleting field 'Team.date_modified' - db.delete_column('api_team', 'date_modified') - - - models = { - 'api.organizationprofile': { - 'Meta': {'object_name': 'OrganizationProfile', '_ormbases': ['main.UserProfile']}, - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'is_organization': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'userprofile_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['main.UserProfile']", 'unique': 'True', 'primary_key': 'True'}) - }, - 'api.project': { - 'Meta': {'unique_together': "(('name', 'organization'),)", 'object_name': 'Project'}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_creator'", 'to': "orm['auth.User']"}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'organization': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_organization'", 'to': "orm['auth.User']"}) - }, - 'api.projectxform': { - 'Meta': {'unique_together': "(('xform', 'project'),)", 'object_name': 'ProjectXForm'}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['api.Project']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['logger.XForm']"}) - }, - 'api.team': { - 'Meta': {'object_name': 'Team', '_ormbases': ['auth.Group']}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'team_creator'", 'null': 'True', 'to': "orm['auth.User']"}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}), - 'group_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.Group']", 'unique': 'True', 'primary_key': 'True'}), - 'organization': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'projects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['api.Project']", 'symmetrical': 'False'}) - }, - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'instances_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'main.userprofile': { - 'Meta': {'object_name': 'UserProfile'}, - 'address': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'city': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}), - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'home_page': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'organization': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'phonenumber': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'require_auth': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'twitter': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.User']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['api'] diff --git a/onadata/apps/api/south_migrations/0005_auto__add_field_project_metadata.py b/onadata/apps/api/south_migrations/0005_auto__add_field_project_metadata.py deleted file mode 100644 index 45d93dd04..000000000 --- a/onadata/apps/api/south_migrations/0005_auto__add_field_project_metadata.py +++ /dev/null @@ -1,149 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Project.metadata' - db.add_column('api_project', 'metadata', - self.gf('jsonfield.fields.JSONField')(null=True), - keep_default=False) - - def backwards(self, orm): - # Deleting field 'Project.metadata' - db.delete_column('api_project', 'metadata') - - - models = { - 'api.organizationprofile': { - 'Meta': {'object_name': 'OrganizationProfile', '_ormbases': ['main.UserProfile']}, - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'is_organization': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'userprofile_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['main.UserProfile']", 'unique': 'True', 'primary_key': 'True'}) - }, - 'api.project': { - 'Meta': {'unique_together': "(('name', 'organization'),)", 'object_name': 'Project'}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_creator'", 'to': "orm['auth.User']"}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'metadata': ('jsonfield.fields.JSONField', [], {'null': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'organization': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_organization'", 'to': "orm['auth.User']"}) - }, - 'api.projectxform': { - 'Meta': {'unique_together': "(('xform', 'project'),)", 'object_name': 'ProjectXForm'}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['api.Project']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['logger.XForm']"}) - }, - 'api.team': { - 'Meta': {'object_name': 'Team', '_ormbases': ['auth.Group']}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'team_creator'", 'null': 'True', 'to': "orm['auth.User']"}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}), - 'group_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.Group']", 'unique': 'True', 'primary_key': 'True'}), - 'organization': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'projects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['api.Project']", 'symmetrical': 'False'}) - }, - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'instances_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'main.userprofile': { - 'Meta': {'object_name': 'UserProfile'}, - 'address': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'city': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}), - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'home_page': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'organization': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'phonenumber': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'require_auth': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'twitter': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.User']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['api'] diff --git a/onadata/apps/api/south_migrations/0006_auto__add_field_project_shared.py b/onadata/apps/api/south_migrations/0006_auto__add_field_project_shared.py deleted file mode 100644 index d31d15b98..000000000 --- a/onadata/apps/api/south_migrations/0006_auto__add_field_project_shared.py +++ /dev/null @@ -1,150 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Project.shared' - db.add_column('api_project', 'shared', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Project.shared' - db.delete_column('api_project', 'shared') - - - models = { - 'api.organizationprofile': { - 'Meta': {'object_name': 'OrganizationProfile', '_ormbases': ['main.UserProfile']}, - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'is_organization': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'userprofile_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['main.UserProfile']", 'unique': 'True', 'primary_key': 'True'}) - }, - 'api.project': { - 'Meta': {'unique_together': "(('name', 'organization'),)", 'object_name': 'Project'}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_creator'", 'to': "orm['auth.User']"}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'metadata': ('jsonfield.fields.JSONField', [], {'default': '{}', 'null': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'organization': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_organization'", 'to': "orm['auth.User']"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) - }, - 'api.projectxform': { - 'Meta': {'unique_together': "(('xform', 'project'),)", 'object_name': 'ProjectXForm'}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['api.Project']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['logger.XForm']"}) - }, - 'api.team': { - 'Meta': {'object_name': 'Team', '_ormbases': ['auth.Group']}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'team_creator'", 'null': 'True', 'to': "orm['auth.User']"}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}), - 'group_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.Group']", 'unique': 'True', 'primary_key': 'True'}), - 'organization': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'projects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['api.Project']", 'symmetrical': 'False'}) - }, - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'instances_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'main.userprofile': { - 'Meta': {'object_name': 'UserProfile'}, - 'address': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'city': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}), - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'home_page': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'organization': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'phonenumber': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'require_auth': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'twitter': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.User']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['api'] diff --git a/onadata/apps/api/south_migrations/0007_auto__chg_field_project_metadata.py b/onadata/apps/api/south_migrations/0007_auto__chg_field_project_metadata.py deleted file mode 100644 index 244b16bbd..000000000 --- a/onadata/apps/api/south_migrations/0007_auto__chg_field_project_metadata.py +++ /dev/null @@ -1,148 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'Project.metadata' - db.alter_column('api_project', 'metadata', self.gf('jsonfield.fields.JSONField')(default={'category': 'none'})) - - def backwards(self, orm): - - # Changing field 'Project.metadata' - db.alter_column('api_project', 'metadata', self.gf('jsonfield.fields.JSONField')(null=True)) - - models = { - 'api.organizationprofile': { - 'Meta': {'object_name': 'OrganizationProfile', '_ormbases': ['main.UserProfile']}, - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'is_organization': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'userprofile_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['main.UserProfile']", 'unique': 'True', 'primary_key': 'True'}) - }, - 'api.project': { - 'Meta': {'unique_together': "(('name', 'organization'),)", 'object_name': 'Project'}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_creator'", 'to': "orm['auth.User']"}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'metadata': ('jsonfield.fields.JSONField', [], {'default': '{}'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'organization': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_organization'", 'to': "orm['auth.User']"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) - }, - 'api.projectxform': { - 'Meta': {'unique_together': "(('xform', 'project'),)", 'object_name': 'ProjectXForm'}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['api.Project']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['logger.XForm']"}) - }, - 'api.team': { - 'Meta': {'object_name': 'Team', '_ormbases': ['auth.Group']}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'team_creator'", 'null': 'True', 'to': "orm['auth.User']"}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}), - 'group_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.Group']", 'unique': 'True', 'primary_key': 'True'}), - 'organization': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'projects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['api.Project']", 'symmetrical': 'False'}) - }, - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'instances_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'main.userprofile': { - 'Meta': {'object_name': 'UserProfile'}, - 'address': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'city': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}), - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'home_page': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'organization': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'phonenumber': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'require_auth': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'twitter': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.User']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['api'] diff --git a/onadata/apps/api/south_migrations/0008_auto_add_user_star_field_to_project.py b/onadata/apps/api/south_migrations/0008_auto_add_user_star_field_to_project.py deleted file mode 100644 index 1f9656497..000000000 --- a/onadata/apps/api/south_migrations/0008_auto_add_user_star_field_to_project.py +++ /dev/null @@ -1,156 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding M2M table for field user_stars on 'Project' - m2m_table_name = db.shorten_name('api_project_user_stars') - db.create_table(m2m_table_name, ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('project', models.ForeignKey(orm['api.project'], null=False)), - ('user', models.ForeignKey(orm['auth.user'], null=False)) - )) - db.create_unique(m2m_table_name, ['project_id', 'user_id']) - - - def backwards(self, orm): - # Removing M2M table for field user_stars on 'Project' - db.delete_table(db.shorten_name('api_project_user_stars')) - - - models = { - 'api.organizationprofile': { - 'Meta': {'object_name': 'OrganizationProfile', '_ormbases': ['main.UserProfile']}, - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'is_organization': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'userprofile_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['main.UserProfile']", 'unique': 'True', 'primary_key': 'True'}) - }, - 'api.project': { - 'Meta': {'unique_together': "(('name', 'organization'),)", 'object_name': 'Project'}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_creator'", 'to': "orm['auth.User']"}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'metadata': ('jsonfield.fields.JSONField', [], {'blank': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'organization': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_organization'", 'to': "orm['auth.User']"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'user_stars': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False'}) - }, - 'api.projectxform': { - 'Meta': {'unique_together': "(('xform', 'project'),)", 'object_name': 'ProjectXForm'}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['api.Project']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['logger.XForm']"}) - }, - 'api.team': { - 'Meta': {'object_name': 'Team', '_ormbases': ['auth.Group']}, - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'team_creator'", 'null': 'True', 'to': "orm['auth.User']"}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}), - 'group_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.Group']", 'unique': 'True', 'primary_key': 'True'}), - 'organization': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), - 'projects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['api.Project']", 'symmetrical': 'False'}) - }, - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'instances_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'require_auth': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'main.userprofile': { - 'Meta': {'object_name': 'UserProfile'}, - 'address': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'city': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}), - 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'home_page': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'organization': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'phonenumber': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'require_auth': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'twitter': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.User']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['api'] diff --git a/onadata/apps/api/south_migrations/__init__.py b/onadata/apps/api/south_migrations/__init__.py deleted file mode 100644 index 134880430..000000000 --- a/onadata/apps/api/south_migrations/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import diff --git a/onadata/apps/api/tests/__init__.py b/onadata/apps/api/tests/__init__.py index 134880430..57d631c3f 100644 --- a/onadata/apps/api/tests/__init__.py +++ b/onadata/apps/api/tests/__init__.py @@ -1,2 +1 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import diff --git a/onadata/apps/api/tests/fixtures/Transportation Form.xml b/onadata/apps/api/tests/fixtures/Transportation Form.xml index 9aa6c7149..073131011 100644 --- a/onadata/apps/api/tests/fixtures/Transportation Form.xml +++ b/onadata/apps/api/tests/fixtures/Transportation Form.xml @@ -58,7 +58,7 @@ - + diff --git a/onadata/apps/api/tests/fixtures/movie_form_submission.json b/onadata/apps/api/tests/fixtures/movie_form_submission.json deleted file mode 100644 index e06660e74..000000000 --- a/onadata/apps/api/tests/fixtures/movie_form_submission.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "id": "movie_form", - "submission": { - "_notes": [], - "_uuid": "e5ebc147-bd98-4fff-93b7-8b4acf520a7c", - "meta/instanceID": "uuid:e5ebc147-bd98-4fff-93b7-8b4acf520a7c", - "_verified": "not_verified", - "_submission_time": "2014-10-10T13:16:31", - "movie_suggestion": "Cloud Atlas", - "_bamboo_dataset_id": "", - "_tags": [], - "refreshment": "soda", - "_attachments": [], - "watch_date": "2014-10-10T16:30:00.000+03:00", - "_submitted_by": null, - "_geolocation": [null, null], - "location": "mombasa", - "_xform_id_string": "movie_form", - "_status": "submitted_via_web", - "_id": 394565, - "formhub/uuid": "27f5a700f03a432c89f9d23f2122b570" - } -} diff --git a/onadata/apps/api/tests/viewsets/__init__.py b/onadata/apps/api/tests/viewsets/__init__.py index 134880430..57d631c3f 100644 --- a/onadata/apps/api/tests/viewsets/__init__.py +++ b/onadata/apps/api/tests/viewsets/__init__.py @@ -1,2 +1 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import diff --git a/onadata/apps/api/tests/viewsets/test_abstract_viewset.py b/onadata/apps/api/tests/viewsets/test_abstract_viewset.py index 747766322..ff57d407b 100644 --- a/onadata/apps/api/tests/viewsets/test_abstract_viewset.py +++ b/onadata/apps/api/tests/viewsets/test_abstract_viewset.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os import re from tempfile import NamedTemporaryFile @@ -48,44 +46,47 @@ class TestAbstractViewSet(TestCase): profile_data = default_profile_data.copy() def setUp(self): - super(TestAbstractViewSet, self).setUp() + super().setUp() self.factory = APIRequestFactory() self._login_user_and_profile() self._add_permissions_to_user(AnonymousUser()) self.maxDiff = None - def publish_xls_form(self): - data = { - 'owner': self.user.username, - 'public': False, - 'public_data': False, - 'description': u'transportation_2011_07_25', - 'downloadable': True, - 'allows_sms': False, - 'encrypted': False, - 'sms_id_string': u'transportation_2011_07_25', - 'id_string': u'transportation_2011_07_25', - 'title': u'transportation_2011_07_25', - } - - path = os.path.join( - settings.ONADATA_DIR, "apps", "main", "tests", "fixtures", - "transportation", "transportation.xls") + def publish_xls_form(self, path=None, data=None, assert_=True): + if not data: + data = { + 'owner': self.user.username, + 'public': False, + 'public_data': False, + 'description': u'transportation_2011_07_25', + 'downloadable': True, + 'encrypted': False, + 'id_string': u'transportation_2011_07_25', + 'title': u'transportation_2011_07_25', + } + + if not path: + path = os.path.join( + settings.ONADATA_DIR, "apps", "main", "tests", "fixtures", + "transportation", "transportation.xls") xform_list_url = reverse('xform-list') - with open(path) as xls_file: + with open(path, 'rb') as xls_file: post_data = {'xls_file': xls_file} response = self.client.post(xform_list_url, data=post_data) - self.assertEqual(response.status_code, 201) - self.xform = XForm.objects.all().order_by('pk').reverse()[0] - data.update({ - 'url': - 'http://testserver/api/v1/forms/%s' % (self.xform.pk) - }) - self.assertDictContainsSubset(data, response.data) - self.form_data = response.data + if not assert_: + return response + + self.assertEqual(response.status_code, 201) + self.xform = XForm.objects.all().order_by('pk').reverse()[0] + data.update({ + 'url': f'http://testserver/api/v1/forms/{self.xform.pk}' + }) + + self.assertEqual(dict(response.data, **data), response.data) + self.form_data = response.data def user_profile_data(self): return { @@ -111,9 +112,9 @@ def _add_permissions_to_user(self, user, save=True): `auth_permission`. Without this, actions on individual instances are immediately denied and object-level permissions are never considered. """ - if user.is_anonymous(): + if user.is_anonymous: user = User.objects.get(id=settings.ANONYMOUS_USER_ID) - user.user_permissions = Permission.objects.all() + user.user_permissions.set(Permission.objects.all()) if save: user.save() @@ -124,8 +125,8 @@ def _set_api_permissions(self, user): user.user_permissions.add(add_userprofile) def _create_user_profile(self, extra_post_data={}): - self.profile_data = dict( - self.profile_data.items() + extra_post_data.items()) + self.profile_data = dict(self.profile_data) + self.profile_data.update(extra_post_data) user, created = User.objects.get_or_create( username=self.profile_data['username'], first_name=self.profile_data['name'], @@ -155,11 +156,11 @@ def _login_user_and_profile(self, extra_post_data={}): 'HTTP_AUTHORIZATION': 'Token %s' % self.user.auth_token} def _add_uuid_to_submission_xml(self, path, xform): - tmp_file = NamedTemporaryFile(delete=False) + tmp_file = NamedTemporaryFile(delete=False, mode='w') split_xml = None - with open(path) as _file: - split_xml = re.split(r'()', _file.read()) + with open(path, 'rb') as _file: + split_xml = re.split(r'()', _file.read().decode()) split_xml[1:1] = [ '%s' % xform.uuid @@ -183,7 +184,7 @@ def _make_submission(self, path, username=None, add_uuid=False, if add_uuid: path = self._add_uuid_to_submission_xml(path, self.xform) - with open(path) as f: + with open(path, 'rb') as f: post_data = {'xml_submission_file': f} if media_file is not None: @@ -247,7 +248,7 @@ def _submit_transport_instance_w_attachment(self, media_file = "1335783522563.jpg" path = os.path.join(self.main_directory, 'fixtures', 'transportation', 'instances', s, media_file) - with open(path) as f: + with open(path, 'rb') as f: self._make_submission(os.path.join( self.main_directory, 'fixtures', 'transportation', 'instances', s, s + '.xml'), media_file=f) @@ -281,7 +282,7 @@ def _add_form_metadata( } if path and data_value: - with open(path) as media_file: + with open(path, 'rb') as media_file: data.update({ 'data_file': media_file, }) diff --git a/onadata/apps/api/tests/viewsets/test_attachment_viewset.py b/onadata/apps/api/tests/viewsets/test_attachment_viewset.py index a0c6ab4d5..61d6e89d2 100644 --- a/onadata/apps/api/tests/viewsets/test_attachment_viewset.py +++ b/onadata/apps/api/tests/viewsets/test_attachment_viewset.py @@ -1,8 +1,8 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from os import path +from django.utils.six import string_types + from onadata.apps.api.tests.viewsets.test_abstract_viewset import \ TestAbstractViewSet from onadata.apps.api.viewsets.attachment_viewset import AttachmentViewSet @@ -11,7 +11,7 @@ class TestAttachmentViewSet(TestAbstractViewSet): def setUp(self): - super(TestAttachmentViewSet, self).setUp() + super().setUp() self.retrieve_view = AttachmentViewSet.as_view({ 'get': 'retrieve' }) @@ -112,7 +112,7 @@ def test_direct_image_link(self): request = self.factory.get('/', data, **self.extra) response = self.retrieve_view(request, pk=self.attachment.pk) self.assertEqual(response.status_code, 200) - self.assertTrue(isinstance(response.data, basestring)) + self.assertTrue(isinstance(response.data, string_types)) self.assertEqual(response.data, self.attachment.secure_url()) data['filename'] = 10000000 @@ -137,5 +137,5 @@ def test_direct_image_link_uppercase(self): request = self.factory.get('/', data, **self.extra) response = self.retrieve_view(request, pk=self.attachment.pk) self.assertEqual(response.status_code, 200) - self.assertTrue(isinstance(response.data, basestring)) + self.assertTrue(isinstance(response.data, string_types)) self.assertEqual(response.data, self.attachment.secure_url()) diff --git a/onadata/apps/api/tests/viewsets/test_briefcase_api.py b/onadata/apps/api/tests/viewsets/test_briefcase_api.py index 69e582057..f44704b94 100644 --- a/onadata/apps/api/tests/viewsets/test_briefcase_api.py +++ b/onadata/apps/api/tests/viewsets/test_briefcase_api.py @@ -1,10 +1,7 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os -import codecs -from django.core.urlresolvers import reverse +from django.urls import reverse from django.core.files.storage import get_storage_class from django_digest.test import DigestAuth from rest_framework.test import APIRequestFactory @@ -68,11 +65,11 @@ def test_view_submission_list(self): self.assertEqual(instances.count(), NUM_INSTANCES) last_index = instances[instances.count() - 1].pk - with codecs.open(submission_list_path, 'rb', encoding='utf-8') as f: - expected_submission_list = f.read() + with open(submission_list_path, 'rb') as f: + expected_submission_list = f.read().decode() expected_submission_list = \ expected_submission_list.replace( - '{{resumptionCursor}}', '%s' % last_index) + '{{resumptionCursor}}', str(last_index)) self.assertContains(response, expected_submission_list) def test_view_submission_list_w_deleted_submission(self): @@ -98,7 +95,7 @@ def test_view_submission_list_w_deleted_submission(self): self.assertEqual(instances.count(), NUM_INSTANCES - 1) last_index = instances[instances.count() - 1].pk - with codecs.open(submission_list_path, 'rb', encoding='utf-8') as f: + with open(submission_list_path, 'r') as f: expected_submission_list = f.read() expected_submission_list = \ expected_submission_list.replace( @@ -189,7 +186,7 @@ def get_last_index(xform, last_index=None): submission_list_path = os.path.join( self.main_directory, 'fixtures', 'transportation', 'view', filename) - with codecs.open(submission_list_path, encoding='utf-8') as f: + with open(submission_list_path, 'r') as f: expected_submission_list = f.read() last_expected_submission_list = expected_submission_list = \ expected_submission_list.replace( @@ -202,13 +199,13 @@ def test_view_download_submission(self): self._publish_xml_form() self.maxDiff = None self._submit_transport_instance_w_attachment() - instanceId = '5b2cc313-fc09-437e-8149-fcd32f695d41' - instance = Instance.objects.get(uuid=instanceId) - formId = '%(formId)s[@version=null and @uiVersion=null]/' \ - '%(formId)s[@key=uuid:%(instanceId)s]' % { + instance_id = '5b2cc313-fc09-437e-8149-fcd32f695d41' + instance = Instance.objects.get(uuid=instance_id) + form_id = '%(formId)s[@version=null and @uiVersion=null]/' \ + '%(formId)s[@key=uuid:%(instanceId)s]' % { 'formId': self.xform.id_string, - 'instanceId': instanceId} - params = {'formId': formId} + 'instanceId': instance_id} + params = {'formId': form_id} auth = DigestAuth(self.login_username, self.login_password) request = self.factory.get( self._download_submission_url, data=params) @@ -216,18 +213,17 @@ def test_view_download_submission(self): self.assertEqual(response.status_code, 401) request.META.update(auth(request.META, response)) response = view(request, username=self.user.username) - text = "uuid:%s" % instanceId download_submission_path = os.path.join( self.main_directory, 'fixtures', 'transportation', 'view', 'downloadSubmission.xml') - with codecs.open(download_submission_path, encoding='utf-8') as f: + with open(download_submission_path, mode='r') as f: text = f.read() text = text.replace('{{submissionDate}}', instance.date_created.isoformat()) text = text.replace('{{xform_uuid}}', self.xform.uuid) - self.assertContains(response, instanceId, status_code=200) - self.assertMultiLineEqual(response.content, text) + self.assertContains(response, instance_id, status_code=200) + self.assertMultiLineEqual(response.content.decode('utf-8'), text) def test_view_download_submission_other_user(self): view = BriefcaseApi.as_view({'get': 'retrieve'}) @@ -273,7 +269,7 @@ def test_publish_xml_form_other_user(self): self._create_user_profile(alice_data) count = XForm.objects.count() - with codecs.open(self.form_def_path, encoding='utf-8') as f: + with open(self.form_def_path, 'rb') as f: params = {'form_def_file': f, 'dataFile': ''} auth = DigestAuth('alice', 'alicealice') request = self.factory.post(self._form_upload_url, data=params) @@ -290,7 +286,7 @@ def test_publish_xml_form_where_filename_is_not_id_string(self): self.main_directory, 'fixtures', 'transportation', 'Transportation Form.xml') count = XForm.objects.count() - with codecs.open(form_def_path, encoding='utf-8') as f: + with open(form_def_path, 'rb') as f: params = {'form_def_file': f, 'dataFile': ''} auth = DigestAuth(self.login_username, self.login_password) request = self.factory.post(self._form_upload_url, data=params) @@ -312,7 +308,7 @@ def _publish_xml_form(self, auth=None): view = BriefcaseApi.as_view({'post': 'create'}) count = XForm.objects.count() - with codecs.open(self.form_def_path, encoding='utf-8') as f: + with open(self.form_def_path, 'rb') as f: params = {'form_def_file': f, 'dataFile': ''} auth = auth or DigestAuth(self.login_username, self.login_password) request = self.factory.post(self._form_upload_url, data=params) @@ -335,7 +331,7 @@ def test_form_upload(self): view = BriefcaseApi.as_view({'post': 'create'}) self._publish_xml_form() - with codecs.open(self.form_def_path, encoding='utf-8') as f: + with open(self.form_def_path, 'rb') as f: params = {'form_def_file': f, 'dataFile': ''} auth = DigestAuth(self.login_username, self.login_password) request = self.factory.post(self._form_upload_url, data=params) @@ -350,11 +346,11 @@ def test_form_upload(self): request.META.update(auth(request.META, response)) response = view(request, username=self.user.username) self.assertEqual(response.status_code, 400) - - self.assertEqual( - response.data, - {'message': 'Form with this id or SMS-keyword already exists.' - } + # SQLite returns `UNIQUE constraint failed` whereas PostgreSQL + # returns 'duplicate key ... violates unique constraint' + self.assertIn( + 'unique constraint', + response.data['message'].lower(), ) def test_upload_head_request(self): @@ -383,7 +379,7 @@ def test_submission_with_instance_id_on_root_node(self): self.main_directory, 'fixtures', 'transportation', 'view', 'submission.xml') count = Instance.objects.count() - with codecs.open(submission_path, encoding='utf-8') as f: + with open(submission_path, 'rb') as f: post_data = {'xml_submission_file': f} request = self.factory.post(self._submission_list_url, post_data) response = view(request) diff --git a/onadata/apps/api/tests/viewsets/test_connect_viewset.py b/onadata/apps/api/tests/viewsets/test_connect_viewset.py index f022bcc44..2e5b2e18b 100644 --- a/onadata/apps/api/tests/viewsets/test_connect_viewset.py +++ b/onadata/apps/api/tests/viewsets/test_connect_viewset.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django_digest.test import DigestAuth, BasicAuth from rest_framework import authentication @@ -12,21 +10,28 @@ class TestConnectViewSet(TestAbstractViewSet): def setUp(self): - super(self.__class__, self).setUp() + super().setUp() self.view = ConnectViewSet.as_view({ "get": "list", }) + + # PostgreSQL behaves differently than SQLite. After each test, table is + # truncated but PostgreSQL does not reset its sequences but SQLite does. + # `self.user_profile_data()` does contain the real value of user's id. + # let's use it. + user_profile_data = self.user_profile_data() + self.data = { - 'id': 1, - 'username': 'bob', - 'name': 'Bob', - 'email': 'bob@columbia.edu', - 'city': 'Bobville', - 'country': 'US', - 'organization': 'Bob Inc.', - 'website': 'bob.com', - 'twitter': 'boberama', - 'gravatar': self.user.profile.gravatar, + 'id': user_profile_data['id'], + 'username': user_profile_data['username'], + 'name': user_profile_data['name'], + 'email': user_profile_data['email'], + 'city': user_profile_data['city'], + 'country': user_profile_data['country'], + 'organization': user_profile_data['organization'], + 'website': user_profile_data['website'], + 'twitter': user_profile_data['twitter'], + 'gravatar': user_profile_data['gravatar'], 'require_auth': False, 'api_token': self.user.auth_token.key, 'temp_token': self.client.session.session_key, @@ -51,7 +56,7 @@ def test_user_list_with_digest(self): response = view(request) self.assertTrue(response.has_header('WWW-Authenticate')) self.assertTrue( - response['WWW-Authenticate'].startswith('Digest nonce=')) + response['WWW-Authenticate'].startswith('Digest realm="DJANGO", qop="auth", nonce=')) request = self.factory.get('/') request.META.update(auth(request.META, response)) request.session = self.client.session diff --git a/onadata/apps/api/tests/viewsets/test_data_viewset.py b/onadata/apps/api/tests/viewsets/test_data_viewset.py index f75b02389..cdc145726 100644 --- a/onadata/apps/api/tests/viewsets/test_data_viewset.py +++ b/onadata/apps/api/tests/viewsets/test_data_viewset.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import requests from django.test import RequestFactory @@ -23,7 +21,7 @@ def enketo_mock(url, request): response = requests.Response() response.status_code = 201 - response._content = '{"url": "https://hmh2a.enketo.formhub.org"}' + response._content = b'{"url": "https://hmh2a.enketo.formhub.org"}' return response @@ -52,7 +50,7 @@ def _data_instance(dataid): class TestDataViewSet(TestBase): def setUp(self): - super(self.__class__, self).setUp() + super().setUp() self._create_user_and_login() self._publish_transportation_form() self.factory = RequestFactory() @@ -70,7 +68,7 @@ def test_data(self): data = _data_list(formid) self.assertEqual(response.data, data) - # redo the request since it's been consummed + # redo the request since it's been consumed request = self.factory.get('/', **self.extra) response = view(request, pk=formid) self.assertEqual(response.status_code, status.HTTP_200_OK) @@ -79,13 +77,16 @@ def test_data(self): dataid = self.xform.instances.all().order_by('id')[0].pk data = _data_instance(dataid) - self.assertDictContainsSubset(data, sorted(response.data)[0]) + response_first_element = sorted(response.data, key=lambda x: x['_id'])[0] + self.assertEqual(dict(response_first_element, **data), + response_first_element) view = DataViewSet.as_view({'get': 'retrieve'}) response = view(request, pk=formid, dataid=dataid) self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertIsInstance(response.data, dict) - self.assertDictContainsSubset(data, response.data) + self.assertEqual(dict(response.data, **data), + response.data) def test_data_anon(self): self._make_submissions() @@ -104,7 +105,9 @@ def test_data_anon(self): self.assertTrue(self.xform.instances.count()) dataid = self.xform.instances.all().order_by('id')[0].pk data = _data_instance(dataid) - self.assertDictContainsSubset(data, sorted(response.data)[0]) + response_first_element = sorted(response.data, key=lambda x: x['_id'])[0] + self.assertEqual(dict(response_first_element, **data), + response_first_element) data = { '_xform_id_string': 'transportation_2011_07_25', @@ -117,7 +120,8 @@ def test_data_anon(self): response = view(request, pk=formid, dataid=dataid) self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertIsInstance(response.data, dict) - self.assertDictContainsSubset(data, response.data) + self.assertEqual(dict(response.data, **data), + response.data) def test_data_bad_formid(self): self._make_submissions() @@ -247,8 +251,9 @@ def test_data_list_filter_by_user(self): response = view(request) self.assertEqual(response.status_code, status.HTTP_200_OK) # should be both bob's and alice's form - self.assertEqual(sorted(response.data), - sorted([bobs_data, alice_data])) + sorted_response_data = sorted(response.data, key=lambda x: x['id']) + self.assertEqual(sorted_response_data, + [bobs_data, alice_data]) # apply filter, see only bob's forms request = self.factory.get('/', data={'owner': 'bob'}, **self.extra) @@ -313,7 +318,9 @@ def test_get_form_public_data(self): self.assertTrue(self.xform.instances.count()) dataid = self.xform.instances.all().order_by('id')[0].pk data = _data_instance(dataid) - self.assertDictContainsSubset(data, sorted(response.data)[0]) + response_first_element = sorted(response.data, key=lambda x: x['_id'])[0] + self.assertEqual(dict(response_first_element, **data), + response_first_element) # access to a public data as other user self._create_user_and_login('alice', 'alice') @@ -327,7 +334,9 @@ def test_get_form_public_data(self): self.assertTrue(self.xform.instances.count()) dataid = self.xform.instances.all().order_by('id')[0].pk data = _data_instance(dataid) - self.assertDictContainsSubset(data, sorted(response.data)[0]) + response_first_element = sorted(response.data, key=lambda x: x['_id'])[0] + self.assertEqual(dict(response_first_element, **data), + response_first_element) def test_data_w_attachment(self): self._submit_transport_instance_w_attachment() @@ -363,7 +372,9 @@ def test_data_w_attachment(self): '_status': 'submitted_via_web', '_id': dataid } - self.assertDictContainsSubset(data, sorted(response.data)[0]) + response_first_element = sorted(response.data, key=lambda x: x['_id'])[0] + self.assertEqual(dict(response_first_element, **data), + response_first_element) data = { '_xform_id_string': 'transportation_2011_07_25', @@ -371,11 +382,13 @@ def test_data_w_attachment(self): 'none', '_submitted_by': 'bob', } + view = DataViewSet.as_view({'get': 'retrieve'}) response = view(request, pk=formid, dataid=dataid) self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertIsInstance(response.data, dict) - self.assertDictContainsSubset(data, response.data) + self.assertEqual(dict(response.data, **data), + response.data) def test_delete_submission(self): self._make_submissions() @@ -389,7 +402,7 @@ def test_delete_submission(self): self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT) count = self.xform.instances.all().count() - self.assertEquals(before_count - 1, count) + self.assertEqual(before_count - 1, count) self._create_user_and_login(username='alice', password='alice') # Allow Alice to delete submissions. assign_perm(CAN_VIEW_XFORM, self.user, self.xform) @@ -409,5 +422,5 @@ def test_delete_submission(self): response = view(request, pk=formid, dataid=dataid) self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT) count = self.xform.instances.all().count() - self.assertEquals(before_count - 2, count) + self.assertEqual(before_count - 2, count) diff --git a/onadata/apps/api/tests/viewsets/test_export_viewset.py b/onadata/apps/api/tests/viewsets/test_export_viewset.py index f049c84c3..b5f25dd07 100644 --- a/onadata/apps/api/tests/viewsets/test_export_viewset.py +++ b/onadata/apps/api/tests/viewsets/test_export_viewset.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os from django.test import RequestFactory @@ -13,7 +11,7 @@ class TestExportViewSet(TestBase): def setUp(self): - super(self.__class__, self).setUp() + super().setUp() self._create_user_and_login() self._publish_transportation_form() self.factory = RequestFactory() diff --git a/onadata/apps/api/tests/viewsets/test_metadata_viewset.py b/onadata/apps/api/tests/viewsets/test_metadata_viewset.py index 3c5a0e207..126d063b9 100644 --- a/onadata/apps/api/tests/viewsets/test_metadata_viewset.py +++ b/onadata/apps/api/tests/viewsets/test_metadata_viewset.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os from django.conf import settings @@ -19,7 +17,7 @@ class TestMetaDataViewSet(TestAbstractViewSet): def setUp(self): - super(TestMetaDataViewSet, self).setUp() + super().setUp() self.view = MetaDataViewSet.as_view({ 'delete': 'destroy', 'get': 'retrieve', @@ -80,7 +78,7 @@ def test_delete_metadata(self): def test_windows_csv_file_upload_to_metadata(self): data_value = 'transportation.csv' path = os.path.join(self.fixture_dir, data_value) - with open(path) as f: + with open(path, 'rb') as f: f = InMemoryUploadedFile( f, 'media', data_value, 'text/csv', 2625, None) data = { diff --git a/onadata/apps/api/tests/viewsets/test_note_viewset.py b/onadata/apps/api/tests/viewsets/test_note_viewset.py index 689d645de..eb2a46b04 100644 --- a/onadata/apps/api/tests/viewsets/test_note_viewset.py +++ b/onadata/apps/api/tests/viewsets/test_note_viewset.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.test import RequestFactory from onadata.apps.api.viewsets.note_viewset import NoteViewSet @@ -10,7 +8,7 @@ class TestNoteViewSet(TestBase): def setUp(self): - super(self.__class__, self).setUp() + super().setUp() self._create_user_and_login() self._publish_transportation_form() self._make_submissions() @@ -43,7 +41,8 @@ def test_note_list(self): response = self.view(request) self.assertEqual(response.status_code, 200) self.assertTrue(len(response.data) > 0) - self.assertDictContainsSubset(self.note, response.data[0]) + self.assertEqual(dict(response.data[0], **self.note), + response.data[0]) def test_note_get(self): self._add_notes_to_data_point() @@ -53,7 +52,8 @@ def test_note_get(self): request = self.factory.get('/', **self.extra) response = view(request, pk=self.pk) self.assertEqual(response.status_code, 200) - self.assertDictContainsSubset(self.note, response.data) + self.assertEqual(dict(response.data, **self.note), + response.data) def test_add_notes_to_data_point(self): self._add_notes_to_data_point() @@ -130,4 +130,4 @@ def test_delete_note(self): request = self.factory.get('/', **self.extra) response = self.view(request) self.assertEqual(response.status_code, 200) - self.assertEquals(response.data, []) + self.assertEqual(response.data, []) diff --git a/onadata/apps/api/tests/viewsets/test_xform_list_api.py b/onadata/apps/api/tests/viewsets/test_xform_list_api.py index 2a59d58c4..42a263950 100644 --- a/onadata/apps/api/tests/viewsets/test_xform_list_api.py +++ b/onadata/apps/api/tests/viewsets/test_xform_list_api.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os from django.conf import settings @@ -18,7 +16,7 @@ class TestXFormListApi(TestAbstractViewSet): def setUp(self): - super(self.__class__, self).setUp() + super().setUp() self.view = XFormListApi.as_view({ "get": "list" }) @@ -37,11 +35,11 @@ def test_get_xform_list(self): os.path.dirname(__file__), '..', 'fixtures', 'formList.xml') - with open(path) as f: + with open(path, 'r') as f: form_list_xml = f.read().strip() data = {"hash": self.xform.hash, "pk": self.xform.pk} content = response.render().content - self.assertEqual(content, form_list_xml % data) + self.assertEqual(content.decode('utf-8'), form_list_xml % data) self.assertTrue(response.has_header('X-OpenRosa-Version')) self.assertTrue( response.has_header('X-OpenRosa-Accept-Content-Length')) @@ -62,7 +60,7 @@ def test_get_xform_list_inactive_form(self): xml = '\n\n\nscreenshot.png%(hash)shttp://testserver/bob/xformsMedia/%(xform)s/%(pk)s.png""" # noqa data = {"hash": self.metadata.hash, "pk": self.metadata.pk, "xform": self.xform.pk} - content = response.render().content.strip() + content = response.render().content.decode('utf-8').strip() self.assertEqual(content, manifest_xml % data) self.assertTrue(response.has_header('X-OpenRosa-Version')) self.assertTrue( @@ -307,7 +305,7 @@ def test_retrieve_xform_manifest_anonymous_user(self): screenshot.png%(hash)shttp://testserver/bob/xformsMedia/%(xform)s/%(pk)s.png""" # noqa data = {"hash": self.metadata.hash, "pk": self.metadata.pk, "xform": self.xform.pk} - content = response.render().content.strip() + content = response.render().content.decode('utf-8').strip() self.assertEqual(content, manifest_xml % data) self.assertTrue(response.has_header('X-OpenRosa-Version')) self.assertTrue( diff --git a/onadata/apps/api/tests/viewsets/test_xform_submission_api.py b/onadata/apps/api/tests/viewsets/test_xform_submission_api.py index d059ff01f..bbec28dcf 100644 --- a/onadata/apps/api/tests/viewsets/test_xform_submission_api.py +++ b/onadata/apps/api/tests/viewsets/test_xform_submission_api.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os import simplejson as json @@ -20,7 +18,7 @@ class TestXFormSubmissionApi(TestAbstractViewSet): def setUp(self): - super(self.__class__, self).setUp() + super().setUp() self.view = XFormSubmissionApi.as_view({ "head": "create", "post": "create" @@ -32,7 +30,7 @@ def test_post_submission_anonymous(self): media_file = "1335783522563.jpg" path = os.path.join(self.main_directory, 'fixtures', 'transportation', 'instances', s, media_file) - with open(path) as f: + with open(path, 'rb') as f: f = InMemoryUploadedFile(f, 'media_file', media_file, 'image/jpg', os.path.getsize(path), None) submission_path = os.path.join( @@ -62,7 +60,7 @@ def test_post_submission_authenticated(self): media_file = "1335783522563.jpg" path = os.path.join(self.main_directory, 'fixtures', 'transportation', 'instances', s, media_file) - with open(path) as f: + with open(path, 'rb') as f: f = InMemoryUploadedFile(f, 'media_file', media_file, 'image/jpg', os.path.getsize(path), None) @@ -70,7 +68,7 @@ def test_post_submission_authenticated(self): self.main_directory, 'fixtures', 'transportation', 'instances', s, s + '.xml') - with open(submission_path) as sf: + with open(submission_path, 'rb') as sf: data = {'xml_submission_file': sf, 'media_file': f} request = self.factory.post('/submission', data) response = self.view(request) @@ -106,7 +104,7 @@ def test_post_submission_uuid_other_user_username_not_provided(self): media_file = "1335783522563.jpg" path = os.path.join(self.main_directory, 'fixtures', 'transportation', 'instances', s, media_file) - with open(path) as f: + with open(path, 'rb') as f: f = InMemoryUploadedFile(f, 'media_file', media_file, 'image/jpg', os.path.getsize(path), None) path = os.path.join( @@ -114,7 +112,7 @@ def test_post_submission_uuid_other_user_username_not_provided(self): 'transportation', 'instances', s, s + '.xml') path = self._add_uuid_to_submission_xml(path, self.xform) - with open(path) as sf: + with open(path, 'rb') as sf: data = {'xml_submission_file': sf, 'media_file': f} request = self.factory.post('/submission', data) response = self.view(request) @@ -135,7 +133,7 @@ def test_post_submission_authenticated_json(self): '..', 'fixtures', 'transport_submission.json') - with open(path) as f: + with open(path, 'rb') as f: data = json.loads(f.read()) request = self.factory.post('/submission', data, format='json') response = self.view(request) @@ -158,33 +156,6 @@ def test_post_submission_authenticated_json(self): self.assertEqual(response['Location'], 'http://testserver/submission') - def test_post_submission_authenticated_json_with_geo(self): - path = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - '..', - 'fixtures', - 'movie_form_submission.json') - with open(path) as f: - data = json.loads(f.read()) - request = self.factory.post('/submission', data, format='json') - response = self.view(request) - self.assertEqual(response.status_code, 401) - - request = self.factory.post('/submission', data, format='json') - auth = DigestAuth('bob', 'bobbob') - request.META.update(auth(request.META, response)) - response = self.view(request) - self.assertContains(response, 'error":"Improperly', - status_code=400) - self.assertTrue(response.has_header('X-OpenRosa-Version')) - self.assertTrue( - response.has_header('X-OpenRosa-Accept-Content-Length')) - self.assertTrue(response.has_header('Date')) - self.assertEqual(response['Content-Type'], - 'application/json') - self.assertEqual(response['Location'], - 'http://testserver/submission') - def test_post_submission_authenticated_bad_json(self): path = os.path.join( os.path.dirname(os.path.abspath(__file__)), @@ -201,15 +172,21 @@ def test_post_submission_authenticated_bad_json(self): auth = DigestAuth('bob', 'bobbob') request.META.update(auth(request.META, response)) response = self.view(request) - self.assertContains(response, 'error":"Received empty submission', - status_code=400) - self.assertTrue(response.has_header('X-OpenRosa-Version')) + rendered_response = response.render() + self.assertTrue('error' in rendered_response.data) self.assertTrue( - response.has_header('X-OpenRosa-Accept-Content-Length')) - self.assertTrue(response.has_header('Date')) - self.assertEqual(response['Content-Type'], + rendered_response.data['error'].startswith( + 'Received empty submission' + ) + ) + self.assertTrue(rendered_response.status_code == 400) + self.assertTrue(rendered_response.has_header('X-OpenRosa-Version')) + self.assertTrue( + rendered_response.has_header('X-OpenRosa-Accept-Content-Length')) + self.assertTrue(rendered_response.has_header('Date')) + self.assertEqual(rendered_response['Content-Type'], 'application/json') - self.assertEqual(response['Location'], + self.assertEqual(rendered_response['Location'], 'http://testserver/submission') def test_post_submission_require_auth(self): @@ -220,7 +197,7 @@ def test_post_submission_require_auth(self): media_file = "1335783522563.jpg" path = os.path.join(self.main_directory, 'fixtures', 'transportation', 'instances', s, media_file) - with open(path) as f: + with open(path, 'rb') as f: f = InMemoryUploadedFile(f, 'media_file', media_file, 'image/jpg', os.path.getsize(path), None) submission_path = os.path.join( @@ -262,7 +239,7 @@ def test_post_submission_require_auth_anonymous_user(self): media_file = "1335783522563.jpg" path = os.path.join(self.main_directory, 'fixtures', 'transportation', 'instances', s, media_file) - with open(path) as f: + with open(path, 'rb') as f: f = InMemoryUploadedFile(f, 'media_file', media_file, 'image/jpg', os.path.getsize(path), None) submission_path = os.path.join( @@ -294,7 +271,7 @@ def test_post_submission_require_auth_other_user(self): media_file = "1335783522563.jpg" path = os.path.join(self.main_directory, 'fixtures', 'transportation', 'instances', s, media_file) - with open(path) as f: + with open(path, 'rb') as f: f = InMemoryUploadedFile(f, 'media_file', media_file, 'image/jpg', os.path.getsize(path), None) submission_path = os.path.join( @@ -340,7 +317,7 @@ def test_post_submission_require_auth_data_entry_role(self): media_file = "1335783522563.jpg" path = os.path.join(self.main_directory, 'fixtures', 'transportation', 'instances', s, media_file) - with open(path) as f: + with open(path, 'rb') as f: f = InMemoryUploadedFile(f, 'media_file', media_file, 'image/jpg', os.path.getsize(path), None) submission_path = os.path.join( diff --git a/onadata/apps/api/tests/viewsets/test_xform_viewset.py b/onadata/apps/api/tests/viewsets/test_xform_viewset.py index 5fe3aaba6..c48c6f30a 100644 --- a/onadata/apps/api/tests/viewsets/test_xform_viewset.py +++ b/onadata/apps/api/tests/viewsets/test_xform_viewset.py @@ -1,18 +1,11 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os import re -from datetime import datetime -from xml.dom import minidom, Node -import pytz -import requests from django.conf import settings -from django.utils import timezone from guardian.shortcuts import assign_perm -from httmock import HTTMock, all_requests from rest_framework import status +from xml.dom import minidom, Node from onadata.apps.api.tests.viewsets.test_abstract_viewset import \ TestAbstractViewSet @@ -24,30 +17,10 @@ from onadata.libs.serializers.xform_serializer import XFormSerializer -@all_requests -def enketo_mock(url, request): - response = requests.Response() - response.status_code = 201 - response._content = \ - '{\n "url": "https:\\/\\/dmfrm.enketo.org\\/webform",\n'\ - ' "code": "200"\n}' - return response - - -@all_requests -def enketo_error_mock(url, request): - response = requests.Response() - response.status_code = 400 - response._content = \ - '{\n "message": "no account exists for this OpenRosa server",\n'\ - ' "code": "200"\n}' - return response - - class TestXFormViewSet(TestAbstractViewSet): def setUp(self): - super(self.__class__, self).setUp() + super().setUp() self.view = XFormViewSet.as_view({ 'get': 'list', }) @@ -79,7 +52,7 @@ def test_form_list_other_user_access(self): alice_data = {'username': 'alice', 'email': 'alice@localhost.com'} self._login_user_and_profile(extra_post_data=alice_data) self.assertEqual(self.user.username, 'alice') - self.assertNotEqual(previous_user, self.user) + self.assertNotEqual(previous_user, self.user) request = self.factory.get('/', **self.extra) response = self.view(request) self.assertEqual(response.status_code, status.HTTP_200_OK) @@ -94,7 +67,7 @@ def test_form_list_filter_by_user(self): alice_data = {'username': 'alice', 'email': 'alice@localhost.com'} self._login_user_and_profile(extra_post_data=alice_data) self.assertEqual(self.user.username, 'alice') - self.assertNotEqual(previous_user, self.user) + self.assertNotEqual(previous_user, self.user) assign_perm(CAN_VIEW_XFORM, self.user, self.xform) view = XFormViewSet.as_view({ @@ -111,8 +84,10 @@ def test_form_list_filter_by_user(self): response = self.view(request) self.assertEqual(response.status_code, status.HTTP_200_OK) # should be both bob's and alice's form - self.assertEqual(sorted(response.data), - sorted([bobs_form_data, self.form_data])) + + sorted_response_data = sorted(response.data, key=lambda x: x['formid']) + self.assertEqual(sorted_response_data, + [bobs_form_data, self.form_data]) # apply filter, see only bob's forms request = self.factory.get('/', data={'owner': 'bob'}, **self.extra) @@ -158,13 +133,14 @@ def test_form_format(self): } request = self.factory.get('/', **self.extra) # test for unsupported format - response = view(request, pk=formid, format='csvzip') + response = view(request, pk=formid, format='xlsx') self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) # test for supported formats response = view(request, pk=formid, format='json') self.assertEqual(response.status_code, status.HTTP_200_OK) - self.assertDictContainsSubset(data, response.data) + self.assertEqual(dict(response.data, **data), + response.data) response = view(request, pk=formid, format='xml') self.assertEqual(response.status_code, status.HTTP_200_OK) response_doc = minidom.parseString(response.data) @@ -181,13 +157,13 @@ def test_form_format(self): n for n in response_doc.getElementsByTagName("h:head")[0].childNodes if n.nodeType == Node.ELEMENT_NODE and - n.tagName == "model"][0] + n.tagName == "model"][0] # check for UUID and remove uuid_nodes = [ node for node in model_node.childNodes if node.nodeType == Node.ELEMENT_NODE - and node.getAttribute("nodeset") == "/transportation_2011_07_25/formhub/uuid"] + and node.getAttribute("nodeset") == "/transportation_2011_07_25/formhub/uuid"] self.assertEqual(len(uuid_nodes), 1) uuid_node = uuid_nodes[0] uuid_node.setAttribute("calculate", "''") @@ -238,34 +214,6 @@ def test_form_tags(self): self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.data, []) - def test_enketo_url_no_account(self): - self.publish_xls_form() - view = XFormViewSet.as_view({ - 'get': 'enketo' - }) - formid = self.xform.pk - # no tags - request = self.factory.get('/', **self.extra) - with HTTMock(enketo_error_mock): - response = view(request, pk=formid) - data = {'message': "Enketo not properly configured."} - - self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - self.assertEqual(response.data, data) - - def test_enketo_url(self): - self.publish_xls_form() - view = XFormViewSet.as_view({ - 'get': 'enketo' - }) - formid = self.xform.pk - # no tags - request = self.factory.get('/', **self.extra) - with HTTMock(enketo_mock): - response = view(request, pk=formid) - data = {"enketo_url": "https://dmfrm.enketo.org/webform"} - self.assertEqual(response.data, data) - def test_publish_xlsform(self): view = XFormViewSet.as_view({ 'post': 'create' @@ -276,26 +224,24 @@ def test_publish_xlsform(self): 'public_data': False, 'description': 'transportation_2011_07_25', 'downloadable': True, - 'allows_sms': False, 'encrypted': False, - 'sms_id_string': 'transportation_2011_07_25', 'id_string': 'transportation_2011_07_25', - 'title': 'transportation_2011_07_25', + 'title': 'transportation_2011_07_25' } path = os.path.join( settings.ONADATA_DIR, "apps", "main", "tests", "fixtures", "transportation", "transportation.xls") - with open(path) as xls_file: + with open(path, 'rb') as xls_file: post_data = {'xls_file': xls_file} request = self.factory.post('/', data=post_data, **self.extra) response = view(request) self.assertEqual(response.status_code, status.HTTP_201_CREATED) xform = self.user.xforms.get(uuid=response.data.get('uuid')) data.update({ - 'url': - 'http://testserver/api/v1/forms/%s' % xform.pk + 'url': f'http://testserver/api/v1/forms/{xform.pk}' }) - self.assertDictContainsSubset(data, response.data) + self.assertEqual(dict(response.data, **data), + response.data) self.assertTrue(xform.user.pk == self.user.pk) def test_publish_invalid_xls_form(self): @@ -305,7 +251,7 @@ def test_publish_invalid_xls_form(self): path = os.path.join( settings.ONADATA_DIR, "apps", "main", "tests", "fixtures", "transportation", "transportation.bad_id.xls") - with open(path) as xls_file: + with open(path, 'rb') as xls_file: post_data = {'xls_file': xls_file} request = self.factory.post('/', data=post_data, **self.extra) response = view(request) @@ -320,7 +266,7 @@ def test_publish_invalid_xls_form_no_choices(self): path = os.path.join( settings.ONADATA_DIR, "apps", "main", "tests", "fixtures", "transportation", "transportation.no_choices.xls") - with open(path) as xls_file: + with open(path, 'rb') as xls_file: post_data = {'xls_file': xls_file} request = self.factory.post('/', data=post_data, **self.extra) response = view(request) @@ -390,7 +336,7 @@ def test_set_form_bad_value(self): self.assertFalse(self.xform.__getattribute__(key)) self.assertEqual(response.data, {'shared': - ["'String' value must be either True or False."]}) + ["'String' value must be either True or False."]}) def test_set_form_bad_key(self): self.publish_xls_form() @@ -429,7 +375,6 @@ def test_xform_serializer_none(self): 'require_auth': False, 'description': '', 'downloadable': False, - 'allows_sms': False, 'uuid': '', 'instances_with_geopoints': False, 'num_of_submissions': 0, @@ -474,3 +419,24 @@ def test_csv_import_fail_invalid_field_post(self): response = view(request, pk=self.xform.id) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertIsNotNone(response.data.get('error')) + + def test_cannot_publish_id_string_starting_with_number(self): + data = { + 'owner': self.user.username, + 'public': False, + 'public_data': False, + 'description': '2011_07_25_transportation', + 'downloadable': True, + 'encrypted': False, + 'id_string': '2011_07_25_transportation', + 'title': '2011_07_25_transportation', + } + + xls_path = os.path.join(settings.ONADATA_DIR, 'apps', 'main', 'tests', + 'fixtures', 'transportation', + 'transportation.id_starts_with_num.xls') + count = XForm.objects.count() + response = self.publish_xls_form(xls_path, data, assert_=False) + self.assertTrue('Names must begin with a letter' in response.content.decode()) + self.assertEqual(response.status_code, 400) + self.assertEqual(XForm.objects.count(), count) diff --git a/onadata/apps/api/tools.py b/onadata/apps/api/tools.py index 321d35490..f5e1001ec 100644 --- a/onadata/apps/api/tools.py +++ b/onadata/apps/api/tools.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import inspect import os import re @@ -18,7 +16,7 @@ from rest_framework import exceptions from taggit.forms import TagField -from onadata.apps.main.forms import QuickConverter +from onadata.apps.main.forms import QuickConverterForm from onadata.apps.main.models import UserProfile from onadata.apps.viewer.models.parsed_instance import datetime_from_str from onadata.libs.utils.logger_tools import publish_form @@ -45,23 +43,6 @@ def _get_id_for_type(record, mongo_field): return {"$substr": [mongo_str, 0, 10]} if isinstance(date_field, datetime)\ else mongo_str -# TODO verify tests without this method, then delete -# def get_accessible_forms(owner=None, shared_form=False, shared_data=False): -# xforms = XForm.objects.filter() -# -# if shared_form and not shared_data: -# xforms = xforms.filter(shared=True) -# elif (shared_form and shared_data) or \ -# (owner == 'public' and not shared_form and not shared_data): -# xforms = xforms.filter(Q(shared=True) | Q(shared_data=True)) -# elif not shared_form and shared_data: -# xforms = xforms.filter(shared_data=True) -# -# if owner != 'public': -# xforms = xforms.filter(user__username=owner) -# -# return xforms.distinct() - def publish_xlsform(request, user, existing_xform=None): """ @@ -84,7 +65,7 @@ def publish_xlsform(request, user, existing_xform=None): ) def set_form(): - form = QuickConverter(request.POST, request.FILES) + form = QuickConverterForm(request.POST, request.FILES) if existing_xform: return form.publish(user, existing_xform.id_string) else: @@ -207,24 +188,27 @@ def get_media_file_response(metadata): return HttpResponseRedirect(metadata.data_value) -def get_view_name(view_cls, suffix=None): - ''' Override Django REST framework's name for the base API class ''' +def get_view_name(view_obj): + """ + Override Django REST framework's name for the base API class + """ # The base API class should inherit directly from APIView. We can't use # issubclass() because ViewSets also inherit (indirectly) from APIView. try: - if inspect.getmro(view_cls)[1] is rest_framework_views.APIView: - return 'KoBo Api' # awkward capitalization for consistency + if inspect.getmro(view_obj.__class__)[1] is rest_framework_views.APIView: + return 'KoBo Api' # awkward capitalization for consistency except KeyError: pass - return rest_framework_views.get_view_name(view_cls, suffix) + return rest_framework_views.get_view_name(view_obj) -def get_view_description(view_cls, html=False): - ''' Replace example.com in Django REST framework's default API description - with the domain name of the current site ''' +def get_view_description(view_obj, html=False): + """ + Replace example.com in Django REST framework's default API description + with the domain name of the current site + """ domain = Site.objects.get_current().domain - description = rest_framework_views.get_view_description(view_cls, - html) + description = rest_framework_views.get_view_description(view_obj, html) # description might not be a plain string: e.g. it could be a SafeText # to prevent further HTML escaping original_type = type(description) diff --git a/onadata/apps/api/urls.py b/onadata/apps/api/urls.py index 8565c77a2..4fd8676fb 100644 --- a/onadata/apps/api/urls.py +++ b/onadata/apps/api/urls.py @@ -1,27 +1,26 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -from django.conf.urls import url +from django.urls import re_path from rest_framework import routers from rest_framework.response import Response from rest_framework.reverse import reverse from rest_framework.urlpatterns import format_suffix_patterns from rest_framework.views import APIView +from onadata.apps.api.viewsets.attachment_viewset import AttachmentViewSet +from onadata.apps.api.viewsets.briefcase_api import BriefcaseApi from onadata.apps.api.viewsets.connect_viewset import ConnectViewSet from onadata.apps.api.viewsets.data_viewset import DataViewSet from onadata.apps.api.viewsets.metadata_viewset import MetaDataViewSet from onadata.apps.api.viewsets.note_viewset import NoteViewSet -from onadata.apps.api.viewsets.xform_viewset import XFormViewSet -from onadata.apps.api.viewsets.attachment_viewset import AttachmentViewSet from onadata.apps.api.viewsets.xform_list_api import XFormListApi from onadata.apps.api.viewsets.xform_submission_api import XFormSubmissionApi -from onadata.apps.api.viewsets.briefcase_api import BriefcaseApi +from onadata.apps.api.viewsets.xform_viewset import XFormViewSet class MultiLookupRouter(routers.DefaultRouter): def __init__(self, *args, **kwargs): - super(MultiLookupRouter, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.lookups_routes = [] self.lookups_routes.append(routers.Route( url=r'^{prefix}/{lookups}{trailing_slash}$', @@ -32,12 +31,14 @@ def __init__(self, *args, **kwargs): 'delete': 'destroy' }, name='{basename}-detail', + detail=True, initkwargs={'suffix': 'Instance'} )) self.lookups_routes.append(self.make_routes('lookup')) self.lookups_routes.append(self.make_routes('lookups')) # Dynamically generated routes. # Generated using @action or @link decorators on methods of the viewset + self.lookups_routes.append(routers.Route( url=[ r'^{prefix}/{lookups}/{methodname}{trailing_slash}$', @@ -46,6 +47,7 @@ def __init__(self, *args, **kwargs): '{httpmethod}': '{methodname}', }, name='{basename}-{methodnamehyphen}', + detail=True, initkwargs={} )) @@ -58,6 +60,7 @@ def make_routes(template_text): 'post': 'create' }, name='{basename}-list', + detail=False, initkwargs={'suffix': 'List'}) def get_extra_lookup_regexes(self, route): @@ -85,35 +88,34 @@ def get_lookup_regexes(self, viewset): def get_lookup_routes(self, viewset): ret = [self.routes[0]] - # Determine any `@action` or `@link` decorated methods on the viewset - dynamic_routes = [] - for methodname in dir(viewset): - attr = getattr(viewset, methodname) - httpmethods = getattr(attr, 'bind_to_methods', None) - if httpmethods: - httpmethods = [method.lower() for method in httpmethods] - dynamic_routes.append((httpmethods, methodname)) - for route in self.lookups_routes: if route.mapping == {'{httpmethod}': '{methodname}'}: - # Dynamic routes (@link or @action decorator) - for httpmethods, methodname in dynamic_routes: + for extra_action in viewset.get_extra_actions(): + # FIXME support `url_path` and `url_name` of `@action` decorator + methodname = extra_action.__name__ + mapping = extra_action.mapping + detail = extra_action.detail initkwargs = route.initkwargs.copy() - initkwargs.update(getattr(viewset, methodname).kwargs) - mapping = dict( - (httpmethod, methodname) for httpmethod in httpmethods) - name = routers.replace_methodname(route.name, methodname) + initkwargs.update(extra_action.kwargs) + name = self.replace_methodname(route.name, methodname) if 'extra_lookup_fields' in initkwargs: uri = route.url[1] - uri = routers.replace_methodname(uri, methodname) + uri = self.replace_methodname(uri, methodname) ret.append(routers.Route( - url=uri, mapping=mapping, name='%s-extra' % name, + url=uri, + mapping=mapping, + name=f'{name}-extra', initkwargs=initkwargs, + detail=detail )) - uri = routers.replace_methodname(route.url[0], methodname) + + uri = self.replace_methodname(route.url[0], methodname) ret.append(routers.Route( - url=uri, mapping=mapping, name=name, + url=uri, + mapping=mapping, + name=name, initkwargs=initkwargs, + detail=detail )) else: # Standard route @@ -126,7 +128,7 @@ def get_routes(self, viewset): if lookup_fields: ret = self.get_lookup_routes(viewset) else: - ret = super(MultiLookupRouter, self).get_routes(viewset) + ret = super().get_routes(viewset) return ret def get_api_root_view(self): @@ -310,8 +312,8 @@ def get_urls(self): ret = [] if self.include_root_view: - root_url = url(r'^$', self.get_api_root_view(), - name=self.root_view_name) + root_url = re_path(r'^$', self.get_api_root_view(), + name=self.root_view_name) ret.append(root_url) for prefix, viewset, basename in self.registry: lookup = self.get_lookup_regex(viewset) @@ -336,11 +338,29 @@ def get_urls(self): ) view = viewset.as_view(mapping, **route.initkwargs) name = route.name.format(basename=basename) - ret.append(url(regex, view, name=name)) + ret.append(re_path(regex, view, name=name)) if self.include_format_suffixes: ret = format_suffix_patterns(ret, allowed=['[a-z0-9]+']) return ret + @staticmethod + def replace_methodname(format_string, methodname): + """ + Taken from old version of DRF for retro-compatibility. + (AFAIK, this method has been dropped in DRF 3.8) + + Partially format a format_string, swapping out any + '{methodname}' or '{methodnamehyphen}' components. + + @ToDo If DRF got rid of it, we should too? Let's find a better way to + achieve the same goal. + """ + methodnamehyphen = methodname.replace('_', '-') + ret = format_string + ret = ret.replace('{methodname}', methodname) + ret = ret.replace('{methodnamehyphen}', methodnamehyphen) + return ret + class MultiLookupRouterWithPatchList(MultiLookupRouter): """ @@ -357,19 +377,23 @@ def make_routes(template_text): 'delete': 'bulk_delete' }, name='{basename}-list', + detail=False, initkwargs={'suffix': 'List'}) router = MultiLookupRouter(trailing_slash=False) router.register(r'user', ConnectViewSet) router.register(r'forms', XFormViewSet) -router.register(r'notes', NoteViewSet, base_name='notes') -router.register(r'metadata', MetaDataViewSet, base_name='metadata') -router.register(r'media', AttachmentViewSet, base_name='attachment') -router.register(r'formlist', XFormListApi, base_name='formlist') -router.register(r'submissions', XFormSubmissionApi, base_name='submissions') -router.register(r'briefcase', BriefcaseApi, base_name='briefcase') +router.register(r'notes', NoteViewSet, basename='notes') +router.register(r'metadata', MetaDataViewSet, basename='metadata') +router.register(r'media', AttachmentViewSet, basename='attachment') +router.register(r'formlist', XFormListApi, basename='formlist') +router.register(r'submissions', XFormSubmissionApi, basename='submissions') +router.register(r'briefcase', BriefcaseApi, basename='briefcase') router_with_patch_list = MultiLookupRouterWithPatchList(trailing_slash=False) -router_with_patch_list.register(r'data', DataViewSet, base_name='data') +router_with_patch_list.register(r'data', DataViewSet, basename='data') + +#router_api_v1 = ExtendedDefaultRouter() +#data_routes = router_api_v1.register(r'data', DataViewSet, basename='data') diff --git a/onadata/apps/api/viewsets/__init__.py b/onadata/apps/api/viewsets/__init__.py index 134880430..57d631c3f 100644 --- a/onadata/apps/api/viewsets/__init__.py +++ b/onadata/apps/api/viewsets/__init__.py @@ -1,2 +1 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import diff --git a/onadata/apps/api/viewsets/attachment_viewset.py b/onadata/apps/api/viewsets/attachment_viewset.py index 80c3e3f66..0e8c3bdc6 100644 --- a/onadata/apps/api/viewsets/attachment_viewset.py +++ b/onadata/apps/api/viewsets/attachment_viewset.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.http import Http404 from django.utils.translation import ugettext as _ from rest_framework import renderers diff --git a/onadata/apps/api/viewsets/briefcase_api.py b/onadata/apps/api/viewsets/briefcase_api.py index 3b44a9b38..50c2b3d59 100644 --- a/onadata/apps/api/viewsets/briefcase_api.py +++ b/onadata/apps/api/viewsets/briefcase_api.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.core.files import File from django.core.validators import ValidationError from django.contrib.auth.models import User @@ -16,7 +14,7 @@ from rest_framework.generics import get_object_or_404 from rest_framework.renderers import BrowsableAPIRenderer from rest_framework.response import Response -from rest_framework.decorators import detail_route +from rest_framework.decorators import action from onadata.apps.api.tools import get_media_file_response from onadata.apps.api.permissions import ViewDjangoObjectPermissions @@ -65,7 +63,7 @@ def _parse_int(num): pass -class DoXmlFormUpload(): +class DoXmlFormUpload: def __init__(self, xml_file, user): self.xml_file = xml_file @@ -91,7 +89,7 @@ class BriefcaseApi(OpenRosaHeadersMixin, mixins.CreateModelMixin, template_name = 'openrosa_response.xml' def __init__(self, *args, **kwargs): - super(BriefcaseApi, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # Respect DEFAULT_AUTHENTICATION_CLASSES, but also ensure that the # previously hard-coded authentication classes are included first authentication_classes = [ @@ -117,11 +115,11 @@ def get_object(self): def filter_queryset(self, queryset): username = self.kwargs.get('username') - if username is None and self.request.user.is_anonymous(): + if username is None and self.request.user.is_anonymous: # raises a permission denied exception, forces authentication self.permission_denied(self.request) - if username is not None and self.request.user.is_anonymous(): + if username is not None and self.request.user.is_anonymous: profile = get_object_or_404( UserProfile, user__username=username.lower()) @@ -131,7 +129,7 @@ def filter_queryset(self, queryset): else: queryset = queryset.filter(user=profile.user) else: - queryset = super(BriefcaseApi, self).filter_queryset(queryset) + queryset = super().filter_queryset(queryset) formId = self.request.GET.get('formId', '') @@ -235,7 +233,7 @@ def retrieve(self, request, *args, **kwargs): location=False), template_name='downloadSubmission.xml') - @detail_route(methods=['GET']) + @action(detail=True, methods=['GET']) def manifest(self, request, *args, **kwargs): self.object = self.get_object() object_list = MetaData.objects.filter(data_type='media', @@ -248,7 +246,7 @@ def manifest(self, request, *args, **kwargs): headers=self.get_openrosa_headers(request, location=False)) - @detail_route(methods=['GET']) + @action(detail=True, methods=['GET']) def media(self, request, *args, **kwargs): self.object = self.get_object() pk = kwargs.get('metadata') diff --git a/onadata/apps/api/viewsets/connect_viewset.py b/onadata/apps/api/viewsets/connect_viewset.py index 2eca4902f..2e54f0d20 100644 --- a/onadata/apps/api/viewsets/connect_viewset.py +++ b/onadata/apps/api/viewsets/connect_viewset.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from rest_framework import viewsets from rest_framework.response import Response @@ -9,7 +7,7 @@ from onadata.libs.mixins.object_lookup_mixin import ObjectLookupMixin from onadata.libs.serializers.user_profile_serializer import ( UserProfileWithTokenSerializer) -from onadata.settings.common import DEFAULT_SESSION_EXPIRY_TIME +from onadata.settings.base import DEFAULT_SESSION_EXPIRY_TIME class ConnectViewSet(ObjectLookupMixin, viewsets.GenericViewSet): @@ -46,7 +44,7 @@ class ConnectViewSet(ObjectLookupMixin, viewsets.GenericViewSet): def list(self, request, *args, **kwargs): """ Returns authenticated user profile""" - if request and not request.user.is_anonymous(): + if request and not request.user.is_anonymous: session = getattr(request, "session") if not session.session_key: # login user to create session token diff --git a/onadata/apps/api/viewsets/data_viewset.py b/onadata/apps/api/viewsets/data_viewset.py index 5dbdfd46d..ee3dbabcd 100644 --- a/onadata/apps/api/viewsets/data_viewset.py +++ b/onadata/apps/api/viewsets/data_viewset.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import json from django.db.models import Q @@ -10,7 +8,7 @@ from django.utils.translation import ugettext as _ from rest_framework import status -from rest_framework.decorators import detail_route, list_route +from rest_framework.decorators import action from rest_framework.response import Response from rest_framework.viewsets import ModelViewSet from rest_framework.exceptions import ParseError, PermissionDenied @@ -208,7 +206,7 @@ class DataViewSet(AnonymousUserPublicFormsMixin, ModelViewSet): > curl -X GET 'https://example.com/api/v1/data/22845?query={"kind": \ "monthly"}' > curl -X GET 'https://example.com/api/v1/data/22845?query={"date": \ -{"gt$": "2014-09-29T01:02:03+0000"}}' +{"$gt": "2014-09-29T01:02:03+0000"}}' > Response > @@ -379,8 +377,6 @@ class DataViewSet(AnonymousUserPublicFormsMixin, ModelViewSet): renderers.XLSRenderer, renderers.XLSXRenderer, renderers.CSVRenderer, - renderers.CSVZIPRenderer, - renderers.SAVZIPRenderer, renderers.RawXMLRenderer ] @@ -404,12 +400,7 @@ def bulk_delete(self, request, *args, **kwargs): postgres_query, mongo_query = self.__build_db_queries(xform, payload) # Delete Postgres & Mongo - updated_records_count = Instance.objects.filter(**postgres_query).count() - - # Since Django 1.9, `.delete()` returns an dict with number of rows - # deleted per object. - # FixMe remove `.count()` query and use that dict instance - Instance.objects.filter(**postgres_query).delete() + updated_records_count = Instance.objects.filter(**postgres_query).delete() ParsedInstance.bulk_delete(mongo_query) return Response({ 'detail': _('{} submissions have been deleted').format( @@ -459,7 +450,7 @@ def get_serializer_class(self): return serializer_class def get_object(self): - obj = super(DataViewSet, self).get_object() + obj = super().get_object() pk_lookup, dataid_lookup = self.lookup_fields pk = self.kwargs.get(pk_lookup) dataid = self.kwargs.get(dataid_lookup) @@ -496,7 +487,7 @@ def _filtered_or_shared_qs(self, qs, pk): return qs def filter_queryset(self, queryset, view=None): - qs = super(DataViewSet, self).filter_queryset(queryset) + qs = super().filter_queryset(queryset) pk = self.kwargs.get(self.lookup_field) tags = self.request.query_params.get('tags', None) @@ -514,7 +505,7 @@ def filter_queryset(self, queryset, view=None): return qs - @detail_route(methods=["GET", "PATCH", "DELETE"]) + @action(detail=True, methods=["GET", "PATCH", "DELETE"]) def validation_status(self, request, *args, **kwargs): """ View or modify validation status of specific instance. @@ -546,7 +537,7 @@ def validation_status(self, request, *args, **kwargs): return Response(data, status=http_status) - @detail_route(methods=['GET', 'POST', 'DELETE'], + @action(detail=True, methods=['GET', 'POST', 'DELETE'], extra_lookup_fields=['label', ]) def labels(self, request, *args, **kwargs): http_status = status.HTTP_400_BAD_REQUEST @@ -580,7 +571,7 @@ def labels(self, request, *args, **kwargs): return Response(data, status=http_status) - @detail_route(methods=['GET']) + @action(detail=True, methods=['GET']) def enketo(self, request, *args, **kwargs): self.object = self.get_object() data = {} @@ -608,7 +599,7 @@ def retrieve(self, request, *args, **kwargs): instance = self.get_object() return Response(instance.xml) else: - return super(DataViewSet, self).retrieve(request, *args, **kwargs) + return super().retrieve(request, *args, **kwargs) def destroy(self, request, *args, **kwargs): self.object = self.get_object() @@ -647,7 +638,7 @@ def list(self, request, *args, **kwargs): # With DRF ListSerializer are automatically created and wraps # everything in a list. Since this returns a list # # already, we unwrap it. - res = super(DataViewSet, self).list(request, *args, **kwargs) + res = super().list(request, *args, **kwargs) res.data = res.data[0] return res diff --git a/onadata/apps/api/viewsets/metadata_viewset.py b/onadata/apps/api/viewsets/metadata_viewset.py index 877b3a2ab..717bae203 100644 --- a/onadata/apps/api/viewsets/metadata_viewset.py +++ b/onadata/apps/api/viewsets/metadata_viewset.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from rest_framework import renderers from rest_framework import viewsets from rest_framework.response import Response @@ -189,4 +187,4 @@ def perform_destroy(self, *args, **kwargs): except OSError: pass - return super(MetaDataViewSet, self).perform_destroy(*args, **kwargs) + return super().perform_destroy(*args, **kwargs) diff --git a/onadata/apps/api/viewsets/note_viewset.py b/onadata/apps/api/viewsets/note_viewset.py index 2930cb1ef..d9d4713cd 100644 --- a/onadata/apps/api/viewsets/note_viewset.py +++ b/onadata/apps/api/viewsets/note_viewset.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.db.models import Q from guardian.shortcuts import assign_perm, get_objects_for_user from rest_framework import status @@ -67,11 +65,9 @@ def get_queryset(self): CAN_VIEW_XFORM, XForm, accept_global_perms=False) - viewable_notes = Note.objects.filter( - Q(instance__xform=viewable_xforms) | Q(instance__xform__shared_data=True) + Q(instance__xform__in=viewable_xforms) | Q(instance__xform__shared_data=True) ) - return viewable_notes # This used to be post_save. Part of it is here, permissions validation diff --git a/onadata/apps/api/viewsets/xform_list_api.py b/onadata/apps/api/viewsets/xform_list_api.py index e14399848..7a60c390f 100644 --- a/onadata/apps/api/viewsets/xform_list_api.py +++ b/onadata/apps/api/viewsets/xform_list_api.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import pytz from datetime import datetime @@ -10,7 +8,7 @@ from rest_framework import viewsets from rest_framework import permissions from rest_framework.response import Response -from rest_framework.decorators import detail_route +from rest_framework.decorators import action from onadata.apps.api.tools import get_media_file_response from onadata.apps.logger.models.xform import XForm @@ -39,7 +37,7 @@ class XFormListApi(viewsets.ReadOnlyModelViewSet): template_name = 'api/xformsList.xml' def __init__(self, *args, **kwargs): - super(XFormListApi, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # Respect DEFAULT_AUTHENTICATION_CLASSES, but also ensure that the # previously hard-coded authentication classes are included first authentication_classes = [ @@ -65,19 +63,19 @@ def get_renderers(self): if self.action and self.action == 'manifest': return [XFormManifestRenderer()] - return super(XFormListApi, self).get_renderers() + return super().get_renderers() def filter_queryset(self, queryset): username = self.kwargs.get('username') if username is None: # If no username is specified, the request must be authenticated - if self.request.user.is_anonymous(): + if self.request.user.is_anonymous: # raises a permission denied exception, forces authentication self.permission_denied(self.request) else: # Return all the forms the currently-logged-in user can access, # including those shared by other users - queryset = super(XFormListApi, self).filter_queryset(queryset) + queryset = super().filter_queryset(queryset) else: profile = get_object_or_404( UserProfile, user__username=username.lower() @@ -87,7 +85,7 @@ def filter_queryset(self, queryset): if profile.require_auth: # The specified has user ticked "Require authentication to see # forms and submit data"; reject anonymous requests - if self.request.user.is_anonymous(): + if self.request.user.is_anonymous: # raises a permission denied exception, forces # authentication self.permission_denied(self.request) @@ -95,7 +93,7 @@ def filter_queryset(self, queryset): # Someone has logged in, but they are not necessarily # allowed to access the forms belonging to the specified # user. Filter again to consider object-level permissions - queryset = super(XFormListApi, self).filter_queryset( + queryset = super().filter_queryset( queryset ) try: @@ -122,7 +120,7 @@ def retrieve(self, request, *args, **kwargs): return Response(self.object.xml, headers=self.get_openrosa_headers()) - @detail_route(methods=['GET']) + @action(detail=True, methods=['GET']) def manifest(self, request, *args, **kwargs): self.object = self.get_object() object_list = MetaData.objects.filter(data_type='media', @@ -133,7 +131,7 @@ def manifest(self, request, *args, **kwargs): return Response(serializer.data, headers=self.get_openrosa_headers()) - @detail_route(methods=['GET']) + @action(detail=True, methods=['GET']) def media(self, request, *args, **kwargs): self.object = self.get_object() pk = kwargs.get('metadata') diff --git a/onadata/apps/api/viewsets/xform_submission_api.py b/onadata/apps/api/viewsets/xform_submission_api.py index 60b54968c..47423a513 100644 --- a/onadata/apps/api/viewsets/xform_submission_api.py +++ b/onadata/apps/api/viewsets/xform_submission_api.py @@ -1,8 +1,6 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import re -import StringIO +import io from django.conf import settings from django.contrib.auth.models import User @@ -44,7 +42,7 @@ def dict_lists2strings(d): :param d: The dict to convert. :returns: The converted dict.""" for k, v in d.items(): - if isinstance(v, list) and all([isinstance(e, basestring) for e in v]): + if isinstance(v, list) and all([isinstance(e, str) for e in v]): d[k] = ' '.join(v) elif isinstance(v, dict): d[k] = dict_lists2strings(v) @@ -74,8 +72,7 @@ def create_instance_from_json(username, request): submission_joined = dict_lists2strings(submission) xml_string = dict2xform(submission_joined, dict_form.get('id')) - xml_file = StringIO.StringIO(xml_string) - + xml_file = io.StringIO(xml_string) return safe_create_instance(username, xml_file, [], None, request) @@ -141,7 +138,7 @@ class XFormSubmissionApi(OpenRosaHeadersMixin, template_name = 'submission.xml' def __init__(self, *args, **kwargs): - super(XFormSubmissionApi, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # Respect DEFAULT_AUTHENTICATION_CLASSES, but also ensure that the # previously hard-coded authentication classes are included first. # We include BasicAuthentication here to allow submissions using basic @@ -165,7 +162,7 @@ def __init__(self, *args, **kwargs): def create(self, request, *args, **kwargs): username = self.kwargs.get('username') - if self.request.user.is_anonymous(): + if self.request.user.is_anonymous: if username is None: # raises a permission denied exception, forces authentication self.permission_denied(self.request) @@ -207,13 +204,15 @@ def error_response(self, error, is_json_request, request): if not error: error_msg = _("Unable to create submission.") status_code = status.HTTP_400_BAD_REQUEST - elif isinstance(error, basestring): + elif isinstance(error, str): error_msg = error status_code = status.HTTP_400_BAD_REQUEST elif not is_json_request: return error else: - error_msg = xml_error_re.search(error.content).groups()[0] + error_msg = xml_error_re.search( + error.content.decode('utf-8') + ).groups()[0] status_code = error.status_code return Response({'error': error_msg}, diff --git a/onadata/apps/api/viewsets/xform_viewset.py b/onadata/apps/api/viewsets/xform_viewset.py index a01c44a6b..0c67e89e4 100644 --- a/onadata/apps/api/viewsets/xform_viewset.py +++ b/onadata/apps/api/viewsets/xform_viewset.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import json import os from datetime import datetime @@ -14,7 +12,7 @@ from django.utils.translation import ugettext as _ from rest_framework import exceptions from rest_framework import status -from rest_framework.decorators import detail_route +from rest_framework.decorators import action from rest_framework.response import Response from rest_framework.settings import api_settings from rest_framework.viewsets import ModelViewSet @@ -45,8 +43,6 @@ 'xls': Export.XLS_EXPORT, 'xlsx': Export.XLS_EXPORT, 'csv': Export.CSV_EXPORT, - 'csvzip': Export.CSV_ZIP_EXPORT, - 'savzip': Export.SAV_ZIP_EXPORT, } @@ -67,8 +63,6 @@ def _get_extension_from_export_type(export_type): if export_type == Export.XLS_EXPORT: extension = 'xlsx' - elif export_type in [Export.CSV_ZIP_EXPORT, Export.SAV_ZIP_EXPORT]: - extension = 'zip' return extension @@ -165,8 +159,7 @@ def response_for_format(form, format=None): def should_regenerate_export(xform, export_type, request): return should_create_new_export(xform, export_type) or\ 'start' in request.GET or 'end' in request.GET or\ - 'query' in request.GET or 'meta' in request.GET or\ - 'token' in request.GET + 'query' in request.GET def value_for_type(form, field, value): @@ -191,8 +184,7 @@ def log_export(request, xform, export_type): }, audit, request) -def custom_response_handler(request, xform, query, export_type, - token=None, meta=None): +def custom_response_handler(request, xform, query, export_type): export_type = _get_export_type(export_type) # check if we need to re-generate, @@ -237,7 +229,6 @@ class XFormViewSet(AnonymousUserPublicFormsMixin, LabelsMixin, ModelViewSet): account. - `xls_file`: the xlsform file. -- `xls_url`: the url to an xlsform - `owner`: username to the target account (Optional)
@@ -247,11 +238,6 @@ class XFormViewSet(AnonymousUserPublicFormsMixin, LabelsMixin, ModelViewSet):
 >       curl -X POST -F xls_file=@/path/to/form.xls \
 https://example.com/api/v1/forms
 >
-> OR post an xlsform url
->
->       curl -X POST -d \
-"xls_url=https://example.com/ukanga/forms/tutorial/form.xls" \
-https://example.com/api/v1/forms
 
 > Response
 >
@@ -260,9 +246,7 @@ class XFormViewSet(AnonymousUserPublicFormsMixin, LabelsMixin, ModelViewSet):
 >           "formid": 28058,
 >           "uuid": "853196d7d0a74bca9ecfadbf7e2f5c1f",
 >           "id_string": "Birds",
->           "sms_id_string": "Birds",
 >           "title": "Birds",
->           "allows_sms": false,
 >           "description": "",
 >           "downloadable": true,
 >           "encrypted": false,
@@ -317,9 +301,7 @@ class XFormViewSet(AnonymousUserPublicFormsMixin, LabelsMixin, ModelViewSet):
 >           "formid": 28058,
 >           "uuid": "853196d7d0a74bca9ecfadbf7e2f5c1f",
 >           "id_string": "Birds",
->           "sms_id_string": "Birds",
 >           "title": "Birds",
->           "allows_sms": false,
 >           "description": "",
 >           "downloadable": true,
 >           "encrypted": false,
@@ -353,9 +335,7 @@ class XFormViewSet(AnonymousUserPublicFormsMixin, LabelsMixin, ModelViewSet):
 >           "formid": 28058,
 >           "uuid": "853196d7d0a74bca9ecfadbf7e2f5c1f",
 >           "id_string": "Birds",
->           "sms_id_string": "Birds",
 >           "title": "Birds",
->           "allows_sms": false,
 >           "description": "Le description",
 >           "downloadable": true,
 >           "encrypted": false,
@@ -370,7 +350,7 @@ class XFormViewSet(AnonymousUserPublicFormsMixin, LabelsMixin, ModelViewSet):
 
 You may overwrite the form's contents while preserving its submitted data,
 `id_string` and all other attributes, by sending a `PATCH` that includes
-`xls_file` or `text_xls_form`. Use with caution, as this may compromise the
+`xls_file`. Use with caution, as this may compromise the
 methodology of your study!
 
 
@@ -408,7 +388,6 @@ class XFormViewSet(AnonymousUserPublicFormsMixin, LabelsMixin, ModelViewSet):
 >           "formid": 28058,
 >           "uuid": "853196d7d0a74bca9ecfadbf7e2f5c1f",
 >           "id_string": "Birds",
->           "sms_id_string": "Birds",
 >           "title": "Birds",
 >           ...
 >       }, ...]
@@ -484,7 +463,6 @@ class XFormViewSet(AnonymousUserPublicFormsMixin, LabelsMixin, ModelViewSet):
 >           "formid": 28058,
 >           "uuid": "853196d7d0a74bca9ecfadbf7e2f5c1f",
 >           "id_string": "Birds",
->           "sms_id_string": "Birds",
 >           "title": "Birds",
 >           ...
 >       }, ...]
@@ -539,22 +517,6 @@ class XFormViewSet(AnonymousUserPublicFormsMixin, LabelsMixin, ModelViewSet):
 >
 >        HTTP 200 OK
 
-## Get webform/enketo link
-
-
-GET /api/v1/forms/{pk}/enketo
- -> Request -> -> curl -X GET \ -https://example.com/api/v1/forms/28058/enketo -> -> Response -> -> {"enketo_url": "https://h6ic6.enketo.org/webform"} -> -> HTTP 200 OK - ## Get form data in xls, csv format. Get form data exported as xls, csv, csv zip, sav zip format. @@ -564,11 +526,6 @@ class XFormViewSet(AnonymousUserPublicFormsMixin, LabelsMixin, ModelViewSet): - `pk` - is the form unique identifier - `format` - is the data export format i.e csv, xls, csvzip, savzip -Params for the custom xls report - -- `meta` - the metadata id containing the template url -- `token` - the template url -
 GET /api/v1/forms/{pk}.{format}
 
@@ -583,46 +540,6 @@ class XFormViewSet(AnonymousUserPublicFormsMixin, LabelsMixin, ModelViewSet): > > HTTP 200 OK -> Example 2 Custom XLS reports (beta) -> -> curl -X GET https://example.com/api/v1/forms/28058.xls?meta=12121 -> or -> curl -X GET https://example.com/api/v1/forms/28058.xls?token={url} -> -> XLS file is downloaded -> -> Response -> -> HTTP 200 OK - -## Clone a form to a specific user account - -You can clone a form to a specific user account using `GET` with - -- `username` of the user you want to clone the form to - -
-GET /api/v1/forms/{pk}/clone
-
- -> Example -> -> curl -X GET https://example.com/api/v1/forms/123/clone \ --d username=alice - -> Response -> -> HTTP 201 CREATED -> { -> "url": "https://example.com/api/v1/forms/124", -> "formid": 124, -> "uuid": "853196d7d0a74bca9ecfadbf7e2f5c1e", -> "id_string": "Birds_cloned_1", -> "sms_id_string": "Birds_cloned_1", -> "title": "Birds_cloned_1", -> ... -> } - ## Import CSV data to existing form - `csv_file` a valid csv file with exported \ @@ -649,8 +566,6 @@ class XFormViewSet(AnonymousUserPublicFormsMixin, LabelsMixin, ModelViewSet): renderers.XLSRenderer, renderers.XLSXRenderer, renderers.CSVRenderer, - renderers.CSVZIPRenderer, - renderers.SAVZIPRenderer, renderers.RawXMLRenderer ] queryset = XForm.objects.all() @@ -658,9 +573,6 @@ class XFormViewSet(AnonymousUserPublicFormsMixin, LabelsMixin, ModelViewSet): lookup_field = 'pk' extra_lookup_fields = None permission_classes = [XFormPermissions, ] - # TODO: Figure out what `updatable_fields` does; if nothing, remove it - #updatable_fields = set(('description', 'downloadable', 'require_auth', - # 'shared', 'shared_data', 'title')) filter_backends = (filters.AnonDjangoObjectPermissionFilter, filters.TagFilter, filters.XFormOwnerFilter, @@ -673,9 +585,8 @@ def create(self, request, *args, **kwargs): if isinstance(survey, XForm): xform = XForm.objects.get(pk=survey.pk) # The XForm has been created, but `publish_xlsform` relies on - # `onadata.apps.main.forms.QuickConverter`, which uses standard - # Django forms and only recognizes the `xls_file`, `xls_url`, - # `dropbox_xls_url`, and `text_xls_form` fields. + # `onadata.apps.main.forms.QuickConverterForm`, which uses standard + # Django forms and only recognizes the `xls_file` fields. # Use the DRF serializer to update the XForm with values for other # fields. serializer = XFormSerializer( @@ -687,14 +598,13 @@ def create(self, request, *args, **kwargs): serializer.is_valid(raise_exception=True) serializer.save() headers = self.get_success_headers(serializer.data) - return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers) return Response(survey, status=status.HTTP_400_BAD_REQUEST) def update(self, request, pk, *args, **kwargs): - if 'xls_file' in request.FILES or 'text_xls_form' in request.data: + if 'xls_file' in request.FILES: # A new XLSForm has been uploaded and will replace the existing # form existing_xform = get_object_or_404(XForm, pk=pk) @@ -713,9 +623,9 @@ def update(self, request, pk, *args, **kwargs): # Something odd; hopefully it can be coerced into a string raise exceptions.ParseError(detail=survey) # Let the superclass handle updates to the other fields - return super(XFormViewSet, self).update(request, pk, *args, **kwargs) + return super().update(request, pk, *args, **kwargs) - @detail_route(methods=['GET']) + @action(detail=True, methods=['GET']) def form(self, request, format='json', **kwargs): form = self.get_object() if format not in ['json', 'xml', 'xls', 'csv']: @@ -729,25 +639,6 @@ def form(self, request, format='json', **kwargs): return response - @detail_route(methods=['GET']) - def enketo(self, request, **kwargs): - self.object = self.get_object() - form_url = _get_form_url(self.object.user.username) - - data = {'message': _("Enketo not properly configured.")} - http_status = status.HTTP_400_BAD_REQUEST - - try: - url = enketo_url(form_url, self.object.id_string) - except EnketoError: - pass - else: - if url: - http_status = status.HTTP_200_OK - data = {"enketo_url": url} - - return Response(data, http_status) - def retrieve(self, request, *args, **kwargs): xform = self.get_object() export_type = kwargs.get('format') @@ -755,14 +646,14 @@ def retrieve(self, request, *args, **kwargs): if export_type is None or export_type in ['json']: # perform default viewset retrieve, no data export - return super(XFormViewSet, self).retrieve(request, *args, **kwargs) + return super().retrieve(request, *args, **kwargs) return custom_response_handler(request, xform, query, export_type) - @detail_route(methods=['POST']) + @action(detail=True, methods=['POST']) def csv_import(self, request, *args, **kwargs): """ Endpoint for CSV data imports @@ -778,4 +669,3 @@ def csv_import(self, request, *args, **kwargs): data=resp, status=status.HTTP_200_OK if resp.get('error') is None else status.HTTP_400_BAD_REQUEST) - diff --git a/onadata/apps/export/__init__.py b/onadata/apps/export/__init__.py deleted file mode 100644 index 91f7c6c25..000000000 --- a/onadata/apps/export/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -################################################# -# THIS APP IS DEAD CODE AND SHOULD BE EXCISED # -# EVERY SINGLE ENDPOINT 500s EXCEPT export_menu # -################################################# diff --git a/onadata/apps/export/templates/export/export_html.html b/onadata/apps/export/templates/export/export_html.html deleted file mode 100644 index e29f975af..000000000 --- a/onadata/apps/export/templates/export/export_html.html +++ /dev/null @@ -1,52 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} - -
-{% block content %} - - - -

{{ title }}

- -{{ table }} - - - -{% endblock %} -
diff --git a/onadata/apps/export/templates/export/export_menu.html b/onadata/apps/export/templates/export/export_menu.html deleted file mode 100644 index e22105856..000000000 --- a/onadata/apps/export/templates/export/export_menu.html +++ /dev/null @@ -1,163 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} - -
-{% block content %} - - - -

{% trans "Exports" %}:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -{% for lang in languages %} - - {% if lang == "_default" %} - - - - - - - - - - - - {% else %} - - - - - - - - - - - {% endif %} - -{% endfor %} - - -
{% trans "Groups included" %}{% trans "Groups excluded" %}
{% trans "HTML view" %}{% trans "CSV" %}{% trans "XLS" %}{% trans "HTML view" %}{% trans "CSV" %}{% trans "XLS" %}
- - {% trans "XML values and headers" %} - - - - {% trans "XML values and headers" %} - - - - {% trans "XML values and headers" %} - - - - {% trans "XML values and headers" %} - - - - {% trans "XML values and headers" %} - - - - {% trans "XML values and headers" %} - -
- - {% trans "Default labels" %} - - - - {% trans "Default labels" %} - - - - {% trans "Default labels" %} - - - - {% trans "Default labels" %} - - - - {% trans "Default labels" %} - - - - {% trans "Default labels" %} - -
- - {% trans lang %} - - - - {% trans lang %} - - - - {% trans lang %} - - - - {% trans lang %} - - - - {% trans lang %} - - - - {% trans lang %} - -
- -{% endblock %} -
diff --git a/onadata/apps/export/urls.py b/onadata/apps/export/urls.py deleted file mode 100644 index 5938b71bb..000000000 --- a/onadata/apps/export/urls.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -################################################# -# THIS APP IS DEAD CODE AND SHOULD BE EXCISED # -# EVERY SINGLE ENDPOINT 500s EXCEPT export_menu # -################################################# - -from django.conf.urls import patterns, url - - -urlpatterns = patterns( - '', - url(r"(?P[^/]+)/$", - 'onadata.apps.export.views.export_menu', - name='formpack_export_menu'), - url(r"(?P[^/]+).csv$", - 'onadata.apps.export.views.csv_export', - name='formpack_csv_export'), - url(r"(?P[^/]+).xlsx$", - 'onadata.apps.export.views.xlsx_export', - name='formpack_xlsx_export'), - url(r"(?P[^/]+).html$", - 'onadata.apps.export.views.html_export', - name='formpack_html_export') -) diff --git a/onadata/apps/export/views.py b/onadata/apps/export/views.py deleted file mode 100644 index 148b278e5..000000000 --- a/onadata/apps/export/views.py +++ /dev/null @@ -1,164 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - -import uuid -from datetime import datetime - -from django.conf import settings -from django.contrib.auth.models import User -from django.http import HttpResponse, HttpResponseForbidden -from django.shortcuts import render, get_object_or_404 -from django.utils.safestring import mark_safe -from django.utils.translation import ugettext as _ -from formpack import FormPack -from path import tempdir -from pure_pagination import Paginator, EmptyPage, PageNotAnInteger - -from onadata.libs.utils.user_auth import has_permission - - -################################################# -# THIS APP IS DEAD CODE AND SHOULD BE EXCISED # -# EVERY SINGLE ENDPOINT 500s EXCEPT export_menu # -################################################# - - -def readable_xform_required(func): - def _wrapper(request, username, id_string): - owner = get_object_or_404(User, username=username) - xform = get_object_or_404(owner.xforms, id_string=id_string) - if not has_permission(xform, owner, request): - return HttpResponseForbidden(_('Not shared.')) - return func(request, username, id_string) - return _wrapper - - -def get_instances_for_user_and_form(user, form_id): - userform_id = '{}_{}'.format(user, form_id) - query = {'_userform_id': userform_id} - return settings.MONGO_DB.instances.find(query) - - -def build_formpack(username, id_string): - user = User.objects.get(username=username) - xform = user.xforms.get(id_string=id_string) - schema = { - "id_string": id_string, - "version": 'v1', - "content": xform.to_kpi_content_schema(), - } - return FormPack([schema], id_string) - - -def build_export(request, username, id_string): - - hierarchy_in_labels = request.REQUEST.get( - 'hierarchy_in_labels', '' - ).lower() == 'true' - group_sep = request.REQUEST.get('groupsep', '/') - lang = request.REQUEST.get('lang', None) - - options = {'versions': 'v1', - 'header_lang': lang, - 'group_sep': group_sep, - 'translation': lang, - 'hierarchy_in_labels': hierarchy_in_labels, - 'copy_fields': ('_id', '_uuid', '_submission_time'), - 'force_index': True} - - formpack = build_formpack(username, id_string) - return formpack.export(**options) - - -def build_export_filename(export, extension): - form_type = 'labels' - if not export.translation: - form_type = "values" - elif export.translation != "_default": - form_type = export.translation - - return "{title} - {form_type} - {date:%Y-%m-%d-%H-%M}.{ext}".format( - form_type=form_type, - date=datetime.utcnow(), - title=export.title, - ext=extension - ) - - -@readable_xform_required -def export_menu(request, username, id_string): - - form_pack = build_formpack(username, id_string) - - context = { - 'languages': form_pack.available_translations, - 'username': username, - 'id_string': id_string - } - - return render(request, 'export/export_menu.html', context) - - -@readable_xform_required -def xlsx_export(request, username, id_string): - - export = build_export(request, username, id_string) - data = [("v1", get_instances_for_user_and_form(username, id_string))] - - with tempdir() as d: - tempfile = d / str(uuid.uuid4()) - export.to_xlsx(tempfile, data) - xlsx = tempfile.bytes() - - name = build_export_filename(export, 'xlsx') - ct = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' - response = HttpResponse(xlsx, content_type=ct) - response['Content-Disposition'] = 'attachment; filename="%s"' % name - return response - - -@readable_xform_required -def csv_export(request, username, id_string): - - export = build_export(request, username, id_string) - data = [("v1", get_instances_for_user_and_form(username, id_string))] - - name = build_export_filename(export, 'csv') - response = HttpResponse(content_type='text/csv') - response['Content-Disposition'] = 'attachment; filename="%s"' % name - - for line in export.to_csv(data): - response.write(line + "\n") - - return response - - -@readable_xform_required -def html_export(request, username, id_string): - - limit = request.REQUEST.get('limit', 100) - - cursor = get_instances_for_user_and_form(username, id_string) - paginator = Paginator(cursor, limit, request=request) - - try: - page = paginator.page(request.REQUEST.get('page', 1)) - except (EmptyPage, PageNotAnInteger): - try: - page = paginator.page(1) - except (EmptyPage, PageNotAnInteger): - page = None - - context = { - 'page': page, - 'table': [] - } - - if page: - data = [("v1", page.object_list)] - export = build_export(request, username, id_string) - context['table'] = mark_safe("\n".join(export.to_html(data))) - context['title'] = id_string - - return render(request, 'export/export_html.html', context) - diff --git a/onadata/apps/logger/__init__.py b/onadata/apps/logger/__init__.py index 134880430..57d631c3f 100644 --- a/onadata/apps/logger/__init__.py +++ b/onadata/apps/logger/__init__.py @@ -1,2 +1 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import diff --git a/onadata/apps/logger/admin.py b/onadata/apps/logger/admin.py index 50f7d25c9..819dd58b1 100644 --- a/onadata/apps/logger/admin.py +++ b/onadata/apps/logger/admin.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.contrib import admin from onadata.apps.logger.models import XForm @@ -13,9 +11,10 @@ class FormAdmin(admin.ModelAdmin): # A user should only see forms that belong to him. def get_queryset(self, request): - qs = super(FormAdmin, self).get_queryset(request) + qs = super().get_queryset(request) if request.user.is_superuser: return qs return qs.filter(user=request.user) + admin.site.register(XForm, FormAdmin) diff --git a/onadata/apps/logger/exceptions.py b/onadata/apps/logger/exceptions.py index 07d322eda..2fc9a0d99 100644 --- a/onadata/apps/logger/exceptions.py +++ b/onadata/apps/logger/exceptions.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.utils.translation import gettext as _ @@ -9,8 +7,5 @@ class DuplicateUUIDError(Exception): class FormInactiveError(Exception): - def __unicode__(self): - return _("Form is inactive") - def __str__(self): - return unicode(self).encode('utf-8') + return _("Form is inactive") diff --git a/onadata/apps/logger/factory.py b/onadata/apps/logger/factory.py index 46b70bc3e..b1b2297b3 100644 --- a/onadata/apps/logger/factory.py +++ b/onadata/apps/logger/factory.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - # This factory is not the same as the others, and doesn't use # django-factories but it mimics their functionality... from datetime import timedelta @@ -76,7 +74,7 @@ def _load_simple_survey_object(): return survey -class XFormManagerFactory(object): +class XFormManagerFactory: def create_registration_xform(self): """ diff --git a/onadata/apps/logger/fields.py b/onadata/apps/logger/fields.py index dfc8e1abf..1d2a223c5 100644 --- a/onadata/apps/logger/fields.py +++ b/onadata/apps/logger/fields.py @@ -1,5 +1,5 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import +import collections from django.core.exceptions import FieldError from django.db import models @@ -34,17 +34,16 @@ def __init__(self, *args, **kwargs): kwargs['null'] = True kwargs['default'] = None - super(LazyDefaultBooleanField, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def _get_lazy_default(self): - if callable(self.lazy_default): + if isinstance(self.lazy_default, collections.Callable): return self.lazy_default() else: return self.lazy_default def deconstruct(self): - name, path, args, kwargs = super( - LazyDefaultBooleanField, self).deconstruct() + name, path, args, kwargs = super().deconstruct() kwargs['default'] = self.lazy_default del kwargs['null'] return name, path, args, kwargs diff --git a/onadata/apps/logger/fixtures/repeated_group/repeated_group.json b/onadata/apps/logger/fixtures/repeated_group/repeated_group.json index ec9e63354..c5cada52b 100644 --- a/onadata/apps/logger/fixtures/repeated_group/repeated_group.json +++ b/onadata/apps/logger/fixtures/repeated_group/repeated_group.json @@ -1 +1 @@ -{"#document": {"form": {"question_group": [{"answer_2": "2", "answer_1": "1"}, {"answer_2": "1", "answer_1": "2"}]}}} \ No newline at end of file +{"#document": {"form": {"question_group": [{"answer_1": "1", "answer_2": "2"}, {"answer_1": "2", "answer_2": "1"}]}}} diff --git a/onadata/apps/logger/import_tools.py b/onadata/apps/logger/import_tools.py index d3daf96e9..143ec6552 100644 --- a/onadata/apps/logger/import_tools.py +++ b/onadata/apps/logger/import_tools.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os import shutil import tempfile @@ -33,7 +31,7 @@ def django_file(path, field_name, content_type): # adapted from here: # http://groups.google.com/group/django-users/browse_thread/thread/ # 834f988876ff3c45/ - f = open(path) + f = open(path, 'rb') return InMemoryUploadedFile( file=f, field_name=field_name, @@ -56,12 +54,12 @@ def iterate_through_instances(dirpath, callback): xfxs = XFormInstanceFS(filepath) try: success_count += callback(xfxs) - except Exception, e: + except Exception as e: errors.append("%s => %s" % (xfxs.filename, str(e))) - del(xfxs) + del xfxs total_file_count += 1 - return (total_file_count, success_count, errors) + return total_file_count, success_count, errors def import_instances_from_zip(zipfile_path, user, status="zip"): @@ -70,7 +68,7 @@ def import_instances_from_zip(zipfile_path, user, status="zip"): zf = zipfile.ZipFile(zipfile_path) zf.extractall(temp_directory) - except zipfile.BadZipfile, e: + except zipfile.BadZipfile as e: errors = ["%s" % e] return 0, 0, errors else: @@ -97,6 +95,7 @@ def callback(xform_fs): for i in images: i.close() + i.close() if instance: return 1 @@ -106,4 +105,4 @@ def callback(xform_fs): total_count, success_count, errors = iterate_through_instances( path, callback) - return (total_count, success_count, errors) + return total_count, success_count, errors diff --git a/onadata/apps/logger/management/__init__.py b/onadata/apps/logger/management/__init__.py index 7e571955c..57d631c3f 100644 --- a/onadata/apps/logger/management/__init__.py +++ b/onadata/apps/logger/management/__init__.py @@ -1,21 +1 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -''' -from south.signals import post_migrate -from django.conf import settings -from django.db.models import get_app, get_models -from django.contrib.auth.management import create_permissions - - -# Courtesy of http://devwithpassion.com/felipe/south-django-permissions/ -def update_permissions_after_migration(app, **kwargs): - """ - Update app permission just after every migration. - """ - - create_permissions( - get_app(app), get_models(), 2 if settings.DEBUG else 0) - - -post_migrate.connect(update_permissions_after_migration) -''' diff --git a/onadata/apps/logger/management/commands/__init__.py b/onadata/apps/logger/management/commands/__init__.py index 134880430..57d631c3f 100644 --- a/onadata/apps/logger/management/commands/__init__.py +++ b/onadata/apps/logger/management/commands/__init__.py @@ -1,2 +1 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import diff --git a/onadata/apps/logger/management/commands/change_s3_media_permissions.py b/onadata/apps/logger/management/commands/change_s3_media_permissions.py index f4e662648..f4cdee4d7 100644 --- a/onadata/apps/logger/management/commands/change_s3_media_permissions.py +++ b/onadata/apps/logger/management/commands/change_s3_media_permissions.py @@ -1,8 +1,6 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import sys from django.core.management.base import BaseCommand, CommandError @@ -26,7 +24,7 @@ def handle(self, *args, **kwargs): "Expected %s as permission") % ' or '.join(permissions)) try: - s3 = get_storage_class('storages.backends.s3boto.S3BotoStorage')() + s3 = get_storage_class('storages.backends.s3boto3.S3Boto3Storage')() except: print(_("Missing necessary libraries. Try running: pip install " "-r requirements-s3.pip")) diff --git a/onadata/apps/logger/management/commands/clean_duplicated_submissions.py b/onadata/apps/logger/management/commands/clean_duplicated_submissions.py index 5847db5a2..a543acd27 100644 --- a/onadata/apps/logger/management/commands/clean_duplicated_submissions.py +++ b/onadata/apps/logger/management/commands/clean_duplicated_submissions.py @@ -1,8 +1,6 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.db import transaction @@ -22,12 +20,12 @@ class Command(BaseCommand): help = "Deletes duplicated submissions (i.e same `uuid` and same `xml`)" def __init__(self, **kwargs): - super(Command, self).__init__(**kwargs) + super().__init__(**kwargs) self.__vaccuum = False self.__users = set([]) def add_arguments(self, parser): - super(Command, self).add_arguments(parser) + super().add_arguments(parser) parser.add_argument( "--user", diff --git a/onadata/apps/logger/management/commands/create_backup.py b/onadata/apps/logger/management/commands/create_backup.py index f4a837fe7..3a3802384 100644 --- a/onadata/apps/logger/management/commands/create_backup.py +++ b/onadata/apps/logger/management/commands/create_backup.py @@ -1,8 +1,6 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os from django.core.management.base import BaseCommand, CommandError diff --git a/onadata/apps/logger/management/commands/create_image_thumbnails.py b/onadata/apps/logger/management/commands/create_image_thumbnails.py index 1d6155fcd..18dd546ac 100644 --- a/onadata/apps/logger/management/commands/create_image_thumbnails.py +++ b/onadata/apps/logger/management/commands/create_image_thumbnails.py @@ -1,9 +1,6 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - -from optparse import make_option from django.contrib.auth.models import User from django.core.management.base import BaseCommand, CommandError @@ -21,14 +18,17 @@ class Command(BaseCommand): help = ugettext_lazy("Creates thumbnails for " "all form images and stores them") - option_list = BaseCommand.option_list + ( - make_option('-u', '--username', - help=ugettext_lazy("Username of the form user")), - make_option('-i', '--id_string', - help=ugettext_lazy("id string of the form")), - make_option('-f', '--force', action='store_false', - help=ugettext_lazy("regenerate thumbnails if they exist.")) - ) + + def add_arguments(self, parser): + parser.add_argument('-u', '--username', + help=ugettext_lazy("Username of the form user")) + + parser.add_argument('-i', '--id_string', + help=ugettext_lazy("id string of the form")) + + parser.add_argument('-f', '--force', action='store_false', + help=ugettext_lazy("regenerate thumbnails if they " + "exist.")) def handle(self, *args, **kwargs): attachments_qs = Attachment.objects.select_related( @@ -77,6 +77,6 @@ def handle(self, *args, **kwargs): else: print(_('Problem with the file %(file)s') % {'file': filename}) - except (IOError, OSError), e: + except (IOError, OSError) as e: print(_('Error on %(filename)s: %(error)s') % {'filename': filename, 'error': e}) diff --git a/onadata/apps/logger/management/commands/delete_revisions.py b/onadata/apps/logger/management/commands/delete_revisions.py index a848423e4..29b1267a4 100644 --- a/onadata/apps/logger/management/commands/delete_revisions.py +++ b/onadata/apps/logger/management/commands/delete_revisions.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from datetime import timedelta import sys @@ -15,7 +13,7 @@ class Command(RevisionCommand): help = "Deletes revisions (by chunks) for a given app [and model]" def add_arguments(self, parser): - super(Command, self).add_arguments(parser) + super().add_arguments(parser) parser.add_argument( "--chunks", diff --git a/onadata/apps/logger/management/commands/export_xforms_and_instances.py b/onadata/apps/logger/management/commands/export_xforms_and_instances.py index 4e3de9a21..2ef34f401 100644 --- a/onadata/apps/logger/management/commands/export_xforms_and_instances.py +++ b/onadata/apps/logger/management/commands/export_xforms_and_instances.py @@ -1,8 +1,6 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os from django.core.management.base import BaseCommand diff --git a/onadata/apps/logger/management/commands/fix_root_node_names.py b/onadata/apps/logger/management/commands/fix_root_node_names.py index 96fc0c811..d93dcab5b 100644 --- a/onadata/apps/logger/management/commands/fix_root_node_names.py +++ b/onadata/apps/logger/management/commands/fix_root_node_names.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import time from django.core.management.base import BaseCommand from django.db import connections diff --git a/onadata/apps/logger/management/commands/import.py b/onadata/apps/logger/management/commands/import.py index 6347b97ed..c52299624 100644 --- a/onadata/apps/logger/management/commands/import.py +++ b/onadata/apps/logger/management/commands/import.py @@ -1,8 +1,6 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os from django.core.management.base import BaseCommand from django.core.management import call_command diff --git a/onadata/apps/logger/management/commands/import_briefcase.py b/onadata/apps/logger/management/commands/import_briefcase.py index 761ad91a5..db40379e0 100644 --- a/onadata/apps/logger/management/commands/import_briefcase.py +++ b/onadata/apps/logger/management/commands/import_briefcase.py @@ -1,28 +1,29 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.contrib.auth.models import User from django.core.management.base import BaseCommand from django.utils.translation import ugettext as _ -from optparse import make_option from onadata.libs.utils.briefcase_client import BriefcaseClient class Command(BaseCommand): help = _("Insert all existing parsed instances into MongoDB") - option_list = BaseCommand.option_list + ( - make_option('--url', - help=_("server url to pull forms and submissions")), - make_option('-u', '--username', - help=_("Username")), - make_option('-p', '--password', - help=_("Password")), - make_option('--to', - help=_("username in this server")), - ) + + def add_arguments(self, parser): + parser.add_argument('--url', + help=_("server url to pull forms and submissions")) + + parser.add_argument('-u', '--username', + help=_("Username")) + + parser.add_argument('-p', '--password', + help=_("Password")) + + parser.add_argument('--to', + help=_("username in this server")) + def handle(self, *args, **kwargs): url = kwargs.get('url') diff --git a/onadata/apps/logger/management/commands/import_forms.py b/onadata/apps/logger/management/commands/import_forms.py index ab66ffc6c..05512d155 100644 --- a/onadata/apps/logger/management/commands/import_forms.py +++ b/onadata/apps/logger/management/commands/import_forms.py @@ -1,8 +1,6 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import glob import os from django.core.management.base import BaseCommand diff --git a/onadata/apps/logger/management/commands/import_instances.py b/onadata/apps/logger/management/commands/import_instances.py index 13d4d4bbd..81c6689b0 100644 --- a/onadata/apps/logger/management/commands/import_instances.py +++ b/onadata/apps/logger/management/commands/import_instances.py @@ -1,8 +1,6 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os from django.contrib.auth.models import User diff --git a/onadata/apps/logger/management/commands/import_tools.py b/onadata/apps/logger/management/commands/import_tools.py index a13495a6d..fe455b91b 100644 --- a/onadata/apps/logger/management/commands/import_tools.py +++ b/onadata/apps/logger/management/commands/import_tools.py @@ -1,8 +1,6 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import glob import os diff --git a/onadata/apps/logger/management/commands/move_media_to_s3.py b/onadata/apps/logger/management/commands/move_media_to_s3.py index 7d5473a6c..83b4c2edc 100644 --- a/onadata/apps/logger/management/commands/move_media_to_s3.py +++ b/onadata/apps/logger/management/commands/move_media_to_s3.py @@ -1,9 +1,6 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - - import sys from django.core.files.storage import get_storage_class @@ -25,7 +22,7 @@ def handle(self, *args, **kwargs): try: fs = get_storage_class( 'django.core.files.storage.FileSystemStorage')() - s3 = get_storage_class('storages.backends.s3boto.S3BotoStorage')() + s3 = get_storage_class('storages.backends.s3boto3.S3Boto3Storage')() except: print(_("Missing necessary libraries. Try running: pip install -r" "requirements/s3.pip")) diff --git a/onadata/apps/logger/management/commands/populate_media_file_basename.py b/onadata/apps/logger/management/commands/populate_media_file_basename.py index ee190c7f7..6cc6c3f8f 100644 --- a/onadata/apps/logger/management/commands/populate_media_file_basename.py +++ b/onadata/apps/logger/management/commands/populate_media_file_basename.py @@ -1,10 +1,6 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - -from optparse import make_option - from django.core.management.base import BaseCommand from django.db.models import Q, Func from django.utils.translation import ugettext as _, ugettext_lazy @@ -19,13 +15,15 @@ class SubstrFromPattern(Func): class Command(BaseCommand): - help = ugettext_lazy("Updates indexed field `media_file_basename` which is empty or null") - option_list = BaseCommand.option_list + ( - make_option( + help = ugettext_lazy("Updates indexed field `media_file_basename` " + "which is empty or null") + + def add_arguments(self, parser): + parser.add_argument( '--batchsize', - type='int', + type=int, default=1000, - help=ugettext_lazy("Number of records to process per query")),) + help=ugettext_lazy("Number of records to process per query")) def handle(self, *args, **kwargs): batchsize = kwargs.get("batchsize") diff --git a/onadata/apps/logger/management/commands/populate_xml_hashes_for_instances.py b/onadata/apps/logger/management/commands/populate_xml_hashes_for_instances.py index 31c1408cc..e9e39a994 100644 --- a/onadata/apps/logger/management/commands/populate_xml_hashes_for_instances.py +++ b/onadata/apps/logger/management/commands/populate_xml_hashes_for_instances.py @@ -1,5 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import ''' Django management command to populate `Instance` instances with hashes for use in duplicate detection. diff --git a/onadata/apps/logger/management/commands/publish_xls.py b/onadata/apps/logger/management/commands/publish_xls.py index 31f57a919..d78e59334 100644 --- a/onadata/apps/logger/management/commands/publish_xls.py +++ b/onadata/apps/logger/management/commands/publish_xls.py @@ -1,8 +1,5 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os -from optparse import make_option from django.contrib.auth.models import User from django.core.management.base import BaseCommand, CommandError @@ -19,26 +16,32 @@ class Command(BaseCommand): help = ugettext_lazy("Publish an XLS file with the option of replacing an" "existing one") - option_list = BaseCommand.option_list + ( - make_option('-r', '--replace', - action='store_true', - dest='replace', - help=ugettext_lazy("Replace existing form if any")),) + def add_arguments(self, parser): + parser.add_argument('xls_filepath', + help=ugettext_lazy("Path to the xls file")) + + parser.add_argument('username', + help=ugettext_lazy("Username to publish the form to")) + + parser.add_argument('-r', '--replace', + action='store_true', + dest='replace', + help=ugettext_lazy("Replace existing form if any")) def handle(self, *args, **options): try: - xls_filepath = args[0] - except IndexError: + xls_filepath = options['xls_filepath'] + except KeyError: raise CommandError(_("You must provide the path to the xls file.")) # make sure path exists - if not os.path.exists(xls_filepath): + if not xls_filepath or not os.path.exists(xls_filepath): raise CommandError( _("The xls file '%s' does not exist.") % xls_filepath) try: - username = args[1] - except IndexError: + username = options['username'] + except KeyError: raise CommandError(_( "You must provide the username to publish the form to.")) # make sure user exists diff --git a/onadata/apps/logger/management/commands/pull_from_aggregate.py b/onadata/apps/logger/management/commands/pull_from_aggregate.py index f45101a59..10e02d277 100644 --- a/onadata/apps/logger/management/commands/pull_from_aggregate.py +++ b/onadata/apps/logger/management/commands/pull_from_aggregate.py @@ -1,28 +1,28 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.contrib.auth.models import User from django.core.management.base import BaseCommand from django.utils.translation import ugettext as _ -from optparse import make_option from onadata.libs.utils.briefcase_client import BriefcaseClient class Command(BaseCommand): help = _("Insert all existing parsed instances into MongoDB") - option_list = BaseCommand.option_list + ( - make_option('--url', - help=_("server url to pull forms and submissions")), - make_option('-u', '--username', - help=_("Username")), - make_option('-p', '--password', - help=_("Password")), - make_option('--to', - help=_("username in this server")), - ) + + def add_arguments(self, parser): + parser.add_argument('--url', + help=_("server url to pull forms and submissions")) + + parser.add_argument('-u', '--username', + help=_("Username")) + + parser.add_argument('-p', '--password', + help=_("Password")) + + parser.add_argument('--to', + help=_("username in this server")) def handle(self, *args, **kwargs): url = kwargs.get('url') diff --git a/onadata/apps/logger/management/commands/restore_backup.py b/onadata/apps/logger/management/commands/restore_backup.py index 2ab324794..ce41d70b7 100644 --- a/onadata/apps/logger/management/commands/restore_backup.py +++ b/onadata/apps/logger/management/commands/restore_backup.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os import sys diff --git a/onadata/apps/logger/management/commands/set_xform_surveys_with_geopoints.py b/onadata/apps/logger/management/commands/set_xform_surveys_with_geopoints.py index 376c45d9e..2449f0865 100644 --- a/onadata/apps/logger/management/commands/set_xform_surveys_with_geopoints.py +++ b/onadata/apps/logger/management/commands/set_xform_surveys_with_geopoints.py @@ -1,9 +1,6 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - - from django.core.management.base import BaseCommand from django.utils.translation import ugettext_lazy diff --git a/onadata/apps/logger/management/commands/sync_deleted_instances_fix.py b/onadata/apps/logger/management/commands/sync_deleted_instances_fix.py index 6b630feef..c67bea984 100644 --- a/onadata/apps/logger/management/commands/sync_deleted_instances_fix.py +++ b/onadata/apps/logger/management/commands/sync_deleted_instances_fix.py @@ -1,8 +1,6 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import json from django.conf import settings diff --git a/onadata/apps/logger/management/commands/update_is_sync_with_mongo.py b/onadata/apps/logger/management/commands/update_is_sync_with_mongo.py index 8ea9002fa..0f0fef743 100644 --- a/onadata/apps/logger/management/commands/update_is_sync_with_mongo.py +++ b/onadata/apps/logger/management/commands/update_is_sync_with_mongo.py @@ -1,13 +1,9 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 coding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - - from django.conf import settings -from django.core.management.base import BaseCommand, CommandError +from django.core.management.base import BaseCommand from django.utils.translation import ugettext as _, ugettext_lazy -from optparse import make_option from onadata.apps.logger.models.instance import Instance @@ -15,12 +11,13 @@ class Command(BaseCommand): help = ugettext_lazy("Updates is_synced_with_mongo property of Instance model") - option_list = BaseCommand.option_list + ( - make_option( + + def add_arguments(self, parser): + parser.add_argument( '--batchsize', - type='int', + type=int, default=100, - help=ugettext_lazy("Number of records to process per query")),) + help=ugettext_lazy("Number of records to process per query")) def handle(self, *args, **kwargs): batchsize = kwargs.get("batchsize", 100) diff --git a/onadata/apps/logger/management/commands/update_xform_uuids.py b/onadata/apps/logger/management/commands/update_xform_uuids.py index 5b175bbb7..aeac7ff6c 100644 --- a/onadata/apps/logger/management/commands/update_xform_uuids.py +++ b/onadata/apps/logger/management/commands/update_xform_uuids.py @@ -1,10 +1,7 @@ #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 coding=utf-8 # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import csv -from optparse import make_option from django.core.management.base import BaseCommand, CommandError from django.utils.translation import ugettext_lazy @@ -15,12 +12,14 @@ class Command(BaseCommand): - help = ugettext_lazy( - "Use a csv file with username, id_string and new_uuid to set new uuids" - ) - option_list = BaseCommand.option_list + ( - make_option('-f', '--file', - help=ugettext_lazy("Path to csv file")),) + + help = ugettext_lazy("Use a csv file with username, " + "id_string and new_uuid to set new uuids") + + def add_arguments(self, parser): + + parser.add_argument('-f', '--file', + help=ugettext_lazy("Path to csv file")) def handle(self, *args, **kwargs): # all options are required diff --git a/onadata/apps/logger/migrations/0001_initial.py b/onadata/apps/logger/migrations/0001_initial.py index 96d27855e..94acea2a8 100644 --- a/onadata/apps/logger/migrations/0001_initial.py +++ b/onadata/apps/logger/migrations/0001_initial.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import django.contrib.gis.db.models.fields import jsonfield.fields import taggit.managers @@ -24,7 +22,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('media_file', models.FileField(upload_to=onadata.apps.logger.models.attachment.upload_to)), - ('mimetype', models.CharField(default=b'', max_length=50, blank=True)), + ('mimetype', models.CharField(default='', max_length=50, blank=True)), ], ), migrations.CreateModel( @@ -49,7 +47,7 @@ class Migration(migrations.Migration): ('uuid', models.CharField(default='', max_length=249)), ('date_created', models.DateTimeField(auto_now_add=True)), ('date_modified', models.DateTimeField(auto_now=True)), - ('xform_instance', models.ForeignKey(related_name='submission_history', to='logger.Instance')), + ('xform_instance', models.ForeignKey(related_name='submission_history', to='logger.Instance', on_delete=models.CASCADE)), ], ), migrations.CreateModel( @@ -59,7 +57,7 @@ class Migration(migrations.Migration): ('note', models.TextField()), ('date_created', models.DateTimeField(auto_now_add=True)), ('date_modified', models.DateTimeField(auto_now=True)), - ('instance', models.ForeignKey(related_name='notes', to='logger.Instance')), + ('instance', models.ForeignKey(related_name='notes', to='logger.Instance', on_delete=models.CASCADE)), ], options={ 'permissions': (('view_note', 'View note'),), @@ -86,7 +84,7 @@ class Migration(migrations.Migration): ('downloadable', models.BooleanField(default=True)), ('allows_sms', models.BooleanField(default=False)), ('encrypted', models.BooleanField(default=False)), - ('sms_id_string', models.SlugField(default=b'', verbose_name='SMS ID', max_length=100, editable=False)), + ('sms_id_string', models.SlugField(default='', verbose_name='SMS ID', max_length=100, editable=False)), ('id_string', models.SlugField(verbose_name='ID', max_length=100, editable=False)), ('title', models.CharField(max_length=255, editable=False)), ('date_created', models.DateTimeField(auto_now_add=True)), @@ -98,7 +96,7 @@ class Migration(migrations.Migration): ('instances_with_geopoints', models.BooleanField(default=False)), ('num_of_submissions', models.IntegerField(default=0)), ('tags', taggit.managers.TaggableManager(to='taggit.Tag', through='taggit.TaggedItem', help_text='A comma-separated list of tags.', verbose_name='Tags')), - ('user', models.ForeignKey(related_name='xforms', to=settings.AUTH_USER_MODEL, null=True)), + ('user', models.ForeignKey(related_name='xforms', to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE)), ], options={ 'ordering': ('id_string',), @@ -120,14 +118,14 @@ class Migration(migrations.Migration): ('date_created', models.DateTimeField(auto_now_add=True)), ('date_modified', models.DateTimeField(auto_now=True)), ('date_deleted', models.DateTimeField(default=None, null=True)), - ('reporter', models.ForeignKey(related_name='ziggys', to=settings.AUTH_USER_MODEL)), - ('xform', models.ForeignKey(related_name='ziggy_submissions', to='logger.XForm', null=True)), + ('reporter', models.ForeignKey(related_name='ziggys', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), + ('xform', models.ForeignKey(related_name='ziggy_submissions', to='logger.XForm', null=True, on_delete=models.CASCADE)), ], ), migrations.AddField( model_name='instance', name='survey_type', - field=models.ForeignKey(to='logger.SurveyType'), + field=models.ForeignKey(to='logger.SurveyType', on_delete=models.CASCADE), ), migrations.AddField( model_name='instance', @@ -137,17 +135,17 @@ class Migration(migrations.Migration): migrations.AddField( model_name='instance', name='user', - field=models.ForeignKey(related_name='instances', to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(related_name='instances', to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE), ), migrations.AddField( model_name='instance', name='xform', - field=models.ForeignKey(related_name='instances', to='logger.XForm', null=True), + field=models.ForeignKey(related_name='instances', to='logger.XForm', null=True, on_delete=models.CASCADE), ), migrations.AddField( model_name='attachment', name='instance', - field=models.ForeignKey(related_name='attachments', to='logger.Instance'), + field=models.ForeignKey(related_name='attachments', to='logger.Instance', on_delete=models.CASCADE), ), migrations.AlterUniqueTogether( name='xform', diff --git a/onadata/apps/logger/migrations/0002_attachment_filename_length.py b/onadata/apps/logger/migrations/0002_attachment_filename_length.py index fd74b9f33..4b6bb6478 100644 --- a/onadata/apps/logger/migrations/0002_attachment_filename_length.py +++ b/onadata/apps/logger/migrations/0002_attachment_filename_length.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.db import migrations, models import onadata.apps.logger.models.attachment diff --git a/onadata/apps/logger/migrations/0003_add-index-on-attachment-media-file.py b/onadata/apps/logger/migrations/0003_add-index-on-attachment-media-file.py index 208171f80..0c0524821 100644 --- a/onadata/apps/logger/migrations/0003_add-index-on-attachment-media-file.py +++ b/onadata/apps/logger/migrations/0003_add-index-on-attachment-media-file.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.db import migrations, models import onadata.apps.logger.models.attachment diff --git a/onadata/apps/logger/migrations/0004_increase-length-of-attachment-mimetype-field.py b/onadata/apps/logger/migrations/0004_increase-length-of-attachment-mimetype-field.py index 76ec7be06..479551a48 100644 --- a/onadata/apps/logger/migrations/0004_increase-length-of-attachment-mimetype-field.py +++ b/onadata/apps/logger/migrations/0004_increase-length-of-attachment-mimetype-field.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.db import migrations, models @@ -14,6 +12,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='attachment', name='mimetype', - field=models.CharField(default=b'', max_length=100, blank=True), + field=models.CharField(default='', max_length=100, blank=True), ), ] diff --git a/onadata/apps/logger/migrations/0005_instance_xml_hash.py b/onadata/apps/logger/migrations/0005_instance_xml_hash.py index 19a289d1e..42aff5891 100644 --- a/onadata/apps/logger/migrations/0005_instance_xml_hash.py +++ b/onadata/apps/logger/migrations/0005_instance_xml_hash.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.db import migrations, models diff --git a/onadata/apps/logger/migrations/0006_add_validation_status_json_field_in_instance_table.py b/onadata/apps/logger/migrations/0006_add_validation_status_json_field_in_instance_table.py index 393dab63f..447fdaa40 100644 --- a/onadata/apps/logger/migrations/0006_add_validation_status_json_field_in_instance_table.py +++ b/onadata/apps/logger/migrations/0006_add_validation_status_json_field_in_instance_table.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.db import migrations, models import jsonfield.fields diff --git a/onadata/apps/logger/migrations/0007_add_validate_permission_on_xform.py b/onadata/apps/logger/migrations/0007_add_validate_permission_on_xform.py index 13cd7ec07..6e9e17d42 100644 --- a/onadata/apps/logger/migrations/0007_add_validate_permission_on_xform.py +++ b/onadata/apps/logger/migrations/0007_add_validate_permission_on_xform.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.db import migrations, models @@ -13,6 +11,6 @@ class Migration(migrations.Migration): operations = [ migrations.AlterModelOptions( name='xform', - options={'ordering': ('id_string',), 'verbose_name': 'XForm', 'verbose_name_plural': 'XForms', 'permissions': (('view_xform', 'Can view associated data'), ('report_xform', 'Can make submissions to the form'), ('move_xform', 'Can move form between projects'), ('transfer_xform', 'Can transfer form ownership.'), ('validate_xform', 'Can validate submissions.'))}, + options={'ordering': ('id_string',), 'verbose_name': 'XForm', 'verbose_name_plural': 'XForms', 'permissions': (('report_xform', 'Can make submissions to the form'), ('move_xform', 'Can move form between projects'), ('transfer_xform', 'Can transfer form ownership.'), ('validate_xform', 'Can validate submissions.'))}, ), ] diff --git a/onadata/apps/logger/migrations/0008_add_instance_is_synced_with_mongo_and_xform_has_kpi_hooks.py b/onadata/apps/logger/migrations/0008_add_instance_is_synced_with_mongo_and_xform_has_kpi_hooks.py index 5ff4c6d7e..6d2787371 100644 --- a/onadata/apps/logger/migrations/0008_add_instance_is_synced_with_mongo_and_xform_has_kpi_hooks.py +++ b/onadata/apps/logger/migrations/0008_add_instance_is_synced_with_mongo_and_xform_has_kpi_hooks.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.db import migrations, models import onadata.apps.logger.fields diff --git a/onadata/apps/logger/migrations/0009_add_posted_to_kpi_field_to_logger_instance.py b/onadata/apps/logger/migrations/0009_add_posted_to_kpi_field_to_logger_instance.py index a6f932034..e10def355 100644 --- a/onadata/apps/logger/migrations/0009_add_posted_to_kpi_field_to_logger_instance.py +++ b/onadata/apps/logger/migrations/0009_add_posted_to_kpi_field_to_logger_instance.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.db import migrations, models import onadata.apps.logger.fields diff --git a/onadata/apps/logger/migrations/0010_attachment_media_file_basename.py b/onadata/apps/logger/migrations/0010_attachment_media_file_basename.py index b9e0a31f1..a9446e2bc 100644 --- a/onadata/apps/logger/migrations/0010_attachment_media_file_basename.py +++ b/onadata/apps/logger/migrations/0010_attachment_media_file_basename.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.db import migrations, models diff --git a/onadata/apps/logger/migrations/0011_add-index-to-instance-uuid_and_xform_uuid.py b/onadata/apps/logger/migrations/0011_add-index-to-instance-uuid_and_xform_uuid.py index 0405d1442..98b120f21 100644 --- a/onadata/apps/logger/migrations/0011_add-index-to-instance-uuid_and_xform_uuid.py +++ b/onadata/apps/logger/migrations/0011_add-index-to-instance-uuid_and_xform_uuid.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.db import migrations, models diff --git a/onadata/apps/logger/migrations/0012_add_asset_uid_to_xform.py b/onadata/apps/logger/migrations/0012_add_asset_uid_to_xform.py index 78e293d97..1ff610b2c 100644 --- a/onadata/apps/logger/migrations/0012_add_asset_uid_to_xform.py +++ b/onadata/apps/logger/migrations/0012_add_asset_uid_to_xform.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.db import migrations, models diff --git a/onadata/apps/logger/migrations/0013_remove_bamboo_and_ziggy_instance.py b/onadata/apps/logger/migrations/0013_remove_bamboo_and_ziggy_instance.py index c567db61a..01d51b520 100644 --- a/onadata/apps/logger/migrations/0013_remove_bamboo_and_ziggy_instance.py +++ b/onadata/apps/logger/migrations/0013_remove_bamboo_and_ziggy_instance.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.db import migrations diff --git a/onadata/apps/logger/migrations/0014_attachment_add_media_file_size.py b/onadata/apps/logger/migrations/0014_attachment_add_media_file_size.py index d3220ee8f..5de4e887f 100644 --- a/onadata/apps/logger/migrations/0014_attachment_add_media_file_size.py +++ b/onadata/apps/logger/migrations/0014_attachment_add_media_file_size.py @@ -1,6 +1,4 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - +# coding: utf-8 from django.db import migrations, models diff --git a/onadata/apps/logger/migrations/0015_add_delete_data_permission.py b/onadata/apps/logger/migrations/0015_add_delete_data_permission.py index c7bd86d50..7bbc56f0b 100644 --- a/onadata/apps/logger/migrations/0015_add_delete_data_permission.py +++ b/onadata/apps/logger/migrations/0015_add_delete_data_permission.py @@ -1,6 +1,4 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - +# coding: utf-8 import sys from django.db import migrations @@ -13,14 +11,11 @@ def create_new_perms(apps): The new `delete_data_xform` permission does not exist when running this migration for the first time. Django runs migrations in a transaction and new permissions are not created until after the transaction is completed. - - See https://stackoverflow.com/a/40092780/1141214 """ - # ToDo update this code when upgrading to Django 2.x - # see https://stackoverflow.com/a/40092780/1141214 - apps.models_module = True - create_permissions(apps, verbosity=0) - apps.models_module = None + for app_config in apps.get_app_configs(): + app_config.models_module = True + create_permissions(app_config, apps=apps, verbosity=0) + app_config.models_module = None def grant_model_level_perms(apps): @@ -138,6 +133,15 @@ def reverse_func(apps, schema_editor): class Migration(migrations.Migration): + """ + This migration has changed between KoBoCAT 1.0 and KoBoCAT 2.0. + Permissions on Note model are altered in this migration in this branch. + With Django 2.2 "view" permission is included by default. + So `view_xform` and `view_notes` must be removed here because they were + added by previous migrations in Django 1.8. + It avoids an IntegrityError when Django tries to add `view_xform`|`view_notes` + twice. + """ dependencies = [ ('logger', '0014_attachment_add_media_file_size'), @@ -151,7 +155,6 @@ class Migration(migrations.Migration): 'verbose_name': 'XForm', 'verbose_name_plural': 'XForms', 'permissions': ( - ('view_xform', 'Can view associated data'), ('report_xform', 'Can make submissions to the form'), ('move_xform', 'Can move form between projects'), ('transfer_xform', 'Can transfer form ownership'), @@ -160,5 +163,9 @@ class Migration(migrations.Migration): ), }, ), + migrations.AlterModelOptions( + name='note', + options={'permissions': ()}, + ), migrations.RunPython(forwards_func, reverse_func), ] diff --git a/onadata/apps/logger/migrations/0016_remove_conflicting_view_permissions.py b/onadata/apps/logger/migrations/0016_remove_conflicting_view_permissions.py new file mode 100644 index 000000000..2ff1ec21e --- /dev/null +++ b/onadata/apps/logger/migrations/0016_remove_conflicting_view_permissions.py @@ -0,0 +1,35 @@ +# coding: utf-8 +from django.db import migrations, models + + +class Migration(migrations.Migration): + """ + Re-apply parts of `0015_add_delete_data_permission.py` for upgrade + of existing installations. + See `0015_add_delete_data_permission.py` for details + """ + + dependencies = [ + ('logger', '0015_add_delete_data_permission'), + ] + + operations = [ + migrations.AlterModelOptions( + name='xform', + options={ + 'ordering': ('id_string',), + 'verbose_name': 'XForm', + 'verbose_name_plural': 'XForms', + 'permissions': ( + ('report_xform', 'Can make submissions to the form'), + ('transfer_xform', 'Can transfer form ownership.'), + ('validate_xform', 'Can validate submissions.'), + ('delete_data_xform', 'Can delete submissions'), + ), + }, + ), + migrations.AlterModelOptions( + name='note', + options={'permissions': ()}, + ), + ] diff --git a/onadata/apps/logger/migrations/0017_remove_xform_sms.py b/onadata/apps/logger/migrations/0017_remove_xform_sms.py new file mode 100644 index 000000000..b56ff105a --- /dev/null +++ b/onadata/apps/logger/migrations/0017_remove_xform_sms.py @@ -0,0 +1,45 @@ +# Generated by Django 2.2.14 on 2021-03-15 20:37 + +from django.conf import settings +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('logger', '0016_remove_conflicting_view_permissions'), + ] + + operations = [] + + # This AlterUniqueTogether step can fail with + # ValueError: Found wrong number (0) of constraints for logger_xform(user_id, sms_id_string) # noqa + # when the database specifies the constraint in the opposite order, + # i.e. (sms_id_string, user_id). Let's try ignoring the + # `unique_together` change and simply depend upon the database + # automatically removing the constraint when the `sms_id_string` column + # is dropped. See also https://code.djangoproject.com/ticket/23906. + # + # But, if database is SQLite, the `unique_together` constraint removal must + # be enforced. + if not settings.USE_POSTGRESQL: + operations.append( + migrations.AlterUniqueTogether( + name='xform', + unique_together={('user', 'id_string')}, + ) + ) + + operations.append( + migrations.RemoveField( + model_name='xform', + name='allows_sms', + ) + ) + operations.append( + migrations.RemoveField( + model_name='xform', + name='sms_id_string', + ) + ) diff --git a/onadata/apps/logger/migrations/0018_add_submission_counter.py b/onadata/apps/logger/migrations/0018_add_submission_counter.py new file mode 100644 index 000000000..e4c83325c --- /dev/null +++ b/onadata/apps/logger/migrations/0018_add_submission_counter.py @@ -0,0 +1,25 @@ +# Generated by Django 2.2.14 on 2021-04-09 00:52 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('logger', '0017_remove_xform_sms'), + ] + + operations = [ + migrations.CreateModel( + name='SubmissionCounter', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('count', models.IntegerField(default=0)), + ('timestamp', models.DateTimeField(auto_now_add=True)), + ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='submissioncounter', to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/onadata/apps/logger/migrations/__init__.py b/onadata/apps/logger/migrations/__init__.py index 134880430..57d631c3f 100644 --- a/onadata/apps/logger/migrations/__init__.py +++ b/onadata/apps/logger/migrations/__init__.py @@ -1,2 +1 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import diff --git a/onadata/apps/logger/models/__init__.py b/onadata/apps/logger/models/__init__.py index 7be74f404..c59361554 100644 --- a/onadata/apps/logger/models/__init__.py +++ b/onadata/apps/logger/models/__init__.py @@ -1,5 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import from onadata.apps.logger.models.attachment import Attachment # flake8: noqa from onadata.apps.logger.models.instance import Instance from onadata.apps.logger.models.survey_type import SurveyType diff --git a/onadata/apps/logger/models/attachment.py b/onadata/apps/logger/models/attachment.py index 4bd7d26de..5b2904f95 100644 --- a/onadata/apps/logger/models/attachment.py +++ b/onadata/apps/logger/models/attachment.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import mimetypes import os from hashlib import md5 @@ -27,11 +25,13 @@ def upload_to(attachment, filename): def hash_attachment_contents(contents): - return '%s' % md5(contents).hexdigest() + if isinstance(contents, str): + contents = contents.encode() + return md5(contents).hexdigest() class Attachment(models.Model): - instance = models.ForeignKey(Instance, related_name="attachments") + instance = models.ForeignKey(Instance, related_name="attachments", on_delete=models.CASCADE) media_file = models.FileField(upload_to=upload_to, max_length=380, db_index=True) media_file_basename = models.CharField( max_length=260, null=True, blank=True, db_index=True) @@ -56,7 +56,7 @@ def save(self, *args, **kwargs): # the storage engine when running reports self.media_file_size = self.media_file.size - super(Attachment, self).save(*args, **kwargs) + super().save(*args, **kwargs) @property def file_hash(self): diff --git a/onadata/apps/logger/models/instance.py b/onadata/apps/logger/models/instance.py index 61a308969..70f440cdc 100644 --- a/onadata/apps/logger/models/instance.py +++ b/onadata/apps/logger/models/instance.py @@ -1,7 +1,5 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - -from datetime import datetime +from datetime import date, datetime from hashlib import sha256 import reversion @@ -13,6 +11,7 @@ from django.db.models.signals import post_delete from django.db.models.signals import post_save from django.utils import timezone +from django.utils.encoding import smart_text from jsonfield import JSONField from taggit.managers import TaggableManager @@ -20,6 +19,7 @@ from onadata.apps.logger.fields import LazyDefaultBooleanField from onadata.apps.logger.models.survey_type import SurveyType from onadata.apps.logger.models.xform import XForm +from onadata.apps.logger.models.submission_counter import SubmissionCounter from onadata.apps.logger.xform_instance_parser import XFormInstanceParser, \ clean_and_parse_xml, get_uuid_from_xml from onadata.libs.utils.common_tags import ( @@ -91,6 +91,28 @@ def update_xform_submission_count(sender, instance, created, **kwargs): ) +def update_user_submissions_counter(sender, instance, created, **kwargs): + if not created: + return + if getattr(instance, 'defer_counting', False): + return + + # Querying the database this way because it's faster than querying + # the instance model for the data + user_id = XForm.objects.values_list('user_id', flat=True).get( + pk=instance.xform_id + ) + today = date.today() + first_day_of_month = today.replace(day=1) + queryset = SubmissionCounter.objects.filter( + user_id=user_id, timestamp=first_day_of_month + ) + if not queryset.exists(): + SubmissionCounter.objects.create(user_id=user_id) + + queryset.update(count=F('count') + 1) + + def update_xform_submission_count_delete(sender, instance, **kwargs): try: xform = XForm.objects.select_for_update().get(pk=instance.xform.pk) @@ -100,7 +122,9 @@ def update_xform_submission_count_delete(sender, instance, **kwargs): xform.num_of_submissions -= 1 if xform.num_of_submissions < 0: xform.num_of_submissions = 0 - xform.save(update_fields=['num_of_submissions']) + # Update `date_modified` to detect outdated exports + # with deleted instances + xform.save(update_fields=['num_of_submissions', 'date_modified']) profile_qs = User.profile.get_queryset() try: profile = profile_qs.select_for_update()\ @@ -123,9 +147,9 @@ class Instance(models.Model): xml = models.TextField() xml_hash = models.CharField(max_length=XML_HASH_LENGTH, db_index=True, null=True, default=DEFAULT_XML_HASH) - user = models.ForeignKey(User, related_name='instances', null=True) - xform = models.ForeignKey(XForm, null=True, related_name='instances') - survey_type = models.ForeignKey(SurveyType) + user = models.ForeignKey(User, related_name='instances', null=True, on_delete=models.CASCADE) + xform = models.ForeignKey(XForm, null=True, related_name='instances', on_delete=models.CASCADE) + survey_type = models.ForeignKey(SurveyType, on_delete=models.CASCADE) # shows when we first received this instance date_created = models.DateTimeField(auto_now_add=True) @@ -145,7 +169,6 @@ class Instance(models.Model): # store an geographic objects associated with this instance geom = models.GeometryCollectionField(null=True) - objects = models.GeoManager() tags = TaggableManager() @@ -244,15 +267,15 @@ def _set_uuid(self): set_uuid(self) def _populate_xml_hash(self): - ''' + """ Populate the `xml_hash` attribute of this `Instance` based on the content of the `xml` attribute. - ''' + """ self.xml_hash = self.get_hash(self.xml) @classmethod def populate_xml_hashes_for_instances(cls, usernames=None, pk__in=None, repopulate=False): - ''' + """ Populate the `xml_hash` field for `Instance` instances limited to the specified users and/or DB primary keys. @@ -263,7 +286,7 @@ def populate_xml_hashes_for_instances(cls, usernames=None, pk__in=None, repopula :param bool repopulate: Optional argument to force repopulation of existing hashes. :returns: Total number of `Instance`s updated. :rtype: int - ''' + """ filter_kwargs = dict() if usernames: @@ -359,13 +382,12 @@ def get_hash(input_string): """ Compute the SHA256 hash of the given string. A wrapper to standardize hash computation. - :param basestring input_string: The string to be hashed. + :param string_types input_string: The string to be hashed. :return: The resulting hash. :rtype: str """ - if isinstance(input_string, unicode): - input_string = input_string.encode('utf-8') - return sha256(input_string).hexdigest() + input_string = smart_text(input_string) + return sha256(input_string.encode()).hexdigest() @property def point(self): @@ -389,7 +411,7 @@ def save(self, *args, **kwargs): if self.validation_status is None: self.validation_status = {} - super(Instance, self).save(*args, **kwargs) + super().save(*args, **kwargs) def set_deleted(self, deleted_at=timezone.now()): self.deleted_at = deleted_at @@ -414,6 +436,9 @@ def get_validation_status(self): post_save.connect(update_xform_submission_count, sender=Instance, dispatch_uid='update_xform_submission_count') +post_save.connect(update_user_submissions_counter, sender=Instance, + dispatch_uid='update_user_submissions_counter') + post_delete.connect(update_xform_submission_count_delete, sender=Instance, dispatch_uid='update_xform_submission_count_delete') @@ -427,7 +452,7 @@ class Meta: app_label = 'logger' xform_instance = models.ForeignKey( - Instance, related_name='submission_history') + Instance, related_name='submission_history', on_delete=models.CASCADE) xml = models.TextField() # old instance id uuid = models.CharField(max_length=249, default='') diff --git a/onadata/apps/logger/models/note.py b/onadata/apps/logger/models/note.py index 0b3cd43c8..bc0b77742 100644 --- a/onadata/apps/logger/models/note.py +++ b/onadata/apps/logger/models/note.py @@ -1,18 +1,13 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.db import models from .instance import Instance class Note(models.Model): note = models.TextField() - instance = models.ForeignKey(Instance, related_name='notes') + instance = models.ForeignKey(Instance, related_name='notes', on_delete=models.CASCADE) date_created = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) class Meta: app_label = 'logger' - permissions = ( - ('view_note', 'View note'), - ) diff --git a/onadata/apps/logger/models/submission_counter.py b/onadata/apps/logger/models/submission_counter.py new file mode 100644 index 000000000..c809dba72 --- /dev/null +++ b/onadata/apps/logger/models/submission_counter.py @@ -0,0 +1,22 @@ +# coding: utf-8 +import datetime +from django.contrib.auth.models import User +from django.contrib.gis.db import models + + +class SubmissionCounter(models.Model): + user = models.ForeignKey( + User, + related_name='submissioncounter', + null=True, + on_delete=models.CASCADE, + ) + count = models.IntegerField(default=0) + timestamp = models.DateTimeField() + + def save(self, *args, **kwargs): + today = datetime.date.today() + first_day_of_month = today.replace(day=1) + + self.timestamp = first_day_of_month + super().save(*args, **kwargs) diff --git a/onadata/apps/logger/models/survey_type.py b/onadata/apps/logger/models/survey_type.py index d922a24f4..df57b9c5b 100644 --- a/onadata/apps/logger/models/survey_type.py +++ b/onadata/apps/logger/models/survey_type.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.db import models @@ -10,5 +8,5 @@ class SurveyType(models.Model): class Meta: app_label = 'logger' - def __unicode__(self): + def __str__(self): return "SurveyType: %s" % self.slug diff --git a/onadata/apps/logger/models/xform.py b/onadata/apps/logger/models/xform.py index 9c6a996c7..4f0b0f6b6 100644 --- a/onadata/apps/logger/models/xform.py +++ b/onadata/apps/logger/models/xform.py @@ -1,25 +1,19 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - -import io import json import os import re -from cStringIO import StringIO -from datetime import datetime from hashlib import md5 from xml.sax import saxutils -import pytz from django.conf import settings from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist from django.core.files.storage import get_storage_class -from django.core.urlresolvers import reverse +from django.urls import reverse from django.db import models from django.db.models.signals import post_save, post_delete -from django.utils import timezone from django.utils.encoding import smart_text + from django.utils.translation import ugettext_lazy, ugettext as _ from guardian.shortcuts import ( assign_perm, @@ -39,11 +33,6 @@ ) from onadata.libs.models.base_model import BaseModel -try: - from formpack.utils.xls_to_ss_structure import xls_to_dicts -except ImportError: - xls_to_dicts = False - XFORM_TITLE_LENGTH = 255 title_pattern = re.compile(r"([^<]+)") @@ -65,21 +54,13 @@ class XForm(BaseModel): description = models.TextField(default='', null=True) xml = models.TextField() - user = models.ForeignKey(User, related_name='xforms', null=True) + user = models.ForeignKey(User, related_name='xforms', null=True, on_delete=models.CASCADE) require_auth = models.BooleanField(default=False) shared = models.BooleanField(default=False) shared_data = models.BooleanField(default=False) downloadable = models.BooleanField(default=True) - allows_sms = models.BooleanField(default=False) encrypted = models.BooleanField(default=False) - # the following fields are filled in automatically - sms_id_string = models.SlugField( - editable=False, - verbose_name=ugettext_lazy("SMS ID"), - max_length=MAX_ID_LENGTH, - default='' - ) id_string = models.SlugField( editable=False, verbose_name=ugettext_lazy("ID"), @@ -108,12 +89,11 @@ class XForm(BaseModel): class Meta: app_label = 'logger' - unique_together = (("user", "id_string"), ("user", "sms_id_string")) + unique_together = (("user", "id_string"),) verbose_name = ugettext_lazy("XForm") verbose_name_plural = ugettext_lazy("XForms") ordering = ("id_string",) permissions = ( - (CAN_VIEW_XFORM, _('Can view associated data')), (CAN_ADD_SUBMISSIONS, _('Can make submissions to the form')), (CAN_TRANSFER_OWNERSHIP, _('Can transfer form ownership.')), (CAN_VALIDATE_XFORM, _('Can validate submissions')), @@ -185,7 +165,7 @@ def _set_encrypted_field(self): self.encrypted = False def update(self, *args, **kwargs): - super(XForm, self).save(*args, **kwargs) + super().save(*args, **kwargs) def save(self, *args, **kwargs): self._set_title() @@ -206,19 +186,9 @@ def save(self, *args, **kwargs): raise XLSFormError(_('In strict mode, the XForm ID must be a ' 'valid slug and contain no spaces.')) - if not self.sms_id_string: - try: - # try to guess the form's wanted sms_id_string - # from it's json rep (from XLSForm) - # otherwise, use id_string to ensure uniqueness - self.sms_id_string = json.loads(self.json).get('sms_keyword', - self.id_string) - except: - self.sms_id_string = self.id_string - - super(XForm, self).save(*args, **kwargs) + super().save(*args, **kwargs) - def __unicode__(self): + def __str__(self): return getattr(self, "id_string", "") def submission_count(self, force_update=False): @@ -248,14 +218,15 @@ def time_of_last_submission(self): def time_of_last_submission_update(self): try: - # we also consider deleted instances in this case + # We don't need to filter on `deleted_at` field anymore. + # Instances are really deleted and not flagged as deleted. return self.instances.latest("date_modified").date_modified except ObjectDoesNotExist: pass @property def hash(self): - return '%s' % md5(self.xml.encode('utf8')).hexdigest() + return md5(self.xml.encode()).hexdigest() @property def can_be_replaced(self): @@ -271,7 +242,7 @@ def public_forms(cls): def _xls_file_io(self): """ - pulls the xls file from remote storage + Pulls the xls file from remote storage this should be used sparingly """ @@ -283,36 +254,7 @@ def _xls_file_io(self): if file_path.endswith('.csv'): return convert_csv_to_xls(ff.read()) else: - return StringIO(ff.read()) - - def to_kpi_content_schema(self): - """ - Parses xlsform structure into json representation - of spreadsheet structure. - """ - if not xls_to_dicts: - raise ImportError('formpack module needed') - content = xls_to_dicts(self._xls_file_io()) - # a temporary fix to the problem of list_name alias - return json.loads(re.sub('list name', 'list_name', - json.dumps(content, indent=4))) - - def to_xlsform(self): - """ - Generate an XLS format XLSForm copy of this form. - """ - file_path = self.xls.name - default_storage = get_storage_class()() - - if file_path != '' and default_storage.exists(file_path): - with default_storage.open(file_path) as xlsform_file: - if file_path.endswith('.csv'): - xlsform_io = convert_csv_to_xls(xlsform_file.read()) - else: - xlsform_io= io.BytesIO(xlsform_file.read()) - return xlsform_io - else: - return None + return BytesIO(ff.read()) @property def settings(self): diff --git a/onadata/apps/logger/south_migrations/0001_initial.py b/onadata/apps/logger/south_migrations/0001_initial.py deleted file mode 100644 index c930bae66..000000000 --- a/onadata/apps/logger/south_migrations/0001_initial.py +++ /dev/null @@ -1,146 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding model 'XForm' - db.create_table('odk_logger_xform', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('xml', self.gf('django.db.models.fields.TextField')()), - ('downloadable', self.gf('django.db.models.fields.BooleanField')(default=False)), - ('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='xforms', null=True, to=orm['auth.User'])), - ('id_string', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=50, db_index=True)), - ('title', self.gf('django.db.models.fields.CharField')(max_length=64)), - ('date_created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - ('date_modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), - )) - db.send_create_signal('odk_logger', ['XForm']) - - # Adding model 'SurveyType' - db.create_table('odk_logger_surveytype', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('slug', self.gf('django.db.models.fields.CharField')(max_length=100)), - )) - db.send_create_signal('odk_logger', ['SurveyType']) - - # Adding model 'Instance' - db.create_table('odk_logger_instance', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('xml', self.gf('django.db.models.fields.TextField')()), - ('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='surveys', null=True, to=orm['auth.User'])), - ('xform', self.gf('django.db.models.fields.related.ForeignKey')(related_name='surveys', null=True, to=orm['odk_logger.XForm'])), - ('start_time', self.gf('django.db.models.fields.DateTimeField')(null=True)), - ('date', self.gf('django.db.models.fields.DateField')(null=True)), - ('survey_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['odk_logger.SurveyType'])), - ('date_created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - ('date_modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), - ('status', self.gf('django.db.models.fields.CharField')(default='submitted_via_web', max_length=20)), - )) - db.send_create_signal('odk_logger', ['Instance']) - - # Adding model 'Attachment' - db.create_table('odk_logger_attachment', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('instance', self.gf('django.db.models.fields.related.ForeignKey')(related_name='attachments', to=orm['odk_logger.Instance'])), - ('media_file', self.gf('django.db.models.fields.files.FileField')(max_length=100)), - )) - db.send_create_signal('odk_logger', ['Attachment']) - - - def backwards(self, orm): - - # Deleting model 'XForm' - db.delete_table('odk_logger_xform') - - # Deleting model 'SurveyType' - db.delete_table('odk_logger_surveytype') - - # Deleting model 'Instance' - db.delete_table('odk_logger_instance') - - # Deleting model 'Attachment' - db.delete_table('odk_logger_attachment') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'object_name': 'XForm'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0002_auto__del_unique_xform_id_string__add_unique_xform_id_string_user.py b/onadata/apps/logger/south_migrations/0002_auto__del_unique_xform_id_string__add_unique_xform_id_string_user.py deleted file mode 100644 index dd39f34a5..000000000 --- a/onadata/apps/logger/south_migrations/0002_auto__del_unique_xform_id_string__add_unique_xform_id_string_user.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Removing unique constraint on 'XForm', fields ['id_string'] - db.delete_unique('odk_logger_xform', ['id_string']) - - # Adding unique constraint on 'XForm', fields ['id_string', 'user'] - db.create_unique('odk_logger_xform', ['id_string', 'user_id']) - - - def backwards(self, orm): - - # Removing unique constraint on 'XForm', fields ['id_string', 'user'] - db.delete_unique('odk_logger_xform', ['id_string', 'user_id']) - - # Adding unique constraint on 'XForm', fields ['id_string'] - db.create_unique('odk_logger_xform', ['id_string']) - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0003_auto__add_field_xform_deleted.py b/onadata/apps/logger/south_migrations/0003_auto__add_field_xform_deleted.py deleted file mode 100644 index 8c162f2fc..000000000 --- a/onadata/apps/logger/south_migrations/0003_auto__add_field_xform_deleted.py +++ /dev/null @@ -1,98 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'XForm.deleted' - db.add_column('odk_logger_xform', 'deleted', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'XForm.deleted' - db.delete_column('odk_logger_xform', 'deleted') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0004_auto__del_field_xform_deleted.py b/onadata/apps/logger/south_migrations/0004_auto__del_field_xform_deleted.py deleted file mode 100644 index ab8027b52..000000000 --- a/onadata/apps/logger/south_migrations/0004_auto__del_field_xform_deleted.py +++ /dev/null @@ -1,97 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Deleting field 'XForm.deleted' - db.delete_column('odk_logger_xform', 'deleted') - - - def backwards(self, orm): - - # Adding field 'XForm.deleted' - db.add_column('odk_logger_xform', 'deleted', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False) - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0005_auto__add_field_xform_xls__add_field_xform_json__add_field_xform_share.py b/onadata/apps/logger/south_migrations/0005_auto__add_field_xform_xls__add_field_xform_json__add_field_xform_share.py deleted file mode 100644 index 1ae4fd4b2..000000000 --- a/onadata/apps/logger/south_migrations/0005_auto__add_field_xform_xls__add_field_xform_json__add_field_xform_share.py +++ /dev/null @@ -1,112 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'XForm.xls' - db.add_column('odk_logger_xform', 'xls', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True), keep_default=False) - - # Adding field 'XForm.json' - db.add_column('odk_logger_xform', 'json', self.gf('django.db.models.fields.TextField')(default=''), keep_default=False) - - # Adding field 'XForm.shared' - db.add_column('odk_logger_xform', 'shared', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'XForm.xls' - db.delete_column('odk_logger_xform', 'xls') - - # Deleting field 'XForm.json' - db.delete_column('odk_logger_xform', 'json') - - # Deleting field 'XForm.shared' - db.delete_column('odk_logger_xform', 'shared') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0006_copy_data_dictionary_info.py b/onadata/apps/logger/south_migrations/0006_copy_data_dictionary_info.py deleted file mode 100644 index e72155123..000000000 --- a/onadata/apps/logger/south_migrations/0006_copy_data_dictionary_info.py +++ /dev/null @@ -1,96 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import DataMigration -from django.db import models - -class Migration(DataMigration): - - def forwards(self, orm): - "Write your forwards methods here." - pass - - def backwards(self, orm): - "Write your backwards methods here." - pass - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0007_auto__add_field_xform_has_start_time.py b/onadata/apps/logger/south_migrations/0007_auto__add_field_xform_has_start_time.py deleted file mode 100644 index 43227cdc1..000000000 --- a/onadata/apps/logger/south_migrations/0007_auto__add_field_xform_has_start_time.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'XForm.has_start_time' - db.add_column('odk_logger_xform', 'has_start_time', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False) - - def backwards(self, orm): - - # Deleting field 'XForm.has_start_time' - db.delete_column('odk_logger_xform', 'has_start_time') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0008_add_description.py b/onadata/apps/logger/south_migrations/0008_add_description.py deleted file mode 100644 index f95aa5c8d..000000000 --- a/onadata/apps/logger/south_migrations/0008_add_description.py +++ /dev/null @@ -1,102 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'XForm.description' - db.add_column('odk_logger_xform', 'description', self.gf('django.db.models.fields.TextField')(default='', null=True), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'XForm.description' - db.delete_column('odk_logger_xform', 'description') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0009_auto__add_field_xform_shared_data.py b/onadata/apps/logger/south_migrations/0009_auto__add_field_xform_shared_data.py deleted file mode 100644 index 324698e71..000000000 --- a/onadata/apps/logger/south_migrations/0009_auto__add_field_xform_shared_data.py +++ /dev/null @@ -1,101 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'XForm.shared_data' - db.add_column('odk_logger_xform', 'shared_data', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'XForm.shared_data' - db.delete_column('odk_logger_xform', 'shared_data') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0010_auto__add_field_xform_uuid.py b/onadata/apps/logger/south_migrations/0010_auto__add_field_xform_uuid.py deleted file mode 100644 index 82ea491b7..000000000 --- a/onadata/apps/logger/south_migrations/0010_auto__add_field_xform_uuid.py +++ /dev/null @@ -1,104 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'XForm.uuid' - db.add_column('odk_logger_xform', 'uuid', self.gf('django.db.models.fields.CharField')(default='', max_length=32), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'XForm.uuid' - db.delete_column('odk_logger_xform', 'uuid') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0011_add_uuid.py b/onadata/apps/logger/south_migrations/0011_add_uuid.py deleted file mode 100644 index e529f456a..000000000 --- a/onadata/apps/logger/south_migrations/0011_add_uuid.py +++ /dev/null @@ -1,104 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import DataMigration -from django.db import models -import uuid - -class Migration(DataMigration): - - def forwards(self, orm): - "Write your forwards methods here." - for xform in orm['odk_logger.XForm'].objects.all(): - xform.uuid = uuid.uuid4().hex - xform.save() - - - def backwards(self, orm): - "Write your backwards methods here." - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0012_add_permission_view_xform.py b/onadata/apps/logger/south_migrations/0012_add_permission_view_xform.py deleted file mode 100644 index ab070cffc..000000000 --- a/onadata/apps/logger/south_migrations/0012_add_permission_view_xform.py +++ /dev/null @@ -1,113 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import DataMigration -from django.db import models -from django.contrib.contenttypes.models import ContentType -from django.contrib.auth.models import Permission - - -class Migration(DataMigration): - - depends_on = ( - ("guardian", "0005_auto__chg_field_groupobjectpermission_object_pk__chg_field_userobjectp"), - ) - - def forwards(self, orm): - pass - # remove old permission label if migrated with old model metadata - try: - ct = ContentType.objects.get(model='xform', app_label='odk_logger') - Permission.objects.get(content_type=ct, codename='can_view').delete() - # add new permission label - perm, created = Permission.objects.get_or_create(content_type=ct, codename='view_xform', name='Can view associated data') - except (ContentType.DoesNotExist, Permission.DoesNotExist): - pass - - def backwards(self, orm): - pass - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0013_auto__add_field_instance_uuid.py b/onadata/apps/logger/south_migrations/0013_auto__add_field_instance_uuid.py deleted file mode 100644 index ed8c76b6e..000000000 --- a/onadata/apps/logger/south_migrations/0013_auto__add_field_instance_uuid.py +++ /dev/null @@ -1,106 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'Instance.uuid' - db.add_column('odk_logger_instance', 'uuid', self.gf('django.db.models.fields.CharField')(default='', max_length=32), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'Instance.uuid' - db.delete_column('odk_logger_instance', 'uuid') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0014_add_instance_uuids.py b/onadata/apps/logger/south_migrations/0014_add_instance_uuids.py deleted file mode 100644 index 51c4c7350..000000000 --- a/onadata/apps/logger/south_migrations/0014_add_instance_uuids.py +++ /dev/null @@ -1,105 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -import uuid -from south.db import db -from south.v2 import DataMigration -from django.db import models - -class Migration(DataMigration): - - def forwards(self, orm): - "Write your forwards methods here." - for instance in orm['odk_logger.Instance'].objects.all(): - instance.uuid = uuid.uuid4().hex - instance.save() - - - def backwards(self, orm): - "Write your backwards methods here." - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0015_auto__add_field_xform_is_crowd_form.py b/onadata/apps/logger/south_migrations/0015_auto__add_field_xform_is_crowd_form.py deleted file mode 100644 index 3e297c091..000000000 --- a/onadata/apps/logger/south_migrations/0015_auto__add_field_xform_is_crowd_form.py +++ /dev/null @@ -1,106 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'XForm.is_crowd_form' - db.add_column('odk_logger_xform', 'is_crowd_form', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'XForm.is_crowd_form' - db.delete_column('odk_logger_xform', 'is_crowd_form') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0016_auto__add_field_xform_bamboo_dataset.py b/onadata/apps/logger/south_migrations/0016_auto__add_field_xform_bamboo_dataset.py deleted file mode 100644 index 0dbb126f2..000000000 --- a/onadata/apps/logger/south_migrations/0016_auto__add_field_xform_bamboo_dataset.py +++ /dev/null @@ -1,107 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'XForm.bamboo_dataset' - db.add_column('odk_logger_xform', 'bamboo_dataset', self.gf('django.db.models.fields.CharField')(default='', max_length=60), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'XForm.bamboo_dataset' - db.delete_column('odk_logger_xform', 'bamboo_dataset') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0017_auto__add_field_instance_deleted_at.py b/onadata/apps/logger/south_migrations/0017_auto__add_field_instance_deleted_at.py deleted file mode 100644 index 965dca412..000000000 --- a/onadata/apps/logger/south_migrations/0017_auto__add_field_instance_deleted_at.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'Instance.deleted_at' - db.add_column('odk_logger_instance', 'deleted_at', self.gf('django.db.models.fields.DateTimeField')(default=None, null=True), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'Instance.deleted_at' - db.delete_column('odk_logger_instance', 'deleted_at') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0018_auto__add_instancehistory.py b/onadata/apps/logger/south_migrations/0018_auto__add_instancehistory.py deleted file mode 100644 index 1134aaa6d..000000000 --- a/onadata/apps/logger/south_migrations/0018_auto__add_instancehistory.py +++ /dev/null @@ -1,123 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding model 'InstanceHistory' - db.create_table('odk_logger_instancehistory', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('xform_instance', self.gf('django.db.models.fields.related.ForeignKey')(related_name='submission_history', to=orm['odk_logger.Instance'])), - ('xml', self.gf('django.db.models.fields.TextField')()), - ('date_created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - ('date_modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), - )) - db.send_create_signal('odk_logger', ['InstanceHistory']) - - - def backwards(self, orm): - - # Deleting model 'InstanceHistory' - db.delete_table('odk_logger_instancehistory') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0019_auto__chg_field_instance_uuid.py b/onadata/apps/logger/south_migrations/0019_auto__chg_field_instance_uuid.py deleted file mode 100644 index 80369cdbb..000000000 --- a/onadata/apps/logger/south_migrations/0019_auto__chg_field_instance_uuid.py +++ /dev/null @@ -1,116 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'Instance.uuid' - db.alter_column('odk_logger_instance', 'uuid', self.gf('django.db.models.fields.CharField')(max_length=36)) - - - def backwards(self, orm): - - # Changing field 'Instance.uuid' - db.alter_column('odk_logger_instance', 'uuid', self.gf('django.db.models.fields.CharField')(max_length=32)) - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '36'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0020_auto__chg_field_instance_uuid.py b/onadata/apps/logger/south_migrations/0020_auto__chg_field_instance_uuid.py deleted file mode 100644 index d3445a969..000000000 --- a/onadata/apps/logger/south_migrations/0020_auto__chg_field_instance_uuid.py +++ /dev/null @@ -1,116 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'Instance.uuid' - db.alter_column('odk_logger_instance', 'uuid', self.gf('django.db.models.fields.CharField')(max_length=249)) - - - def backwards(self, orm): - - # Changing field 'Instance.uuid' - db.alter_column('odk_logger_instance', 'uuid', self.gf('django.db.models.fields.CharField')(max_length=36)) - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0021_auto__add_field_instancehistory_uuid.py b/onadata/apps/logger/south_migrations/0021_auto__add_field_instancehistory_uuid.py deleted file mode 100644 index 896d721c8..000000000 --- a/onadata/apps/logger/south_migrations/0021_auto__add_field_instancehistory_uuid.py +++ /dev/null @@ -1,117 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'InstanceHistory.uuid' - db.add_column('odk_logger_instancehistory', 'uuid', self.gf('django.db.models.fields.CharField')(default='', max_length=249), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'InstanceHistory.uuid' - db.delete_column('odk_logger_instancehistory', 'uuid') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0022_auto__add_field_attachment_mimetype.py b/onadata/apps/logger/south_migrations/0022_auto__add_field_attachment_mimetype.py deleted file mode 100644 index f3ee2dd22..000000000 --- a/onadata/apps/logger/south_migrations/0022_auto__add_field_attachment_mimetype.py +++ /dev/null @@ -1,118 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'Attachment.mimetype' - db.add_column('odk_logger_attachment', 'mimetype', self.gf('django.db.models.fields.CharField')(default='', max_length=20, blank=True), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'Attachment.mimetype' - db.delete_column('odk_logger_attachment', 'mimetype') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0023_auto__add_unique_surveytype_slug.py b/onadata/apps/logger/south_migrations/0023_auto__add_unique_surveytype_slug.py deleted file mode 100644 index 83430abeb..000000000 --- a/onadata/apps/logger/south_migrations/0023_auto__add_unique_surveytype_slug.py +++ /dev/null @@ -1,118 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding unique constraint on 'SurveyType', fields ['slug'] - db.create_unique('odk_logger_surveytype', ['slug']) - - - def backwards(self, orm): - - # Removing unique constraint on 'SurveyType', fields ['slug'] - db.delete_unique('odk_logger_surveytype', ['slug']) - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0024_auto__add_field_xform_allows_sms__add_field_xform_sms_id_string.py b/onadata/apps/logger/south_migrations/0024_auto__add_field_xform_allows_sms__add_field_xform_sms_id_string.py deleted file mode 100644 index 887288a7e..000000000 --- a/onadata/apps/logger/south_migrations/0024_auto__add_field_xform_allows_sms__add_field_xform_sms_id_string.py +++ /dev/null @@ -1,128 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'XForm.allows_sms' - db.add_column('odk_logger_xform', 'allows_sms', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - # Adding field 'XForm.sms_id_string' - db.add_column('odk_logger_xform', 'sms_id_string', - self.gf('django.db.models.fields.SlugField')(max_length=50, null=True), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'XForm.allows_sms' - db.delete_column('odk_logger_xform', 'allows_sms') - - # Deleting field 'XForm.sms_id_string' - db.delete_column('odk_logger_xform', 'sms_id_string') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'null': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0024_auto__chg_field_attachment_mimetype.py b/onadata/apps/logger/south_migrations/0024_auto__chg_field_attachment_mimetype.py deleted file mode 100644 index 1fa0a1c71..000000000 --- a/onadata/apps/logger/south_migrations/0024_auto__chg_field_attachment_mimetype.py +++ /dev/null @@ -1,116 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'Attachment.mimetype' - db.alter_column('odk_logger_attachment', 'mimetype', self.gf('django.db.models.fields.CharField')(max_length=50)) - - def backwards(self, orm): - - # Changing field 'Attachment.mimetype' - db.alter_column('odk_logger_attachment', 'mimetype', self.gf('django.db.models.fields.CharField')(max_length=20)) - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0025_auto__add_field_xform_encrypted.py b/onadata/apps/logger/south_migrations/0025_auto__add_field_xform_encrypted.py deleted file mode 100644 index a694470fb..000000000 --- a/onadata/apps/logger/south_migrations/0025_auto__add_field_xform_encrypted.py +++ /dev/null @@ -1,119 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'XForm.encrypted' - db.add_column('odk_logger_xform', 'encrypted', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'XForm.encrypted' - db.delete_column('odk_logger_xform', 'encrypted') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0025_sms_id_string_filling.py b/onadata/apps/logger/south_migrations/0025_sms_id_string_filling.py deleted file mode 100644 index 2e3e312ba..000000000 --- a/onadata/apps/logger/south_migrations/0025_sms_id_string_filling.py +++ /dev/null @@ -1,116 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import DataMigration -from django.db import models - -class Migration(DataMigration): - - def forwards(self, orm): - for xform in orm['odk_logger.XForm'].objects.all(): - xform.sms_id_string = xform.id_string - xform.save() - - def backwards(self, orm): - "Write your backwards methods here." - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'),)", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'null': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] - symmetrical = True diff --git a/onadata/apps/logger/south_migrations/0026_auto__chg_field_xform_sms_id_string__add_unique_xform_sms_id_string_us.py b/onadata/apps/logger/south_migrations/0026_auto__chg_field_xform_sms_id_string__add_unique_xform_sms_id_string_us.py deleted file mode 100644 index 1b7130220..000000000 --- a/onadata/apps/logger/south_migrations/0026_auto__chg_field_xform_sms_id_string__add_unique_xform_sms_id_string_us.py +++ /dev/null @@ -1,124 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'XForm.sms_id_string' - db.alter_column('odk_logger_xform', 'sms_id_string', self.gf('django.db.models.fields.SlugField')(max_length=50)) - # Adding unique constraint on 'XForm', fields ['sms_id_string', 'user'] - db.create_unique('odk_logger_xform', ['sms_id_string', 'user_id']) - - - def backwards(self, orm): - # Removing unique constraint on 'XForm', fields ['sms_id_string', 'user'] - db.delete_unique('odk_logger_xform', ['sms_id_string', 'user_id']) - - - # Changing field 'XForm.sms_id_string' - db.alter_column('odk_logger_xform', 'sms_id_string', self.gf('django.db.models.fields.SlugField')(max_length=50, null=True)) - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '50'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0027_added_instance_is_deleted.py b/onadata/apps/logger/south_migrations/0027_added_instance_is_deleted.py deleted file mode 100644 index 28a796f33..000000000 --- a/onadata/apps/logger/south_migrations/0027_added_instance_is_deleted.py +++ /dev/null @@ -1,125 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Instance.is_deleted' - db.add_column('odk_logger_instance', 'is_deleted', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=True) - # Adding index on 'Instance', fields ['xform'] - db.create_index('odk_logger_instance', ['xform_id', 'is_deleted']) - - - def backwards(self, orm): - # Removing index on 'Instance', fields ['xform'] - db.delete_index('odk_logger_instance', ['xform_id', 'is_deleted']) - # Deleting field 'Instance.is_deleted' - db.delete_column('odk_logger_instance', 'is_deleted') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '50'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0028_update_is_deleted_field.py b/onadata/apps/logger/south_migrations/0028_update_is_deleted_field.py deleted file mode 100644 index 284088585..000000000 --- a/onadata/apps/logger/south_migrations/0028_update_is_deleted_field.py +++ /dev/null @@ -1,118 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - no_dry_run = True - - def forwards(self, orm): - # update values - db.execute("UPDATE odk_logger_instance SET is_deleted=%s WHERE deleted_at IS NOT NULL", [True]) - - def backwards(self, orm): - pass - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '50'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0029_auto__chg_field_attachment_mimetype__add_field_xform_encrypted__add_fi.py b/onadata/apps/logger/south_migrations/0029_auto__chg_field_attachment_mimetype__add_field_xform_encrypted__add_fi.py deleted file mode 100644 index b49261090..000000000 --- a/onadata/apps/logger/south_migrations/0029_auto__chg_field_attachment_mimetype__add_field_xform_encrypted__add_fi.py +++ /dev/null @@ -1,144 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'Attachment.mimetype' - db.alter_column('odk_logger_attachment', 'mimetype', self.gf('django.db.models.fields.CharField')(max_length=50)) - - # Adding field 'XForm.surveys_with_geopoints' - db.add_column('odk_logger_xform', 'surveys_with_geopoints', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - - def backwards(self, orm): - - # Changing field 'Attachment.mimetype' - db.alter_column('odk_logger_attachment', 'mimetype', self.gf('django.db.models.fields.CharField')(max_length=20)) - - # Deleting field 'XForm.surveys_with_geopoints' - db.delete_column('odk_logger_xform', 'surveys_with_geopoints') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '50'}), - 'surveys_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0030_auto__add_field_xform_num_of_submissions.py b/onadata/apps/logger/south_migrations/0030_auto__add_field_xform_num_of_submissions.py deleted file mode 100644 index e0cbe5ab7..000000000 --- a/onadata/apps/logger/south_migrations/0030_auto__add_field_xform_num_of_submissions.py +++ /dev/null @@ -1,137 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'XForm.num_of_submissions' - db.add_column('odk_logger_xform', 'num_of_submissions', - self.gf('django.db.models.fields.IntegerField')(default=-1), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'XForm.num_of_submissions' - db.delete_column('odk_logger_xform', 'num_of_submissions') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '50'}), - 'surveys_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0030_auto__add_ziggyinstance.py b/onadata/apps/logger/south_migrations/0030_auto__add_ziggyinstance.py deleted file mode 100644 index a05418475..000000000 --- a/onadata/apps/logger/south_migrations/0030_auto__add_ziggyinstance.py +++ /dev/null @@ -1,145 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding model 'ZiggyInstance' - db.create_table('odk_logger_ziggyinstance', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('entity_id', self.gf('django.db.models.fields.CharField')(max_length=249)), - ('instance_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=249)), - ('form_instance', self.gf('django.db.models.fields.TextField')()), - ('reporter', self.gf('django.db.models.fields.related.ForeignKey')(related_name='ziggys', to=orm['auth.User'])), - ('client_version', self.gf('django.db.models.fields.BigIntegerField')(default=None, null=True)), - ('server_version', self.gf('django.db.models.fields.BigIntegerField')()), - ('date_created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - ('date_modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), - ('date_deleted', self.gf('django.db.models.fields.DateTimeField')(default=None, null=True)), - )) - db.send_create_signal('odk_logger', ['ZiggyInstance']) - - - def backwards(self, orm): - # Deleting model 'ZiggyInstance' - db.delete_table('odk_logger_ziggyinstance') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '50'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0031_auto__add_field_xform_last_submission_time.py b/onadata/apps/logger/south_migrations/0031_auto__add_field_xform_last_submission_time.py deleted file mode 100644 index 8014ad7b1..000000000 --- a/onadata/apps/logger/south_migrations/0031_auto__add_field_xform_last_submission_time.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'XForm.last_submission_time' - db.add_column('odk_logger_xform', 'last_submission_time', - self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'XForm.last_submission_time' - db.delete_column('odk_logger_xform', 'last_submission_time') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '50'}), - 'surveys_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0031_auto__add_field_ziggyinstance_form_version.py b/onadata/apps/logger/south_migrations/0031_auto__add_field_ziggyinstance_form_version.py deleted file mode 100644 index 74c509759..000000000 --- a/onadata/apps/logger/south_migrations/0031_auto__add_field_ziggyinstance_form_version.py +++ /dev/null @@ -1,136 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'ZiggyInstance.form_version' - db.add_column('odk_logger_ziggyinstance', 'form_version', - self.gf('django.db.models.fields.CharField')(default='1.0', max_length=10), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'ZiggyInstance.form_version' - db.delete_column('odk_logger_ziggyinstance', 'form_version') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '50'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'form_version': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '10'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0032_added_xform_to_ziggy_submissions.py b/onadata/apps/logger/south_migrations/0032_added_xform_to_ziggy_submissions.py deleted file mode 100644 index 825549b8a..000000000 --- a/onadata/apps/logger/south_migrations/0032_added_xform_to_ziggy_submissions.py +++ /dev/null @@ -1,137 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'ZiggyInstance.xform' - db.add_column('odk_logger_ziggyinstance', 'xform', - self.gf('django.db.models.fields.related.ForeignKey')(related_name='ziggy_submissions', null=True, to=orm['odk_logger.XForm']), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'ZiggyInstance.xform' - db.delete_column('odk_logger_ziggyinstance', 'xform_id') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '50'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'form_version': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '10'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggy_submissions'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0032_index_uuid.py b/onadata/apps/logger/south_migrations/0032_index_uuid.py deleted file mode 100644 index 9c458c70c..000000000 --- a/onadata/apps/logger/south_migrations/0032_index_uuid.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - -from south.db import db -from south.v2 import SchemaMigration - -class Migration(SchemaMigration): - """Add an index to the uuid columns in both the odk_logger_xform and - odk_logger_instance tables""" - - def forwards(self, orm): - db.execute("create index odk_logger_xform_uuid_idx on odk_logger_xform (uuid)") - db.execute("create index odk_logger_instance_uuid_idx on odk_logger_instance (uuid)") - - def backwards(self, orm): - raise RuntimeError("Cannot reverse this migration.") diff --git a/onadata/apps/logger/south_migrations/0033_add_model_Note.py b/onadata/apps/logger/south_migrations/0033_add_model_Note.py deleted file mode 100644 index 59cd21903..000000000 --- a/onadata/apps/logger/south_migrations/0033_add_model_Note.py +++ /dev/null @@ -1,166 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding model 'Note' - db.create_table('odk_logger_note', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('note', self.gf('django.db.models.fields.TextField')()), - ('instance', self.gf('django.db.models.fields.related.ForeignKey')(related_name='notes', to=orm['odk_logger.Instance'])), - ('date_created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - ('date_modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), - )) - db.send_create_signal('odk_logger', ['Note']) - - - def backwards(self, orm): - # Deleting model 'Note' - db.delete_table('odk_logger_note') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.note': { - 'Meta': {'object_name': 'Note'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notes'", 'to': "orm['odk_logger.Instance']"}), - 'note': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '50'}), - 'surveys_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'form_version': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '10'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggy_submissions'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0033_auto__chg_field_xform_id_string.py b/onadata/apps/logger/south_migrations/0033_auto__chg_field_xform_id_string.py deleted file mode 100644 index 55689aa18..000000000 --- a/onadata/apps/logger/south_migrations/0033_auto__chg_field_xform_id_string.py +++ /dev/null @@ -1,136 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'XForm.id_string' - db.alter_column('odk_logger_xform', 'id_string', self.gf('django.db.models.fields.SlugField')(max_length=100)) - - def backwards(self, orm): - - # Changing field 'XForm.id_string' - db.alter_column('odk_logger_xform', 'id_string', self.gf('django.db.models.fields.SlugField')(max_length=50)) - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '50'}), - 'surveys_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0034_add_field_Instance_json.py b/onadata/apps/logger/south_migrations/0034_add_field_Instance_json.py deleted file mode 100644 index b6f6cc284..000000000 --- a/onadata/apps/logger/south_migrations/0034_add_field_Instance_json.py +++ /dev/null @@ -1,162 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Instance.json' - db.add_column('odk_logger_instance', 'json', - self.gf('jsonfield.fields.JSONField')(default={}), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Instance.json' - db.delete_column('odk_logger_instance', 'json') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('jsonfield.fields.JSONField', [], {'default': '{}'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.note': { - 'Meta': {'object_name': 'Note'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notes'", 'to': "orm['odk_logger.Instance']"}), - 'note': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '50'}), - 'surveys_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'form_version': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '10'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggy_submissions'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0035_fill_json.py b/onadata/apps/logger/south_migrations/0035_fill_json.py deleted file mode 100644 index 57c6a30ec..000000000 --- a/onadata/apps/logger/south_migrations/0035_fill_json.py +++ /dev/null @@ -1,169 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -from django.core.exceptions import ValidationError -from south.v2 import DataMigration -from onadata.libs.utils.model_tools import queryset_iterator -from onadata.libs.utils.common_tags import MONGO_STRFTIME, SUBMISSION_TIME, XFORM_ID_STRING -from onadata.apps.logger.models import Instance - -class Migration(DataMigration): - - def forwards(self, orm): - """Add parsed JSON to JSON instance column.""" - for instance in queryset_iterator( - orm['odk_logger.Instance'].objects.all()): - obj = Instance.objects.get(pk=instance.pk) - json = obj.get_dict() - json[SUBMISSION_TIME] = instance.date_created.strftime( - MONGO_STRFTIME) - json[XFORM_ID_STRING] = obj._parser.get_xform_id_string() - instance.json = json - instance.save() - - def backwards(self, orm): - """Remove JSON content.""" - for instance in orm.Instance.objects.all(): - instance.json = '' - instance.save() - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('jsonfield.fields.JSONField', [], {'default': '{}'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.note': { - 'Meta': {'object_name': 'Note'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notes'", 'to': "orm['odk_logger.Instance']"}), - 'note': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '50'}), - 'surveys_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'form_version': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '10'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggy_submissions'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] - symmetrical = True diff --git a/onadata/apps/logger/south_migrations/0036_auto__chg_field_xform_sms_id_string.py b/onadata/apps/logger/south_migrations/0036_auto__chg_field_xform_sms_id_string.py deleted file mode 100644 index aa719b35c..000000000 --- a/onadata/apps/logger/south_migrations/0036_auto__chg_field_xform_sms_id_string.py +++ /dev/null @@ -1,160 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'XForm.sms_id_string' - db.alter_column('odk_logger_xform', 'sms_id_string', self.gf('django.db.models.fields.SlugField')(max_length=100)) - - def backwards(self, orm): - - # Changing field 'XForm.sms_id_string' - db.alter_column('odk_logger_xform', 'sms_id_string', self.gf('django.db.models.fields.SlugField')(max_length=50)) - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date': ('django.db.models.fields.DateField', [], {'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('jsonfield.fields.JSONField', [], {'default': '{}'}), - 'start_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.note': { - 'Meta': {'object_name': 'Note'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notes'", 'to': "orm['odk_logger.Instance']"}), - 'note': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100'}), - 'surveys_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'form_version': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '10'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggy_submissions'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0037_auto__del_field_instance_start_time__del_field_instance_date.py b/onadata/apps/logger/south_migrations/0037_auto__del_field_instance_start_time__del_field_instance_date.py deleted file mode 100644 index d3e4817da..000000000 --- a/onadata/apps/logger/south_migrations/0037_auto__del_field_instance_start_time__del_field_instance_date.py +++ /dev/null @@ -1,168 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Deleting field 'Instance.start_time' - db.delete_column('odk_logger_instance', 'start_time') - - # Deleting field 'Instance.date' - db.delete_column('odk_logger_instance', 'date') - - - def backwards(self, orm): - # Adding field 'Instance.start_time' - db.add_column('odk_logger_instance', 'start_time', - self.gf('django.db.models.fields.DateTimeField')(null=True), - keep_default=False) - - # Adding field 'Instance.date' - db.add_column('odk_logger_instance', 'date', - self.gf('django.db.models.fields.DateField')(null=True), - keep_default=False) - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('jsonfield.fields.JSONField', [], {'default': '{}'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.note': { - 'Meta': {'object_name': 'Note'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notes'", 'to': "orm['odk_logger.Instance']"}), - 'note': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100'}), - 'surveys_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'form_version': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '10'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggy_submissions'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0038_auto__del_field_instance_is_deleted.py b/onadata/apps/logger/south_migrations/0038_auto__del_field_instance_is_deleted.py deleted file mode 100644 index 1061fed64..000000000 --- a/onadata/apps/logger/south_migrations/0038_auto__del_field_instance_is_deleted.py +++ /dev/null @@ -1,159 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Deleting field 'Instance.is_deleted' - db.delete_column('odk_logger_instance', 'is_deleted') - - - def backwards(self, orm): - # Adding field 'Instance.is_deleted' - db.add_column('odk_logger_instance', 'is_deleted', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'json': ('jsonfield.fields.JSONField', [], {'default': '{}'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.note': { - 'Meta': {'object_name': 'Note'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notes'", 'to': "orm['odk_logger.Instance']"}), - 'note': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100'}), - 'surveys_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'form_version': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '10'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggy_submissions'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0039_auto__del_field_xform_surveys_with_geopoints__add_field_xform_instance.py b/onadata/apps/logger/south_migrations/0039_auto__del_field_xform_surveys_with_geopoints__add_field_xform_instance.py deleted file mode 100644 index 8c4397687..000000000 --- a/onadata/apps/logger/south_migrations/0039_auto__del_field_xform_surveys_with_geopoints__add_field_xform_instance.py +++ /dev/null @@ -1,168 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Deleting field 'XForm.surveys_with_geopoints' - db.delete_column('odk_logger_xform', 'surveys_with_geopoints') - - # Adding field 'XForm.instances_with_geopoints' - db.add_column('odk_logger_xform', 'instances_with_geopoints', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - - def backwards(self, orm): - # Adding field 'XForm.surveys_with_geopoints' - db.add_column('odk_logger_xform', 'surveys_with_geopoints', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - # Deleting field 'XForm.instances_with_geopoints' - db.delete_column('odk_logger_xform', 'instances_with_geopoints') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('jsonfield.fields.JSONField', [], {'default': '{}'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.note': { - 'Meta': {'object_name': 'Note'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notes'", 'to': "orm['odk_logger.Instance']"}), - 'note': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'instances_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'form_version': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '10'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggy_submissions'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0040_auto__add_field_instance_geom.py b/onadata/apps/logger/south_migrations/0040_auto__add_field_instance_geom.py deleted file mode 100644 index 6290d0111..000000000 --- a/onadata/apps/logger/south_migrations/0040_auto__add_field_instance_geom.py +++ /dev/null @@ -1,161 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Instance.geom' - db.add_column('odk_logger_instance', 'geom', - self.gf('django.contrib.gis.db.models.fields.GeometryCollectionField')(null=True), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Instance.geom' - db.delete_column('odk_logger_instance', 'geom') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'geom': ('django.contrib.gis.db.models.fields.GeometryCollectionField', [], {'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('jsonfield.fields.JSONField', [], {'default': '{}'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.note': { - 'Meta': {'object_name': 'Note'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notes'", 'to': "orm['odk_logger.Instance']"}), - 'note': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100'}), - 'surveys_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'form_version': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '10'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggy_submissions'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0041_convert_lng_lat_to_points.py b/onadata/apps/logger/south_migrations/0041_convert_lng_lat_to_points.py deleted file mode 100644 index 225e60fbe..000000000 --- a/onadata/apps/logger/south_migrations/0041_convert_lng_lat_to_points.py +++ /dev/null @@ -1,158 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -from south.v2 import DataMigration - -from onadata.apps.logger.models.instance import Instance -from onadata.libs.utils.model_tools import queryset_iterator - - -class Migration(DataMigration): - - def forwards(self, orm): - "Parse all instance to add geoms." - for obj in queryset_iterator(orm['odk_logger.Instance'].objects.all()): - instance = Instance.objects.get(pk=obj.pk) - instance.save(force=True) - - def backwards(self, orm): - "Write your backwards methods here." - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'odk_logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['odk_logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'odk_logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'geom': ('django.contrib.gis.db.models.fields.GeometryCollectionField', [], {'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'json': ('jsonfield.fields.JSONField', [], {'default': '{}'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['odk_logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'surveys'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['odk_logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.note': { - 'Meta': {'object_name': 'Note'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notes'", 'to': "orm['odk_logger.Instance']"}), - 'note': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'odk_logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100'}), - 'surveys_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'odk_logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'form_version': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '10'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggy_submissions'", 'null': 'True', 'to': "orm['odk_logger.XForm']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] - symmetrical = True diff --git a/onadata/apps/logger/south_migrations/0042_remove_odk_prefix.py b/onadata/apps/logger/south_migrations/0042_remove_odk_prefix.py deleted file mode 100644 index ed870dabd..000000000 --- a/onadata/apps/logger/south_migrations/0042_remove_odk_prefix.py +++ /dev/null @@ -1,168 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -from south.db import db -from south.v2 import SchemaMigration - -from onadata.libs.data.db import rename_table_pending_creates - - -class Migration(SchemaMigration): - - def forwards(self, orm): - db.rename_table('odk_logger_attachment', 'logger_attachment') - db.rename_table('odk_logger_instance', 'logger_instance') - db.rename_table('odk_logger_instancehistory', 'logger_instancehistory') - db.rename_table('odk_logger_note', 'logger_note') - db.rename_table('odk_logger_surveytype', 'logger_surveytype') - db.rename_table('odk_logger_xform', 'logger_xform') - db.rename_table('odk_logger_ziggyinstance', 'logger_ziggyinstance') - - rename_table_pending_creates('odk_logger', 'logger') - - def backwards(self, orm): - db.rename_table('logger_attachment', 'odk_logger_attachment') - db.rename_table('logger_instance', 'odk_logger_instance') - db.rename_table('logger_instancehistory', 'odk_logger_instancehistory') - db.rename_table('logger_note', 'odk_logger_note') - db.rename_table('logger_surveytype', 'odk_logger_surveytype') - db.rename_table('logger_xform', 'odk_logger_xform') - db.rename_table('logger_ziggyinstance', 'odk_logger_ziggyinstance') - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'geom': ('django.contrib.gis.db.models.fields.GeometryCollectionField', [], {'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'json': ('jsonfield.fields.JSONField', [], {'default': '{}'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'null': 'True', 'to': "orm['logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.note': { - 'Meta': {'object_name': 'Note'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notes'", 'to': "orm['logger.Instance']"}), - 'note': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'instances_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'form_version': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '10'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggy_submissions'", 'null': 'True', 'to': "orm['logger.XForm']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0043_xform_title_255.py b/onadata/apps/logger/south_migrations/0043_xform_title_255.py deleted file mode 100644 index 217e33797..000000000 --- a/onadata/apps/logger/south_migrations/0043_xform_title_255.py +++ /dev/null @@ -1,158 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'XForm.title' - db.alter_column('logger_xform', 'title', self.gf('django.db.models.fields.CharField')(max_length=255)) - - def backwards(self, orm): - - # Changing field 'XForm.title' - db.alter_column('logger_xform', 'title', self.gf('django.db.models.fields.CharField')(max_length=64)) - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'geom': ('django.contrib.gis.db.models.fields.GeometryCollectionField', [], {'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'json': ('jsonfield.fields.JSONField', [], {'default': '{}'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'null': 'True', 'to': "orm['logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.note': { - 'Meta': {'object_name': 'Note'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notes'", 'to': "orm['logger.Instance']"}), - 'note': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'instances_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_crowd_form': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'form_version': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '10'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggy_submissions'", 'null': 'True', 'to': "orm['logger.XForm']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0044_auto__del_field_xform_is_crowd_form.py b/onadata/apps/logger/south_migrations/0044_auto__del_field_xform_is_crowd_form.py deleted file mode 100644 index 6e9b902b3..000000000 --- a/onadata/apps/logger/south_migrations/0044_auto__del_field_xform_is_crowd_form.py +++ /dev/null @@ -1,146 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -from south.utils import datetime_utils as datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Deleting field 'XForm.is_crowd_form' - db.delete_column('logger_xform', 'is_crowd_form') - - - def backwards(self, orm): - # Adding field 'XForm.is_crowd_form' - db.add_column('logger_xform', 'is_crowd_form', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'user_set'", 'blank': 'True', 'to': "orm['auth.Group']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'user_set'", 'blank': 'True', 'to': "orm['auth.Permission']"}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'geom': ('django.contrib.gis.db.models.fields.GeometryCollectionField', [], {'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'json': ('jsonfield.fields.JSONField', [], {'default': '{}'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'null': 'True', 'to': "orm['logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.note': { - 'Meta': {'object_name': 'Note'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notes'", 'to': "orm['logger.Instance']"}), - 'note': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'instances_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'form_version': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '10'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggy_submissions'", 'null': 'True', 'to': "orm['logger.XForm']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/0045_auto__add_field_xform_require_auth.py b/onadata/apps/logger/south_migrations/0045_auto__add_field_xform_require_auth.py deleted file mode 100644 index f1088fd1f..000000000 --- a/onadata/apps/logger/south_migrations/0045_auto__add_field_xform_require_auth.py +++ /dev/null @@ -1,160 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'XForm.require_auth' - db.add_column('logger_xform', 'require_auth', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'XForm.require_auth' - db.delete_column('logger_xform', 'require_auth') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'logger.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['logger.Instance']"}), - 'media_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}) - }, - 'logger.instance': { - 'Meta': {'object_name': 'Instance'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'deleted_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'geom': ('django.contrib.gis.db.models.fields.GeometryCollectionField', [], {'null': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'json': ('jsonfield.fields.JSONField', [], {'default': '{}'}), - 'status': ('django.db.models.fields.CharField', [], {'default': "'submitted_via_web'", 'max_length': '20'}), - 'survey_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['logger.SurveyType']"}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'null': 'True', 'to': "orm['logger.XForm']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.instancehistory': { - 'Meta': {'object_name': 'InstanceHistory'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '249'}), - 'xform_instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submission_history'", 'to': "orm['logger.Instance']"}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.note': { - 'Meta': {'object_name': 'Note'}, - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notes'", 'to': "orm['logger.Instance']"}), - 'note': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.surveytype': { - 'Meta': {'object_name': 'SurveyType'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'logger.xform': { - 'Meta': {'ordering': "('id_string',)", 'unique_together': "(('user', 'id_string'), ('user', 'sms_id_string'))", 'object_name': 'XForm'}, - 'allows_sms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'bamboo_dataset': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '60'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True'}), - 'downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'encrypted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'has_start_time': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'id_string': ('django.db.models.fields.SlugField', [], {'max_length': '100'}), - 'instances_with_geopoints': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'json': ('django.db.models.fields.TextField', [], {'default': "''"}), - 'last_submission_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'num_of_submissions': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), - 'require_auth': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'shared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'shared_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'sms_id_string': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'xforms'", 'null': 'True', 'to': "orm['auth.User']"}), - 'uuid': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '32'}), - 'xls': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), - 'xml': ('django.db.models.fields.TextField', [], {}) - }, - 'logger.ziggyinstance': { - 'Meta': {'object_name': 'ZiggyInstance'}, - 'client_version': ('django.db.models.fields.BigIntegerField', [], {'default': 'None', 'null': 'True'}), - 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), - 'date_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'entity_id': ('django.db.models.fields.CharField', [], {'max_length': '249'}), - 'form_instance': ('django.db.models.fields.TextField', [], {}), - 'form_version': ('django.db.models.fields.CharField', [], {'default': "'1.0'", 'max_length': '10'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'instance_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '249'}), - 'reporter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggys'", 'to': "orm['auth.User']"}), - 'server_version': ('django.db.models.fields.BigIntegerField', [], {}), - 'xform': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ziggy_submissions'", 'null': 'True', 'to': "orm['logger.XForm']"}) - }, - 'taggit.tag': { - 'Meta': {'object_name': 'Tag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) - }, - 'taggit.taggeditem': { - 'Meta': {'object_name': 'TaggedItem'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"}) - } - } - - complete_apps = ['logger'] diff --git a/onadata/apps/logger/south_migrations/__init__.py b/onadata/apps/logger/south_migrations/__init__.py deleted file mode 100644 index 134880430..000000000 --- a/onadata/apps/logger/south_migrations/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import diff --git a/onadata/apps/logger/tasks.py b/onadata/apps/logger/tasks.py index 5248caddc..b3a4c63e4 100644 --- a/onadata/apps/logger/tasks.py +++ b/onadata/apps/logger/tasks.py @@ -1,20 +1,27 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import csv import datetime import zipfile from collections import defaultdict from io import BytesIO -from celery import shared_task +from celery import task, shared_task from dateutil import relativedelta from django.contrib.auth.models import User from django.core.files.storage import get_storage_class from django.core.management import call_command +from .models.submission_counter import SubmissionCounter from .models import Instance, XForm + +@task() +def create_monthly_counters(): + user_ids = User.objects.values_list('pk', flat=True) + for user_id in user_ids: + SubmissionCounter.objects.create(user_id=user_id) + + # ## ISSUE 242 TEMPORARY FIX ## # See https://github.com/kobotoolbox/kobocat/issues/242 @@ -82,7 +89,7 @@ def list_created_by_month(model, date_field): default_storage = get_storage_class()() with default_storage.open(output_filename, 'wb') as output_file: zip_file = zipfile.ZipFile(output_file, 'w', zipfile.ZIP_DEFLATED) - for filename, report_settings in REPORTS.iteritems(): + for filename, report_settings in REPORTS.items(): model_name_plural = report_settings[ 'model']._meta.verbose_name_plural fieldnames = [ diff --git a/onadata/apps/logger/templates/downloadSubmission.xml b/onadata/apps/logger/templates/downloadSubmission.xml index e3d484898..1b7173607 100644 --- a/onadata/apps/logger/templates/downloadSubmission.xml +++ b/onadata/apps/logger/templates/downloadSubmission.xml @@ -6,6 +6,6 @@ {% for media in media_files %} {{ media.filename|safe }} md5:{{ media.file_hash }} - {{ host }}{% url "onadata.apps.viewer.views.attachment_url" 'original' %}?media_file={{ media.media_file.name|urlencode }} + {{ host }}{% url "attachment_url" 'original' %}?media_file={{ media.media_file.name|urlencode }} {% endfor %} diff --git a/onadata/apps/logger/templates/formList.xml b/onadata/apps/logger/templates/formList.xml index bd68543c9..cb38543e5 100644 --- a/onadata/apps/logger/templates/formList.xml +++ b/onadata/apps/logger/templates/formList.xml @@ -3,7 +3,7 @@
{{ i.text }} {% if i.media %} {% for mdi in i.media.m %} - {{ mdi.data_value }} + {{ mdi.data_value }} {% endfor %} {% endif %} diff --git a/onadata/apps/logger/templates/list_xforms.html b/onadata/apps/logger/templates/list_xforms.html deleted file mode 100644 index 237c45350..000000000 --- a/onadata/apps/logger/templates/list_xforms.html +++ /dev/null @@ -1,42 +0,0 @@ -{% load i18n %} - - - - - - - - - - - - - {% for xform in xforms %} - - - - - - - - {% endfor %} - -
{% trans "Downloadable by Phone" %}{% trans "Form ID" %}{% trans "Number of Submissions" %}{% trans "Time of Last Submission" %}{% trans "CSV" %}
- - {% if xform.downloadable %} - [ {% trans 'yes' %} ] - {% else %} - [ {% trans 'no' %} ] - {% endif %} - - {{ xform.id_string }}{{ xform.submission_count }} - {% if xform.time_of_last_submission %} - {{ xform.time_of_last_submission }} - {% endif %} - {% trans "Download CSV" %}
- - diff --git a/onadata/apps/logger/templates/submission.html b/onadata/apps/logger/templates/submission.html deleted file mode 100644 index e95388b3c..000000000 --- a/onadata/apps/logger/templates/submission.html +++ /dev/null @@ -1,14 +0,0 @@ -{% load i18n %} - -

{% trans "Your submission was successful!" %}

- - - diff --git a/onadata/apps/logger/templates/xformsManifest.xml b/onadata/apps/logger/templates/xformsManifest.xml index 8c2335e9c..4840d6485 100644 --- a/onadata/apps/logger/templates/xformsManifest.xml +++ b/onadata/apps/logger/templates/xformsManifest.xml @@ -4,7 +4,7 @@ {{ media.data_value }} md5:{{ media.hash }} - {{ host }}{% url "onadata.apps.main.views.download_media_data" media.xform.user.username media.xform.id_string media.id %} + {{ host }}{% url "download_media_data" media.xform.user.username media.xform.id_string media.id %} {% endfor %} diff --git a/onadata/apps/logger/tests/__init__.py b/onadata/apps/logger/tests/__init__.py index 134880430..57d631c3f 100644 --- a/onadata/apps/logger/tests/__init__.py +++ b/onadata/apps/logger/tests/__init__.py @@ -1,2 +1 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import diff --git a/onadata/apps/logger/tests/fixtures/ziggy/cc_monthly_report.json b/onadata/apps/logger/tests/fixtures/ziggy/cc_monthly_report.json deleted file mode 100644 index 80db3ed01..000000000 --- a/onadata/apps/logger/tests/fixtures/ziggy/cc_monthly_report.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "clientVersion": "1377259673135", - "entityId": "9e7ee7c3-3071-4cb5-881f-f71572101f35", - "formDataDefinitionVersion": "1", - "formInstance": "{\"form_data_definition_version\":\"1\",\"form\":{\"bind_type\":\"village\",\"default_bind_path\":\"/model/instance/cc_monthly_report_form/\",\"fields\":[{\"name\":\"id\",\"shouldLoadValue\":true,\"source\":\"village.id\",\"value\":\"9e7ee7c3-3071-4cb5-881f-f71572101f35\"},{\"name\":\"name\",\"bind\":\"/model/instance/cc_monthly_report_form/village_name\",\"shouldLoadValue\":true,\"source\":\"village.name\",\"value\":\"dygvbh\"},{\"name\":\"code\",\"bind\":\"/model/instance/cc_monthly_report_form/village_code\",\"shouldLoadValue\":true,\"source\":\"village.code\",\"value\":\"fjhgh\"},{\"name\":\"reportingMonth\",\"bind\":\"/model/instance/cc_monthly_report_form/reporting_month\",\"source\":\"village.reportingMonth\",\"value\":\"10-2013\"},{\"name\":\"gps\",\"bind\":\"/model/instance/cc_monthly_report_form/gps\",\"shouldLoadValue\":true,\"source\":\"village.gps\"},{\"name\":\"numberOfHouseholds\",\"bind\":\"/model/instance/cc_monthly_report_form/households\",\"source\":\"village.numberOfHouseholds\",\"value\":\"12\"},{\"name\":\"population\",\"bind\":\"/model/instance/cc_monthly_report_form/village_population\",\"source\":\"village.population\",\"value\":\"2\"},{\"name\":\"numberOfImprovedLatrines\",\"bind\":\"/model/instance/cc_monthly_report_form/improved_latrines\",\"source\":\"village.numberOfImprovedLatrines\",\"value\":\"5\"},{\"name\":\"numberOfLatrinesWithSmoothCleanableFloor\",\"bind\":\"/model/instance/cc_monthly_report_form/latrines_smooth_cleanable_floor\",\"source\":\"village.numberOfLatrinesWithSmoothCleanableFloor\",\"value\":\"45\"},{\"name\":\"numberOfLatrinesWithLid\",\"bind\":\"/model/instance/cc_monthly_report_form/latrines_with_lid\",\"source\":\"village.numberOfLatrinesWithLid\",\"value\":\"12\"},{\"name\":\"numberOfLatrinesWithSuperstructure\",\"bind\":\"/model/instance/cc_monthly_report_form/latrines_with_superstructure\",\"source\":\"village.numberOfLatrinesWithSuperstructure\",\"value\":\"8\"},{\"name\":\"numberOfLatrinesWithSignsOfUse\",\"bind\":\"/model/instance/cc_monthly_report_form/latrines_signs_of_use\",\"source\":\"village.numberOfLatrinesWithSignsOfUse\",\"value\":\"5\"},{\"name\":\"numberOfLatrinesWithHandWashers\",\"bind\":\"/model/instance/cc_monthly_report_form/latrines_hand_washers\",\"source\":\"village.numberOfLatrinesWithHandWashers\",\"value\":\"12\"},{\"name\":\"numberOfLatrinesWithAllImprovedReqs\",\"bind\":\"/model/instance/cc_monthly_report_form/latrines_all_improved_reqs\",\"source\":\"village.numberOfLatrinesWithAllImprovedReqs\"},{\"name\":\"numberOfHouseholdsQualityChecked\",\"bind\":\"/model/instance/cc_monthly_report_form/households_quality_checked\",\"source\":\"village.numberOfHouseholdsQualityChecked\",\"value\":\"4\"},{\"name\":\"numberOfHouseholdsCheckedAccurately\",\"bind\":\"/model/instance/cc_monthly_report_form/checks_accurate\",\"source\":\"village.numberOfHouseholdsCheckedAccurately\",\"value\":\"9\"},{\"name\":\"submissionDate\",\"bind\":\"/model/instance/cc_monthly_report_form/today\",\"source\":\"village.submissionDate\",\"value\":\"2013-08-23\"}]}}", - "formName": "cc_monthly_report_form", - "instanceId": "c4e1201d-2ba0-45bc-beb6-884e9ebf950f", - "reporterId": "bob" - } -] diff --git a/onadata/apps/logger/tests/fixtures/ziggy/cc_monthly_report_form.xls b/onadata/apps/logger/tests/fixtures/ziggy/cc_monthly_report_form.xls deleted file mode 100644 index 6ffe4f7a5..000000000 Binary files a/onadata/apps/logger/tests/fixtures/ziggy/cc_monthly_report_form.xls and /dev/null differ diff --git a/onadata/apps/logger/tests/fixtures/ziggy/village_profile.json b/onadata/apps/logger/tests/fixtures/ziggy/village_profile.json deleted file mode 100644 index 01401aee7..000000000 --- a/onadata/apps/logger/tests/fixtures/ziggy/village_profile.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "clientVersion": "1377254243624", - "entityId": "9e7ee7c3-3071-4cb5-881f-f71572101f35", - "formDataDefinitionVersion": "1", - "formInstance": "{\"form_data_definition_version\":\"1\",\"form\":{\"bind_type\":\"village\",\"default_bind_path\":\"/model/instance/village_profile/\",\"fields\":[{\"name\":\"id\",\"source\":\"village.id\",\"value\":\"9e7ee7c3-3071-4cb5-881f-f71572101f35\"},{\"name\":\"name\",\"bind\":\"/model/instance/village_profile/village\",\"source\":\"village.name\",\"value\":\"dygvbh\"},{\"name\":\"code\",\"bind\":\"/model/instance/village_profile/village_code\",\"source\":\"village.code\",\"value\":\"fjhgh\"},{\"name\":\"gps\",\"bind\":\"/model/instance/village_profile/gps\",\"source\":\"village.gps\"},{\"name\":\"sagContactNumber\",\"bind\":\"/model/instance/village_profile/sag_contact_phone\",\"source\":\"village.sagContactNumber\",\"value\":\"020-123456\"},{\"name\":\"headmanName\",\"bind\":\"/model/instance/village_profile/headman_name\",\"source\":\"village.headmanName\",\"value\":\"fgvh\"},{\"name\":\"headmanContactNumber\",\"bind\":\"/model/instance/village_profile/headman_contact\",\"source\":\"village.headmanContactNumber\",\"value\":\"yhdfghb\"},{\"name\":\"submissionDate\",\"bind\":\"/model/instance/village_profile/today\",\"source\":\"village.submissionDate\",\"value\":\"2013-08-23\"}]}}", - "formName": "village_profile", - "instanceId": "88205524-73ae-4b2c-8105-dd7b6e1186a0", - "reporterId": "bob" - } -] diff --git a/onadata/apps/logger/tests/fixtures/ziggy/village_profile.xls b/onadata/apps/logger/tests/fixtures/ziggy/village_profile.xls deleted file mode 100644 index 9dfcb681d..000000000 Binary files a/onadata/apps/logger/tests/fixtures/ziggy/village_profile.xls and /dev/null differ diff --git a/onadata/apps/logger/tests/models/__init__.py b/onadata/apps/logger/tests/models/__init__.py index 134880430..57d631c3f 100644 --- a/onadata/apps/logger/tests/models/__init__.py +++ b/onadata/apps/logger/tests/models/__init__.py @@ -1,2 +1 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import diff --git a/onadata/apps/logger/tests/models/test_attachment.py b/onadata/apps/logger/tests/models/test_attachment.py index 814fa297d..056d9eb4b 100644 --- a/onadata/apps/logger/tests/models/test_attachment.py +++ b/onadata/apps/logger/tests/models/test_attachment.py @@ -1,5 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import import os from datetime import datetime @@ -16,7 +15,7 @@ class TestAttachment(TestBase): def setUp(self): - super(self.__class__, self).setUp() + super().setUp() self._publish_transportation_form_and_submit_instance() self.media_file = "1335783522563.jpg" media_file = os.path.join( @@ -25,7 +24,7 @@ def setUp(self): self.instance = Instance.objects.all()[0] self.attachment = Attachment.objects.create( instance=self.instance, - media_file=File(open(media_file), media_file)) + media_file=File(open(media_file, 'rb'), media_file)) def test_mimetype(self): self.assertEqual(self.attachment.mimetype, 'image/jpeg') @@ -38,7 +37,7 @@ def test_thumbnails(self): self.assertNotEqual( url.find(thumbnail), -1) for size in ['small', 'medium', 'large']: - thumbnail = '%s-%s.jpg' % (filename, size) + thumbnail = f'{filename}-{size}.jpg' self.assertTrue( default_storage.exists(thumbnail)) default_storage.delete(thumbnail) @@ -52,15 +51,15 @@ def test_create_thumbnails_command(self): thumbnail = '%s-%s.jpg' % (filename, size) self.assertTrue( default_storage.exists(thumbnail)) - created_times[size] = default_storage.modified_time(thumbnail) + created_times[size] = default_storage.get_modified_time(thumbnail) # replace or regenerate thumbnails if they exist call_command("create_image_thumbnails", force=True) for attachment in Attachment.objects.filter(instance=self.instance): filename = attachment.media_file.name.replace('.jpg', '') for size in settings.THUMB_CONF.keys(): - thumbnail = '%s-%s.jpg' % (filename, size) + thumbnail = f'{filename}-{size}.jpg' self.assertTrue( default_storage.exists(thumbnail)) self.assertTrue( - default_storage.modified_time(thumbnail) > created_times[size]) + default_storage.get_modified_time(thumbnail) > created_times[size]) default_storage.delete(thumbnail) diff --git a/onadata/apps/logger/tests/models/test_instance.py b/onadata/apps/logger/tests/models/test_instance.py index d79549b85..92c66c734 100644 --- a/onadata/apps/logger/tests/models/test_instance.py +++ b/onadata/apps/logger/tests/models/test_instance.py @@ -1,5 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import import os import reversion @@ -19,7 +18,7 @@ class TestInstance(TestBase): def setUp(self): - super(self.__class__, self).setUp() + super().setUp() def test_stores_json(self): self._publish_transportation_form_and_submit_instance() diff --git a/onadata/apps/logger/tests/models/test_submission_counter.py b/onadata/apps/logger/tests/models/test_submission_counter.py new file mode 100644 index 000000000..4b6cfe5be --- /dev/null +++ b/onadata/apps/logger/tests/models/test_submission_counter.py @@ -0,0 +1,46 @@ +# coding: utf-8 +from datetime import datetime + +from mock import patch + +from onadata.apps.logger.models.submission_counter import SubmissionCounter +from onadata.apps.logger.tasks import create_monthly_counters +from onadata.apps.main.tests.test_base import TestBase + + +class TestSubmissionCounter(TestBase): + + def setup(self): + super.setup() + + @patch('onadata.apps.logger.tasks.create_monthly_counters') + def test_user_created(self, monthly_counter): + """ + Tests that when a new user is created the celery task runs + """ + self._create_user('amy', 'amy') + self._create_user('johnny', 'johnny') + + create_monthly_counters() + counters = SubmissionCounter.objects.only('user__username') + self.assertEqual(counters.count(), 4) + + def test_counter_increment(self): + """ + Tests that when a submission is revieved, the counter increments + """ + create_monthly_counters() + self._publish_transportation_form_and_submit_instance() + counters = SubmissionCounter.objects.get(user__username='bob') + self.assertEqual(counters.count, 1) + + def test_data_retrieval(self): + """ + Test that the data stored is the same as the data expected + """ + create_monthly_counters() + counter = SubmissionCounter.objects.last() + today = datetime.now() + self.assertEqual(counter.timestamp.year, today.year) + self.assertEqual(counter.timestamp.month, today.month) + self.assertEqual(counter.timestamp.day, 1) diff --git a/onadata/apps/logger/tests/models/test_xform.py b/onadata/apps/logger/tests/models/test_xform.py index d838fcb54..5094d2664 100644 --- a/onadata/apps/logger/tests/models/test_xform.py +++ b/onadata/apps/logger/tests/models/test_xform.py @@ -1,5 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import import os import reversion import unittest @@ -32,17 +31,13 @@ def test_set_title_in_xml_unicode_error(self): ) self._publish_xls_file_and_set_xform(xls_file_path) - self.assertTrue(isinstance(self.xform.xml, unicode)) + self.assertTrue(isinstance(self.xform.xml, str)) # change title self.xform.title = 'Random Title' self.assertNotIn(self.xform.title, self.xform.xml) - # convert xml to str - self.xform.xml = self.xform.xml.encode('utf-8') - self.assertTrue(isinstance(self.xform.xml, str)) - # set title in xform xml self.xform._set_title() self.assertIn(self.xform.title, self.xform.xml) diff --git a/onadata/apps/logger/tests/test_backup_tools.py b/onadata/apps/logger/tests/test_backup_tools.py index 006087623..b1da96fcc 100644 --- a/onadata/apps/logger/tests/test_backup_tools.py +++ b/onadata/apps/logger/tests/test_backup_tools.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from datetime import datetime import os import tempfile @@ -21,7 +19,7 @@ class TestBackupTools(TestBase): def setUp(self): - super(TestBackupTools, self).setUp() + super().setUp() self._publish_xls_file_and_set_xform( os.path.join( settings.ONADATA_DIR, diff --git a/onadata/apps/logger/tests/test_briefcase_api.py b/onadata/apps/logger/tests/test_briefcase_api.py index fd41c0b03..e2e9ef410 100644 --- a/onadata/apps/logger/tests/test_briefcase_api.py +++ b/onadata/apps/logger/tests/test_briefcase_api.py @@ -1,10 +1,7 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os -import codecs -from django.core.urlresolvers import reverse +from django.urls import reverse from django.core.files.storage import get_storage_class from django_digest.test import DigestAuth from rest_framework.test import APIRequestFactory @@ -66,12 +63,12 @@ def test_view_submission_list(self): self.assertEqual(instances.count(), NUM_INSTANCES) last_index = instances[instances.count() - 1].pk - with codecs.open(submission_list_path, 'rb', encoding='utf-8') as f: - expected_submission_list = f.read() + with open(submission_list_path, 'rb') as f: + expected_submission_list = f.read().decode() expected_submission_list = \ expected_submission_list.replace( - '{{resumptionCursor}}', '%s' % last_index) - self.assertEqual(response.content, expected_submission_list) + '{{resumptionCursor}}', str(last_index)) + self.assertEqual(response.content.decode(), expected_submission_list) def test_view_submission_list_w_deleted_submission(self): self._publish_xml_form() @@ -94,12 +91,12 @@ def test_view_submission_list_w_deleted_submission(self): self.assertEqual(instances.count(), NUM_INSTANCES - 1) last_index = instances[instances.count() - 1].pk - with codecs.open(submission_list_path, 'rb', encoding='utf-8') as f: + with open(submission_list_path, 'r') as f: expected_submission_list = f.read() expected_submission_list = \ expected_submission_list.replace( '{{resumptionCursor}}', '%s' % last_index) - self.assertEqual(response.content, expected_submission_list) + self.assertEqual(response.content.decode(), expected_submission_list) formId = '%(formId)s[@version=null and @uiVersion=null]/' \ '%(formId)s[@key=uuid:%(instanceId)s]' % { @@ -161,19 +158,19 @@ def get_last_index(xform, last_index=None): if index == 4: self.assertEqual( - response.content, last_expected_submission_list) + response.content.decode(), last_expected_submission_list) continue # set cursor for second request params['cursor'] = last_index submission_list_path = os.path.join( self.this_directory, 'fixtures', 'transportation', 'view', filename) - with codecs.open(submission_list_path, encoding='utf-8') as f: + with open(submission_list_path, mode='r') as f: expected_submission_list = f.read() last_expected_submission_list = expected_submission_list = \ expected_submission_list.replace( '{{resumptionCursor}}', '%s' % last_index) - self.assertEqual(response.content, expected_submission_list) + self.assertEqual(response.content.decode(), expected_submission_list) last_index += 2 def test_view_download_submission(self): @@ -197,14 +194,14 @@ def test_view_download_submission(self): download_submission_path = os.path.join( self.this_directory, 'fixtures', 'transportation', 'view', 'downloadSubmission.xml') - with codecs.open(download_submission_path, encoding='utf-8') as f: - text = f.read() + with open(download_submission_path, mode='rb') as f: + text = f.read().decode() text = text.replace('{{submissionDate}}', instance.date_created.isoformat()) text = text.replace('{{xform_uuid}}', self.xform.uuid) self.assertContains(response, instanceId, status_code=200) - self.assertMultiLineEqual(response.content, text) + self.assertMultiLineEqual(response.content.decode(), text) def test_view_download_submission_other_user(self): self._publish_xml_form() @@ -231,7 +228,7 @@ def test_publish_xml_form_other_user(self): self._create_user('deno', 'deno') count = XForm.objects.count() - with codecs.open(self.form_def_path, encoding='utf-8') as f: + with open(self.form_def_path, mode='rb') as f: params = {'form_def_file': f, 'dataFile': ''} request = self.factory.post(self._form_upload_url, params) response = form_upload(request, username=self.user.username) @@ -247,7 +244,7 @@ def test_publish_xml_form_where_filename_is_not_id_string(self): self.this_directory, 'fixtures', 'transportation', 'Transportation Form.xml') count = XForm.objects.count() - with codecs.open(form_def_path, encoding='utf-8') as f: + with open(form_def_path, mode='rb') as f: params = {'form_def_file': f, 'dataFile': ''} request = self.factory.post(self._form_upload_url, params) response = form_upload(request, username=self.user.username) @@ -261,7 +258,7 @@ def test_publish_xml_form_where_filename_is_not_id_string(self): def _publish_xml_form(self): count = XForm.objects.count() - with codecs.open(self.form_def_path, encoding='utf-8') as f: + with open(self.form_def_path, mode='rb') as f: params = {'form_def_file': f, 'dataFile': ''} request = self.factory.post(self._form_upload_url, params) response = form_upload(request, username=self.user.username) @@ -276,7 +273,7 @@ def _publish_xml_form(self): def test_form_upload(self): self._publish_xml_form() - with codecs.open(self.form_def_path, encoding='utf-8') as f: + with open(self.form_def_path, mode='rb') as f: params = {'form_def_file': f, 'dataFile': ''} request = self.factory.post(self._form_upload_url, params) response = form_upload(request, username=self.user.username) @@ -284,10 +281,14 @@ def test_form_upload(self): auth = DigestAuth(self.login_username, self.login_password) request.META.update(auth(request.META, response)) response = form_upload(request, username=self.user.username) - self.assertContains( - response, - 'Form with this id or SMS-keyword already exists', - status_code=400) + self.assertTrue(response.status_code, 400) + # SQLite returns `UNIQUE constraint failed` whereas PostgreSQL + # returns 'duplicate key ... violates unique constraint' + response_content = response.content.decode() + self.assertIn( + 'unique constraint', + response_content.lower(), + ) def test_submission_with_instance_id_on_root_node(self): self._publish_xml_form() @@ -299,7 +300,7 @@ def test_submission_with_instance_id_on_root_node(self): self.this_directory, 'fixtures', 'transportation', 'view', 'submission.xml') count = Instance.objects.count() - with codecs.open(submission_path, encoding='utf-8') as f: + with open(submission_path, mode='rb') as f: post_data = {'xml_submission_file': f} self.factory = APIRequestFactory() request = self.factory.post(self._submission_url, post_data) diff --git a/onadata/apps/logger/tests/test_briefcase_client.py b/onadata/apps/logger/tests/test_briefcase_client.py index 84a66c91a..0e059822d 100644 --- a/onadata/apps/logger/tests/test_briefcase_client.py +++ b/onadata/apps/logger/tests/test_briefcase_client.py @@ -1,15 +1,13 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os.path -from cStringIO import StringIO -from urlparse import urljoin +from io import StringIO, BytesIO +from urllib.parse import urljoin import requests from django.contrib.auth import authenticate from django.core.files.storage import get_storage_class from django.core.files.uploadedfile import UploadedFile -from django.core.urlresolvers import reverse +from django.urls import reverse from django.test import RequestFactory from django_digest.test import Client as DigestClient from httmock import urlmatch, HTTMock @@ -54,7 +52,7 @@ def form_list_xml(url, request, **kwargs): def get_streaming_content(res): - tmp = StringIO() + tmp = BytesIO() for chunk in res.streaming_content: tmp.write(chunk) content = tmp.getvalue() @@ -86,7 +84,7 @@ def setUp(self): self._submit_transport_instance_w_attachment() src = os.path.join(self.this_directory, "fixtures", "transportation", "screenshot.png") - uf = UploadedFile(file=open(src), content_type='image/png') + uf = UploadedFile(file=open(src, 'rb'), content_type='image/png') count = MetaData.objects.count() MetaData.media_upload(self.xform, uf) self.assertEqual(MetaData.objects.count(), count + 1) diff --git a/onadata/apps/logger/tests/test_command_syncd_deleted_instances_fix.py b/onadata/apps/logger/tests/test_command_syncd_deleted_instances_fix.py index 2dd13e504..8dddcc4a6 100644 --- a/onadata/apps/logger/tests/test_command_syncd_deleted_instances_fix.py +++ b/onadata/apps/logger/tests/test_command_syncd_deleted_instances_fix.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from datetime import datetime from django.utils import timezone from django.core.management import call_command diff --git a/onadata/apps/logger/tests/test_digest_authentication.py b/onadata/apps/logger/tests/test_digest_authentication.py index 289268d57..7701a3aef 100644 --- a/onadata/apps/logger/tests/test_digest_authentication.py +++ b/onadata/apps/logger/tests/test_digest_authentication.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os from django_digest.test import DigestAuth diff --git a/onadata/apps/logger/tests/test_encrypted_submissions.py b/onadata/apps/logger/tests/test_encrypted_submissions.py index 508cfed81..897de7c28 100644 --- a/onadata/apps/logger/tests/test_encrypted_submissions.py +++ b/onadata/apps/logger/tests/test_encrypted_submissions.py @@ -1,10 +1,7 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os -import codecs -from django.core.urlresolvers import reverse +from django.urls import reverse from django.contrib.auth import authenticate from rest_framework.test import APIRequestFactory @@ -42,8 +39,8 @@ def test_encrypted_submissions(self): 'instances_encrypted', filename) count = Instance.objects.count() acount = Attachment.objects.count() - with open(files['submission.xml.enc']) as ef: - with codecs.open(files['submission.xml']) as f: + with open(files['submission.xml.enc'], 'rb') as ef: + with open(files['submission.xml'], 'rb') as f: post_data = { 'xml_submission_file': f, 'submission.xml.enc': ef} diff --git a/onadata/apps/logger/tests/test_form_list.py b/onadata/apps/logger/tests/test_form_list.py index 02f55e2c6..93409ffe1 100644 --- a/onadata/apps/logger/tests/test_form_list.py +++ b/onadata/apps/logger/tests/test_form_list.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.contrib.auth.models import AnonymousUser from django.test import RequestFactory from django_digest.test import DigestAuth @@ -11,7 +9,7 @@ class TestFormList(TestBase): def setUp(self): - super(TestFormList, self).setUp() + super().setUp() self.factory = RequestFactory() def test_returns_200_for_owner(self): @@ -44,4 +42,4 @@ def test_show_for_anon_when_require_auth_false(self): request = self.factory.get('/') request.user = AnonymousUser() response = formList(request, self.user.username) - self.assertEquals(response.status_code, 200) + self.assertEqual(response.status_code, 200) diff --git a/onadata/apps/logger/tests/test_form_submission.py b/onadata/apps/logger/tests/test_form_submission.py index c0a48c816..4a787de17 100644 --- a/onadata/apps/logger/tests/test_form_submission.py +++ b/onadata/apps/logger/tests/test_form_submission.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os import re @@ -51,7 +49,7 @@ def test_fail_with_ioerror_read(self, mock_pop): mock_pop.side_effect = IOError( 'request data read error') - self.assertEquals(0, self.xform.instances.count()) + self.assertEqual(0, self.xform.instances.count()) xml_submission_file_path = os.path.join( os.path.dirname(os.path.abspath(__file__)), @@ -60,14 +58,14 @@ def test_fail_with_ioerror_read(self, mock_pop): self._make_submission(xml_submission_file_path) self.assertEqual(self.response.status_code, 400) - self.assertEquals(0, self.xform.instances.count()) + self.assertEqual(0, self.xform.instances.count()) @patch('django.utils.datastructures.MultiValueDict.pop') def test_fail_with_ioerror_wsgi(self, mock_pop): mock_pop.side_effect = IOError( 'error during read(65536) on wsgi.input') - self.assertEquals(0, self.xform.instances.count()) + self.assertEqual(0, self.xform.instances.count()) xml_submission_file_path = os.path.join( os.path.dirname(os.path.abspath(__file__)), @@ -76,7 +74,7 @@ def test_fail_with_ioerror_wsgi(self, mock_pop): self._make_submission(xml_submission_file_path) self.assertEqual(self.response.status_code, 400) - self.assertEquals(0, self.xform.instances.count()) + self.assertEqual(0, self.xform.instances.count()) def test_submission_to_require_auth_anon(self): """ diff --git a/onadata/apps/logger/tests/test_importing_database.py b/onadata/apps/logger/tests/test_importing_database.py index ea063f5a9..109e651ca 100644 --- a/onadata/apps/logger/tests/test_importing_database.py +++ b/onadata/apps/logger/tests/test_importing_database.py @@ -1,10 +1,8 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os from django.core.files.storage import get_storage_class -from django.core.urlresolvers import reverse +from django.urls import reverse from django.conf import settings from onadata.apps.main.tests.test_base import TestBase diff --git a/onadata/apps/logger/tests/test_instance_creation.py b/onadata/apps/logger/tests/test_instance_creation.py index a49f0a007..49c7e2e11 100644 --- a/onadata/apps/logger/tests/test_instance_creation.py +++ b/onadata/apps/logger/tests/test_instance_creation.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import glob import os @@ -91,7 +89,7 @@ def test_data_submission(self): path = get_absolute_path(subdirectory) postdata = create_post_data(path) response = self.client.post('/bob/submission', postdata) - self.failUnlessEqual(response.status_code, 201) + self.assertEqual(response.status_code, 201) def test_submission_for_missing_form(self): xml_file = open(os.path.join( @@ -100,4 +98,4 @@ def test_submission_for_missing_form(self): )) postdata = {"xml_submission_file": xml_file} response = self.client.post('/bob/submission', postdata) - self.failUnlessEqual(response.status_code, 404) + self.assertEqual(response.status_code, 404) diff --git a/onadata/apps/logger/tests/test_parsing.py b/onadata/apps/logger/tests/test_parsing.py index 96f1a0f2c..30e3fc4bd 100644 --- a/onadata/apps/logger/tests/test_parsing.py +++ b/onadata/apps/logger/tests/test_parsing.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os import re from xml.dom import minidom @@ -29,7 +27,7 @@ def _publish_and_submit_new_repeats(self): "../fixtures/new_repeats/new_repeats.xls" ) self._publish_xls_file_and_set_xform(xls_file_path) - self.assertEqual(self.response.status_code, 200) + self.assertEqual(self.response.status_code, 201) # submit an instance xml_submission_file_path = os.path.join( @@ -161,7 +159,7 @@ def test_parse_xform_nested_repeats_multiple_nodes(self): "../fixtures/new_repeats/new_repeats.xls" ) self._publish_xls_file_and_set_xform(xls_file_path) - self.assertEqual(self.response.status_code, 200) + self.assertEqual(self.response.status_code, 201) # submit an instance xml_submission_file_path = os.path.join( @@ -170,7 +168,7 @@ def test_parse_xform_nested_repeats_multiple_nodes(self): "multiple_nodes_error.xml" ) self._make_submission(xml_submission_file_path) - self.assertEquals(201, self.response.status_code) + self.assertEqual(201, self.response.status_code) def test_xml_repeated_group_to_dict(self): xml_file = os.path.join( @@ -187,4 +185,5 @@ def test_xml_repeated_group_to_dict(self): self.assertEqual(2, len(dict_['#document']['form']['question_group'])) with open(json_file) as jfile: import json - self.assertEqual(jfile.read(), json.dumps(dict_)) + jfile_content = jfile.read() + self.assertEqual(jfile_content.strip(), json.dumps(dict_).strip()) diff --git a/onadata/apps/logger/tests/test_publish_xls.py b/onadata/apps/logger/tests/test_publish_xls.py index 041276989..e6d12d964 100644 --- a/onadata/apps/logger/tests/test_publish_xls.py +++ b/onadata/apps/logger/tests/test_publish_xls.py @@ -1,9 +1,6 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os import sys -import codecs import unittest from django.core.management import call_command @@ -67,15 +64,13 @@ def test_line_break_in_variables(self): xform.xml = xform.xml.replace( xform.uuid, '663123a849e54bffa8f9832ef016bfac') xform.save() - f = codecs.open(test_xml_file_path, 'w', encoding="utf-8") + f = open(test_xml_file_path, 'wb') f.write(xform.xml) f.close() - with codecs.open( - xml_file_path, 'rb', encoding="utf-8") as expected_file: - with codecs.open( - test_xml_file_path, 'rb', encoding="utf-8") as actual_file: + with open(xml_file_path, 'rb') as expected_file: + with open(test_xml_file_path, 'rb') as actual_file: self.assertMultiLineEqual( - expected_file.read(), actual_file.read()) + expected_file.read().decode(), actual_file.read().decode()) os.remove(test_xml_file_path) def test_report_exception_with_exc_info(self): diff --git a/onadata/apps/logger/tests/test_simple_submission.py b/onadata/apps/logger/tests/test_simple_submission.py index 3f428eac0..ae875f10f 100644 --- a/onadata/apps/logger/tests/test_simple_submission.py +++ b/onadata/apps/logger/tests/test_simple_submission.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.contrib.auth.models import User from django.test import TestCase, RequestFactory from pyxform import SurveyElementBuilder @@ -12,7 +10,7 @@ ) -class TempFileProxy(object): +class TempFileProxy: """ create_instance will be looking for a file object, with "read" and "close" methods. @@ -74,31 +72,31 @@ def test_start_time_boolean_properly_set(self): self.assertTrue(self.xform2.has_start_time) def test_simple_yes_submission(self): - self.assertEquals(0, self.xform1.instances.count()) + self.assertEqual(0, self.xform1.instances.count()) self._submit_simple_yes() - self.assertEquals(1, self.xform1.instances.count()) + self.assertEqual(1, self.xform1.instances.count()) self._submit_simple_yes() # a simple "yes" submission *SHOULD* increment the survey count - self.assertEquals(2, self.xform1.instances.count()) + self.assertEqual(2, self.xform1.instances.count()) def test_start_time_submissions(self): """This test checks to make sure that instances *with start_time available* are marked as duplicates when the XML is a direct match. """ - self.assertEquals(0, self.xform2.instances.count()) + self.assertEqual(0, self.xform2.instances.count()) self._submit_at_hour(11) - self.assertEquals(1, self.xform2.instances.count()) + self.assertEqual(1, self.xform2.instances.count()) self._submit_at_hour(12) - self.assertEquals(2, self.xform2.instances.count()) + self.assertEqual(2, self.xform2.instances.count()) # an instance from 11 AM already exists in the database, so it # *SHOULD NOT* increment the survey count. self._submit_at_hour(11) - self.assertEquals(2, self.xform2.instances.count()) + self.assertEqual(2, self.xform2.instances.count()) def test_corrupted_submission(self): """ diff --git a/onadata/apps/logger/tests/test_update_xform_uuid.py b/onadata/apps/logger/tests/test_update_xform_uuid.py index d9d84c56a..aa557b349 100644 --- a/onadata/apps/logger/tests/test_update_xform_uuid.py +++ b/onadata/apps/logger/tests/test_update_xform_uuid.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os import csv diff --git a/onadata/apps/logger/tests/test_webforms.py b/onadata/apps/logger/tests/test_webforms.py index d3332b0d6..d987c2819 100644 --- a/onadata/apps/logger/tests/test_webforms.py +++ b/onadata/apps/logger/tests/test_webforms.py @@ -1,52 +1,21 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os -import requests -import unittest - -from django.core.urlresolvers import reverse from onadata.apps.main.tests.test_base import TestBase from onadata.apps.logger.models.instance import Instance -from onadata.apps.logger.views import edit_data from onadata.apps.logger.xform_instance_parser import get_uuid_from_xml from onadata.libs.utils.logger_tools import inject_instanceid -from httmock import urlmatch, HTTMock - - -@urlmatch(netloc=r'(.*\.)?enketo\.formhub\.org$') -def enketo_edit_mock(url, request): - response = requests.Response() - response.status_code = 201 - response._content = '{"edit_url": "https://hmh2a.enketo.formhub.org"}' - return response - class TestWebforms(TestBase): def setUp(self): - super(TestWebforms, self).setUp() + super().setUp() self._publish_transportation_form_and_submit_instance() def __load_fixture(self, *path): with open(os.path.join(os.path.dirname(__file__), *path), 'r') as f: return f.read() - @unittest.skip('Fails under Django 1.6') - def test_edit_url(self): - instance = Instance.objects.order_by('id').reverse()[0] - edit_url = reverse(edit_data, kwargs={ - 'username': self.user.username, - 'id_string': self.xform.id_string, - 'data_id': instance.id - }) - with HTTMock(enketo_edit_mock): - response = self.client.get(edit_url) - self.assertEqual(response.status_code, 302) - self.assertEqual(response['location'], - 'https://hmh2a.enketo.formhub.org') - def test_inject_instanceid(self): """ Test that 1 and only 1 instance id exists or is injected diff --git a/onadata/apps/logger/views.py b/onadata/apps/logger/views.py index a5e7d7cb0..573a2b13d 100644 --- a/onadata/apps/logger/views.py +++ b/onadata/apps/logger/views.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from datetime import datetime import datetime as datetime_module import json @@ -16,7 +14,6 @@ from django.contrib import messages from django.core.files.storage import get_storage_class from django.core.files import File -from django.core.urlresolvers import reverse from django.http import (HttpResponse, HttpResponseBadRequest, HttpResponseForbidden, @@ -27,8 +24,7 @@ from django.shortcuts import get_object_or_404 from django.shortcuts import render from django.template import loader -from django.template import RequestContext -from django.utils import six +from django.utils.six import string_types, text_type from django.utils.translation import ugettext as _ from django.views.decorators.http import require_GET, require_POST from django.views.decorators.http import require_http_methods @@ -41,28 +37,22 @@ from onadata.apps.logger.models.instance import Instance from onadata.apps.logger.models.xform import XForm from onadata.libs.utils.log import audit_log, Actions -from onadata.libs.utils.viewer_tools import enketo_url -from onadata.libs.utils.viewer_tools import image_urls_dict from onadata.libs.utils.logger_tools import ( safe_create_instance, OpenRosaResponseBadRequest, OpenRosaResponse, BaseOpenRosaResponse, - inject_instanceid, - remove_xform, publish_xml_form, - publish_form) + publish_form, +) from onadata.libs.utils.logger_tools import response_with_mimetype_and_name -from onadata.libs.utils.decorators import is_owner from onadata.libs.utils.user_auth import (helper_auth_helper, has_permission, - has_edit_permission, HttpResponseNotAuthorized, add_cors_headers, ) -from onadata.libs.utils.viewer_tools import _get_form_url -from ...koboform.pyxform_utils import convert_csv_to_xls from .tasks import generate_stats_zip +from ...koboform.pyxform_utils import convert_csv_to_xls IO_ERROR_STRINGS = [ 'request data read error', @@ -71,7 +61,7 @@ def _bad_request(e): - strerror = unicode(e) + strerror = text_type(e) return strerror and strerror in IO_ERROR_STRINGS @@ -90,28 +80,20 @@ def _parse_int(num): pass -def _html_submission_response(request, instance): - data = {} - data['username'] = instance.xform.user.username - data['id_string'] = instance.xform.id_string - data['domain'] = Site.objects.get(id=settings.SITE_ID).domain - - return render(request, "submission.html", data) - - def _submission_response(request, instance): - data = {} - data['message'] = _("Successful submission.") - data['formid'] = instance.xform.id_string - data['encrypted'] = instance.xform.encrypted - data['instanceID'] = 'uuid:%s' % instance.uuid - data['submissionDate'] = instance.date_created.isoformat() - data['markedAsCompleteDate'] = instance.date_modified.isoformat() - - context = RequestContext(request, data) + data = { + 'message': _("Successful submission."), + 'formid': instance.xform.id_string, + 'encrypted': instance.xform.encrypted, + 'instanceID': f'uuid:{instance.uuid}', + 'submissionDate': instance.date_created.isoformat(), + 'markedAsCompleteDate': instance.date_modified.isoformat() + } + + #context = RequestContext(request, data) t = loader.get_template('submission.xml') - return BaseOpenRosaResponse(t.render(context)) + return BaseOpenRosaResponse(t.render(data, request=request)) @require_POST @@ -283,13 +265,13 @@ def submission(request, username=None): # request.FILES is a django.utils.datastructures.MultiValueDict # for each key we have a list of values try: - xml_file_list = request.FILES.pop("xml_submission_file", []) + xml_file_list = list(request.FILES.pop("xml_submission_file", [])) if len(xml_file_list) != 1: return OpenRosaResponseBadRequest( _("There should be a single XML submission file.") ) # save this XML file and media files as attachments - media_files = request.FILES.values() + media_files = list(request.FILES.values()) # get uuid from post request uuid = request.POST.get('uuid') @@ -313,11 +295,7 @@ def submission(request, username=None): "id_string": instance.xform.id_string }, audit, request) - # response as html if posting with a UUID - if not username and uuid: - response = _html_submission_response(request, instance) - else: - response = _submission_response(request, instance) + response = _submission_response(request, instance) # ODK needs two things for a form to be considered successful # 1) the status code needs to be 201 (created) @@ -332,10 +310,10 @@ def submission(request, username=None): else: raise finally: - if len(xml_file_list): - [_file.close() for _file in xml_file_list] - if len(media_files): - [_file.close() for _file in media_files] + for xml_file in xml_file_list: + xml_file.close() + for media_file in media_files: + media_file.close() def download_xform(request, username, id_string): @@ -417,6 +395,7 @@ def download_xlsform(request, username, id_string): return HttpResponseRedirect("/%s" % username) + def download_jsonform(request, username, id_string): owner = get_object_or_404(User, username__iexact=username) xform = get_object_or_404(XForm, user__username__iexact=username, @@ -441,130 +420,6 @@ def download_jsonform(request, username, id_string): return response -@is_owner -@require_POST -def delete_xform(request, username, id_string): - xform = get_object_or_404(XForm, user__username__iexact=username, - id_string__exact=id_string) - - # delete xform and submissions - remove_xform(xform) - - audit = {} - audit_log( - Actions.FORM_DELETED, request.user, xform.user, - _("Deleted form '%(id_string)s'.") % - { - 'id_string': xform.id_string, - }, audit, request) - return HttpResponseRedirect('/') - - -@is_owner -def toggle_downloadable(request, username, id_string): - xform = XForm.objects.get(user__username__iexact=username, - id_string__exact=id_string) - xform.downloadable = not xform.downloadable - xform.save() - audit = {} - audit_log( - Actions.FORM_UPDATED, request.user, xform.user, - _("Made form '%(id_string)s' %(downloadable)s.") % - { - 'id_string': xform.id_string, - 'downloadable': - _("downloadable") if xform.downloadable else _("un-downloadable") - }, audit, request) - return HttpResponseRedirect("/%s" % username) - - -def enter_data(request, username, id_string): - owner = get_object_or_404(User, username__iexact=username) - xform = get_object_or_404(XForm, user__username__iexact=username, - id_string__exact=id_string) - if not has_edit_permission(xform, owner, request): - return HttpResponseForbidden(_('Not shared.')) - - form_url = _get_form_url(username) - - try: - url = enketo_url(form_url, xform.id_string) - if not url: - return HttpResponseRedirect(reverse('onadata.apps.main.views.show', - kwargs={'username': username, - 'id_string': id_string})) - return HttpResponseRedirect(url) - except Exception as e: - data = {} - owner = User.objects.get(username__iexact=username) - data['profile'], created = \ - UserProfile.objects.get_or_create(user=owner) - data['xform'] = xform - data['content_user'] = owner - data['form_view'] = True - data['message'] = { - 'type': 'alert-error', - 'text': "Enketo error, reason: %s" % e} - messages.add_message( - request, messages.WARNING, - _("Enketo error: enketo replied %s") % e, fail_silently=True) - return render(request, "profile.html", data) - - return HttpResponseRedirect(reverse('onadata.apps.main.views.show', - kwargs={'username': username, - 'id_string': id_string})) - - -def edit_data(request, username, id_string, data_id): - context = RequestContext(request) - owner = User.objects.get(username__iexact=username) - xform = get_object_or_404( - XForm, user__username__iexact=username, id_string__exact=id_string) - instance = get_object_or_404( - Instance, pk=data_id, xform=xform) - instance_attachments = image_urls_dict(instance) - if not has_edit_permission(xform, owner, request): - return HttpResponseForbidden(_('Not shared.')) - if not hasattr(settings, 'ENKETO_URL'): - return HttpResponseRedirect(reverse( - 'onadata.apps.main.views.show', - kwargs={'username': username, 'id_string': id_string})) - - url = '%sdata/edit_url' % settings.ENKETO_URL - # see commit 220f2dad0e for tmp file creation - injected_xml = inject_instanceid(instance.xml, instance.uuid) - return_url = request.build_absolute_uri( - reverse( - 'onadata.apps.viewer.views.instance', - kwargs={ - 'username': username, - 'id_string': id_string} - ) + "#/" + str(instance.id)) - form_url = _get_form_url(username) - - try: - url = enketo_url( - form_url, xform.id_string, instance_xml=injected_xml, - instance_id=instance.uuid, return_url=return_url, - instance_attachments=instance_attachments - ) - except Exception as e: - context.message = { - 'type': 'alert-error', - 'text': "Enketo error, reason: %s" % e} - messages.add_message( - request, messages.WARNING, - _("Enketo error: enketo replied %s") % e, fail_silently=True) - else: - if url: - context.enketo = url - return HttpResponseRedirect(url) - return HttpResponseRedirect( - reverse('onadata.apps.main.views.show', - kwargs={'username': username, - 'id_string': id_string})) - - def view_submission_list(request, username): form_user = get_object_or_404(User, username__iexact=username) profile, created = \ @@ -614,7 +469,7 @@ def view_download_submission(request, username): return authenticator.build_challenge_response() data = {} formId = request.GET.get('formId', None) - if not isinstance(formId, six.string_types): + if not isinstance(formId, string_types): return HttpResponseBadRequest() id_string = formId[0:formId.find('[')] diff --git a/onadata/apps/logger/xform_fs.py b/onadata/apps/logger/xform_fs.py index b9574b79e..503652f90 100644 --- a/onadata/apps/logger/xform_fs.py +++ b/onadata/apps/logger/xform_fs.py @@ -1,12 +1,10 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import os import glob import re -class XFormInstanceFS(object): +class XFormInstanceFS: def __init__(self, filepath): self.path = filepath self.directory, self.filename = os.path.split(self.path) diff --git a/onadata/apps/logger/xform_instance_parser.py b/onadata/apps/logger/xform_instance_parser.py index f2e3b1a6f..21b93c305 100644 --- a/onadata/apps/logger/xform_instance_parser.py +++ b/onadata/apps/logger/xform_instance_parser.py @@ -1,14 +1,13 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - import logging import re import sys import dateutil.parser import six -from django.utils.encoding import smart_unicode, smart_str +from django.utils.encoding import smart_str from django.utils.translation import ugettext as _ +from django.utils.six import text_type from xml.dom import minidom, Node from onadata.libs.utils.common_tags import XFORM_ID_STRING @@ -19,35 +18,23 @@ class XLSFormError(Exception): class DuplicateInstance(Exception): - def __unicode__(self): - return _("Duplicate Instance") - def __str__(self): - return unicode(self).encode('utf-8') + return _("Duplicate Instance") class InstanceInvalidUserError(Exception): - def __unicode__(self): - return _("Could not determine the user.") - def __str__(self): - return unicode(self).encode('utf-8') + return _("Could not determine the user.") class InstanceParseError(Exception): - def __unicode__(self): - return _("The instance could not be parsed.") - def __str__(self): - return unicode(self).encode('utf-8') + return _("The instance could not be parsed.") class InstanceEmptyError(InstanceParseError): - def __unicode__(self): - return _("Empty instance") - def __str__(self): - return unicode(self).encode('utf-8') + return _("Empty instance") class InstanceMultipleNodeError(Exception): @@ -134,8 +121,8 @@ def get_deprecated_uuid_from_xml(xml): def clean_and_parse_xml(xml_string): clean_xml_str = xml_string.strip() - clean_xml_str = re.sub(r">\s+<", "><", smart_unicode(clean_xml_str)) - xml_obj = minidom.parseString(smart_str(clean_xml_str)) + clean_xml_str = re.sub(r">\s+<", "><", smart_str(clean_xml_str)) + xml_obj = minidom.parseString(clean_xml_str) return xml_obj @@ -162,7 +149,7 @@ def _xml_node_to_dict(node, repeats=[]): continue child_name = child.nodeName child_xpath = xpath_from_xml_node(child) - assert d.keys() == [child_name] + assert list(d) == [child_name] node_type = dict # check if name is in list of repeats and make it a list if so if child_xpath in repeats: @@ -218,14 +205,14 @@ def _flatten_dict(d, prefix): # hack: removing [1] index to be consistent across # surveys that have a single repitition of the # loop versus mutliple. - item_prefix[-1] += "[%s]" % unicode(i + 1) + item_prefix[-1] += "[%s]" % text_type(i + 1) if type(item) == dict: for pair in _flatten_dict(item, item_prefix): yield pair else: - yield (item_prefix, item) + yield item_prefix, item else: - yield (new_prefix, value) + yield new_prefix, value def _flatten_dict_nest_repeats(d, prefix): @@ -284,7 +271,7 @@ def _get_all_attributes(node): yield pair -class XFormInstanceParser(object): +class XFormInstanceParser: def __init__(self, xml_str, data_dictionary): self.dd = data_dictionary diff --git a/onadata/apps/main/__init__.py b/onadata/apps/main/__init__.py index 134880430..57d631c3f 100644 --- a/onadata/apps/main/__init__.py +++ b/onadata/apps/main/__init__.py @@ -1,2 +1 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import diff --git a/onadata/apps/main/backends.py b/onadata/apps/main/backends.py deleted file mode 100644 index 3748b0513..000000000 --- a/onadata/apps/main/backends.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - -from django.contrib.auth.models import User -from django.contrib.auth.backends import ModelBackend as DjangoModelBackend - - -class ModelBackend(DjangoModelBackend): - def authenticate(self, username=None, password=None): - """Username is case insensitive.""" - try: - user = User.objects.get(username__iexact=username) - if user.check_password(password): - return user - except User.DoesNotExist: - return None diff --git a/onadata/apps/main/context_processors.py b/onadata/apps/main/context_processors.py index 1b57b1029..2e2f35b5b 100644 --- a/onadata/apps/main/context_processors.py +++ b/onadata/apps/main/context_processors.py @@ -1,6 +1,4 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - from django.conf import settings from django.contrib.sites.models import Site @@ -26,6 +24,7 @@ def site_name(request): site_name = site.name return {'SITE_NAME': site_name} + def base_url(request): """ Return a BASE_URL template context for the current request. @@ -35,4 +34,4 @@ def base_url(request): else: scheme = 'http://' - return {'BASE_URL': scheme + request.get_host(),} + return {'BASE_URL': scheme + request.get_host(), } diff --git a/onadata/apps/main/forms.py b/onadata/apps/main/forms.py index de027a5d4..38ee56e43 100644 --- a/onadata/apps/main/forms.py +++ b/onadata/apps/main/forms.py @@ -1,87 +1,11 @@ # coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - -import re -import urllib2 -from urlparse import urlparse -from StringIO import StringIO - from django import forms -from django.contrib.auth.models import User -from django.contrib.sites.models import Site -from django.core.files.base import ContentFile -from django.core.files.storage import default_storage -from django.core.validators import URLValidator from django.forms import ModelForm -from django.utils.translation import ugettext as _, ugettext_lazy -from django.conf import settings -from recaptcha.client import captcha -from registration.forms import RegistrationFormUniqueEmail -from registration.models import RegistrationProfile - -from pyxform.xls2json_backends import csv_to_dict +from django.utils.translation import ugettext_lazy from onadata.apps.main.models import UserProfile -from onadata.apps.viewer.models.data_dictionary import upload_to -from onadata.libs.utils.country_field import COUNTRIES from onadata.libs.utils.logger_tools import publish_xls_form -FORM_LICENSES_CHOICES = ( - ('No License', ugettext_lazy('No License')), - ('https://creativecommons.org/licenses/by/3.0/', - ugettext_lazy('Attribution CC BY')), - ('https://creativecommons.org/licenses/by-sa/3.0/', - ugettext_lazy('Attribution-ShareAlike CC BY-SA')), -) - -DATA_LICENSES_CHOICES = ( - ('No License', ugettext_lazy('No License')), - ('http://opendatacommons.org/licenses/pddl/summary/', - ugettext_lazy('PDDL')), - ('http://opendatacommons.org/licenses/by/summary/', - ugettext_lazy('ODC-BY')), - ('http://opendatacommons.org/licenses/odbl/summary/', - ugettext_lazy('ODBL')), -) - -PERM_CHOICES = ( - ('view', ugettext_lazy('Can view')), - ('edit', ugettext_lazy('Can edit')), - ('report', ugettext_lazy('Can submit to')), - ('validate', ugettext_lazy('Can validate')), - ('remove', ugettext_lazy('Remove permissions')), -) - - -class DataLicenseForm(forms.Form): - value = forms.ChoiceField(choices=DATA_LICENSES_CHOICES, - widget=forms.Select( - attrs={'disabled': 'disabled', - 'id': 'data-license'})) - - -class FormLicenseForm(forms.Form): - value = forms.ChoiceField(choices=FORM_LICENSES_CHOICES, - widget=forms.Select( - attrs={'disabled': 'disabled', - 'id': 'form-license'})) - - -class PermissionForm(forms.Form): - for_user = forms.CharField( - widget=forms.TextInput( - attrs={ - 'id': 'autocomplete', - 'data-provide': 'typeahead', - 'autocomplete': 'off' - }) - ) - perm_type = forms.ChoiceField(choices=PERM_CHOICES, widget=forms.Select()) - - def __init__(self, username): - self.username = username - super(PermissionForm, self).__init__() - class UserProfileForm(ModelForm): class Meta: @@ -90,150 +14,6 @@ class Meta: fields = ('require_auth',) -class UserProfileFormRegister(forms.Form): - - REGISTRATION_REQUIRE_CAPTCHA = settings.REGISTRATION_REQUIRE_CAPTCHA - RECAPTCHA_PUBLIC_KEY = settings.RECAPTCHA_PUBLIC_KEY - RECAPTCHA_HTML = captcha.displayhtml(settings.RECAPTCHA_PUBLIC_KEY, - use_ssl=settings.RECAPTCHA_USE_SSL) - - name = forms.CharField(widget=forms.TextInput(), required=True, - max_length=255) - city = forms.CharField(widget=forms.TextInput(), required=False, - max_length=255) - country = forms.ChoiceField(widget=forms.Select(), required=False, - choices=COUNTRIES, initial='ZZ') - organization = forms.CharField(widget=forms.TextInput(), required=False, - max_length=255) - home_page = forms.CharField(widget=forms.TextInput(), required=False, - max_length=255) - twitter = forms.CharField(widget=forms.TextInput(), required=False, - max_length=255) - - recaptcha_challenge_field = forms.CharField(required=False, max_length=512) - recaptcha_response_field = forms.CharField( - max_length=100, required=settings.REGISTRATION_REQUIRE_CAPTCHA) - - def save(self, new_user): - new_profile = \ - UserProfile(user=new_user, name=self.cleaned_data['name'], - city=self.cleaned_data['city'], - country=self.cleaned_data['country'], - organization=self.cleaned_data['organization'], - home_page=self.cleaned_data['home_page'], - twitter=self.cleaned_data['twitter']) - new_profile.save() - return new_profile - - -# order of inheritance control order of form display -class RegistrationFormUserProfile(RegistrationFormUniqueEmail, - UserProfileFormRegister): - - class Meta: - # JNM TEMPORARY - model = User - fields = ('username', 'email') - - # Those names conflicts with existing url patterns. Indeed, the root - # url pattern stating states / but you have /admin for - # as admin url, /support as support url, etc. So you want to avoid - # account created with those names. - _reserved_usernames = [ - 'accounts', - 'about', - 'admin', - 'clients', - 'data', - 'formhub', - 'forms', - 'maps', - 'odk', - 'ona', - 'people', - 'public', - 'submit', - 'submission', - 'support', - 'syntax', - 'xls2xform', - 'users', - 'worldbank', - 'unicef', - 'who', - 'wb', - 'wfp', - 'save', - 'ei', - 'modilabs', - 'mvp', - 'unido', - 'unesco', - 'savethechildren', - 'worldvision', - 'afsis' - ] - - username = forms.CharField(widget=forms.TextInput(), max_length=30) - email = forms.EmailField(widget=forms.TextInput()) - - legal_usernames_re = re.compile("^\w+$") - - def clean(self): - cleaned_data = super(UserProfileFormRegister, self).clean() - - # don't check captcha if it's disabled - if not self.REGISTRATION_REQUIRE_CAPTCHA: - if 'recaptcha_response_field' in self._errors: - del self._errors['recaptcha_response_field'] - return cleaned_data - - response = captcha.submit( - cleaned_data.get('recaptcha_challenge_field'), - cleaned_data.get('recaptcha_response_field'), - settings.RECAPTCHA_PRIVATE_KEY, - None) - - if not response.is_valid: - raise forms.ValidationError(_("The Captcha is invalid. " - "Please, try again.")) - return cleaned_data - - # This code use to be in clean_username. Now clean_username is just - # a convenience proxy to this method. This method is here to allow - # the UserProfileSerializer to validate the username without reinventing - # the wheel while still avoiding the need to instancate the form. A even - # cleaner way would be a shared custom validator. - @classmethod - def validate_username(cls, username): - username = username.lower() - if username in cls._reserved_usernames: - raise forms.ValidationError( - _('%s is a reserved name, please choose another') % username) - elif not cls.legal_usernames_re.search(username): - raise forms.ValidationError( - _('username may only contain alpha-numeric characters and ' - 'underscores')) - try: - User.objects.get(username=username) - except User.DoesNotExist: - return username - raise forms.ValidationError(_('%s already exists') % username) - - def clean_username(self): - return self.validate_username(self.cleaned_data['username']) - - -class SourceForm(forms.Form): - source = forms.FileField(label=ugettext_lazy("Source document"), - required=True) - - -class SupportDocForm(forms.Form): - doc = forms.FileField(label=ugettext_lazy("Supporting document"), - required=True) - - class MediaForm(forms.Form): media = forms.FileField(label=ugettext_lazy("Media upload"), required=True) @@ -245,97 +25,14 @@ def clean_media(self): allowed .png .jpg .mp3 .3gp .wav') -class QuickConverterFile(forms.Form): - xls_file = forms.FileField( - label=ugettext_lazy('XLS File'), required=False) - - -class QuickConverterURL(forms.Form): - xls_url = forms.URLField(label=ugettext_lazy('XLS URL'), - required=False) +class QuickConverterForm(forms.Form): - -class QuickConverterDropboxURL(forms.Form): - dropbox_xls_url = forms.URLField( - label=ugettext_lazy('XLS URL'), required=False) - - -class QuickConverterTextXlsForm(forms.Form): - text_xls_form = forms.CharField( - label=ugettext_lazy('XLSForm Representation'), required=False) - - -class QuickConverter(QuickConverterFile, QuickConverterURL, - QuickConverterDropboxURL, QuickConverterTextXlsForm): - validate = URLValidator() + xls_file = forms.FileField( + label=ugettext_lazy('XLS File'), required=True) def publish(self, user, id_string=None): if self.is_valid(): - # If a text (csv) representation of the xlsform is present, - # this will save the file and pass it instead of the 'xls_file' - # field. - if 'text_xls_form' in self.cleaned_data\ - and self.cleaned_data['text_xls_form'].strip(): - csv_data = self.cleaned_data['text_xls_form'] - # "Note that any text-based field - such as CharField or - # EmailField - always cleans the input into a Unicode string" - # (https://docs.djangoproject.com/en/1.8/ref/forms/api/#django.forms.Form.cleaned_data). - csv_data = csv_data.encode('utf-8') - # requires that csv forms have a settings with an id_string or - # form_id - _sheets = csv_to_dict(StringIO(csv_data)) - try: - _settings = _sheets['settings'][0] - if 'id_string' in _settings: - _name = '%s.csv' % _settings['id_string'] - else: - _name = '%s.csv' % _settings['form_id'] - except (KeyError, IndexError) as e: - raise ValueError('CSV XLSForms must have a settings sheet' - ' and id_string or form_id') - - cleaned_xls_file = \ - default_storage.save( - upload_to(None, _name, user.username), - ContentFile(csv_data)) - else: - cleaned_xls_file = self.cleaned_data['xls_file'] + cleaned_xls_file = self.cleaned_data['xls_file'] - if not cleaned_xls_file: - cleaned_url = self.cleaned_data['xls_url'] - if cleaned_url.strip() == '': - cleaned_url = self.cleaned_data['dropbox_xls_url'] - cleaned_xls_file = urlparse(cleaned_url) - cleaned_xls_file = \ - '_'.join(cleaned_xls_file.path.split('/')[-2:]) - if cleaned_xls_file[-4:] != '.xls': - cleaned_xls_file += '.xls' - cleaned_xls_file = \ - upload_to(None, cleaned_xls_file, user.username) - self.validate(cleaned_url) - xls_data = ContentFile(urllib2.urlopen(cleaned_url).read()) - cleaned_xls_file = \ - default_storage.save(cleaned_xls_file, xls_data) # publish the xls return publish_xls_form(cleaned_xls_file, user, id_string) - - -class ActivateSMSSupportFom(forms.Form): - - enable_sms_support = forms.TypedChoiceField(coerce=lambda x: x == 'True', - choices=((False, 'No'), - (True, 'Yes')), - widget=forms.Select, - label=ugettext_lazy( - "Enable SMS Support")) - sms_id_string = forms.CharField(max_length=50, required=True, - label=ugettext_lazy("SMS Keyword")) - - def clean_sms_id_string(self): - sms_id_string = self.cleaned_data.get('sms_id_string', '').strip() - - if not re.match(r'^[a-z0-9\_\-]+$', sms_id_string): - raise forms.ValidationError("id_string can only contain alphanum" - " characters") - - return sms_id_string diff --git a/onadata/apps/main/google_doc.py b/onadata/apps/main/google_doc.py deleted file mode 100644 index d0b7fb86d..000000000 --- a/onadata/apps/main/google_doc.py +++ /dev/null @@ -1,204 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals, print_function, division, absolute_import - -import re -import urllib2 - -from django.template.loader import render_to_string -from django.template.defaultfilters import slugify - - -class Section(dict): - """ - A class used to represent a section of a page. A section should - have certain fields. 'level' denotes how nested this section is in - the document, like h1, h2, etc. 'id' is a string used to link to - this section. 'title' will be printed at the top the - section. 'content' is the html that will be printed as the meat of - the section. Notice that we use the 'section.html' template to - render a section as html, and the url provides a link that will be - used in the page's table of contents. - """ - - FIELDS = ['level', 'id', 'title', 'content'] - - def to_html(self): - return render_to_string('section.html', self) - - def url(self): - return '%(title)s' % self - - -class TreeNode(list): - """ - This simple tree class will be used to construct the table of - contents for the page. - """ - - def __init__(self, value=None, parent=None): - self.value = value - self.parent = parent - list.__init__(self) - - def add_child(self, value): - child = TreeNode(value, self) - self.append(child) - return child - - -class GoogleDoc(object): - """ - This class provides a structure for dealing with a Google - Document. Most use cases will initialize a GoogleDoc by passing a - url to the init. This should be a public url that links to an html - version of the document. You can find this url by publishing your - Google Document to the web and copying the url. - - The primary method this class provides is 'to_html' which renders - this document as html in the Twitter Bootstrap format. - """ - - def __init__(self, url=None): - if url is not None: - self.set_html_from_url(url) - - def set_html_from_url(self, url): - f = urllib2.urlopen(url) - self.set_html(f.read()) - f.close() - - def set_html(self, html): - """ - When setting the html for this Google Document we do two - things: - - 1. We extract the content from the html. Using a regular - expression we pull the meat of the document out of the body - of the html, we also cut off the footer Google adds on - automatically. - - 2. We extract the various sections from the content of the - document. Again using a regular expression, we look for h1, - h2, ... tags to split the document up into sections. Note: - it is important when you are writing your Google Document - to use the heading text styles, so this code will split - things correctly. - """ - self._html = html - self._extract_content() - self._extract_sections() - - def _extract_content(self): - m = re.search(r'(.*)