From 0e37809ad0c9e70d003c64a7afdd7071684bb119 Mon Sep 17 00:00:00 2001 From: Iago Veloso Date: Fri, 3 Aug 2018 13:52:24 +0100 Subject: [PATCH] Slim setup & python 2to3 & upgrade requirements --- .bowerrc | 2 +- .coveragerc | 5 +- .dockerignore | 13 ++ .gitignore | 12 +- .sample.env | 10 + .travis.yml | 12 +- README.rst | 2 +- docker-compose.override.yaml | 16 ++ docker-compose.staging.yaml | 31 +++ docker-compose.yaml | 36 +++- docker/django.Dockerfile | 30 +-- docker/nginx.conf | 129 ++++++++++++ docker/scripts/launch_dev_server.sh | 8 + docker/scripts/launch_server.sh | 9 +- docker/scripts/setup.sh | 3 - docker/scripts/wait_for.sh | 27 +++ docs/source/installation/install_web_app.rst | 26 ++- docs/source/source_code/fab_utils.rst | 7 - docs/source/source_code/fabfile.rst | 7 - docs/source/source_code/modules.rst | 4 +- docs/source/source_code/radioco.apps.api.rst | 4 +- .../source_code/radioco.apps.api.tests.rst | 24 +-- .../source_code/radioco.apps.dashboard.rst | 38 ---- ...adioco.apps.global_settings.migrations.rst | 36 ++-- .../radioco.apps.global_settings.rst | 12 +- ...ioco.apps.global_settings.templatetags.rst | 8 +- .../radioco.apps.programmes.migrations.rst | 44 ++-- .../radioco.apps.programmes.tests.rst | 30 +++ ...radioco.apps.radio.management.commands.rst | 22 -- .../radioco.apps.radio.management.rst | 17 -- .../source/source_code/radioco.apps.radio.rst | 69 ------- ...dioco.apps.radioco.management.commands.rst | 4 +- .../radioco.apps.radioco.migrations.rst | 4 +- .../source_code/radioco.apps.radioco.rst | 12 +- .../radioco.apps.schedules.migrations.rst | 20 +- .../radioco.apps.schedules.tests.rst | 12 +- .../radioco.apps.users.migrations.rst | 16 +- .../source_code/radioco.configs.base.rst | 20 +- .../radioco.configs.development.rst | 30 --- .../source_code/radioco.configs.heroku.rst | 38 ---- .../source_code/radioco.configs.openshift.rst | 22 -- docs/source/source_code/radioco.configs.rst | 3 - .../source_code/radioco.configs.staging.rst | 38 ---- docs/source/source_code/setup.rst | 7 - docs/source/source_code/tasks.rst | 32 --- docs/source/upgrade/4.0.rst | 39 ++++ docs/source/upgrade/index.rst | 1 + node_modules/.gitkeep | 0 radioco/__init__.py | 2 +- radioco/apps/api/serializers.py | 2 +- radioco/apps/api/tests/test_api.py | 16 +- radioco/apps/api/tests/test_fullcalendar.py | 24 +-- radioco/apps/api/tests/test_programmes.py | 16 +- radioco/apps/api/tests/test_recorder.py | 62 +++--- radioco/apps/api/tests/test_schedules.py | 8 +- radioco/apps/api/views.py | 4 +- .../migrations/0001_initial.py | 6 +- ...alendarconfiguration_display_next_weeks.py | 2 +- .../0003_siteconfiguration_footer.py | 4 +- .../migrations/0004_auto_20150606_1335.py | 8 +- .../migrations/0005_auto_20150606_1415.py | 4 +- .../migrations/0006_auto_20160116_1509.py | 4 +- ...007__v3_0__calendarconfiguration_tweaks.py | 2 +- .../0008__v3_0__radiocomconfiguration.py | 8 +- radioco/apps/global_settings/models.py | 8 +- radioco/apps/programmes/admin.py | 6 +- .../programmes/migrations/0001_initial.py | 12 +- .../0002_change_language_choices.py | 4 +- .../0003_change_textfield_to_richtextfield.py | 4 +- .../migrations/0004_change_photo_url.py | 2 +- .../migrations/0005_auto_20150531_1734.py | 2 +- .../migrations/0006_auto_20160104_2029.py | 4 +- .../migrations/0007_change_default_image.py | 4 +- .../migrations/0008_auto_20160116_1509.py | 4 +- .../migrations/0009__v3_0__small_tweaks.py | 2 +- .../migrations/0010__v3_2__convert_role.py | 2 +- .../0011__v3_2__ensure_one_user_role.py | 2 +- radioco/apps/programmes/models.py | 26 +-- radioco/apps/programmes/tests/test_feed.py | 10 +- radioco/apps/programmes/tests/test_models.py | 4 +- radioco/apps/programmes/utils.py | 3 +- .../migrations/0001__v3_0__mysql_timezone.py | 2 +- radioco/apps/radioco/tests/tests.py | 4 +- radioco/apps/radioco/views.py | 4 +- radioco/apps/schedules/admin.py | 2 +- .../apps/schedules/migrations/0001_initial.py | 4 +- .../0002__v3_0__renaming_calendar_model.py | 2 +- .../0003__v3_0__create_excludeddates_model.py | 2 +- .../migrations/0004__v3_0__adding_rrules.py | 2 +- ..._migrating_schedules_to_unique_calendar.py | 8 +- radioco/apps/schedules/models.py | 12 +- .../apps/schedules/tests/test_recurrences.py | 32 +-- .../apps/schedules/tests/test_schedules.py | 77 ++++--- radioco/apps/schedules/tests/test_timezone.py | 10 +- radioco/apps/schedules/utils.py | 4 +- radioco/apps/schedules/views.py | 2 +- radioco/apps/users/migrations/0001_initial.py | 4 +- .../0002_change_textfield_to_richtextfield.py | 2 +- .../migrations/0003_auto_20160104_2029.py | 4 +- .../0004__v3_0__ckeditor_upload_field.py | 2 +- radioco/apps/users/models.py | 2 +- radioco/configs/base/settings.py | 51 ++++- radioco/configs/base/urls.py | 2 +- radioco/configs/base/wsgi.py | 5 + radioco/locale/es/LC_MESSAGES/django.mo | Bin 12713 -> 12713 bytes radioco/locale/es/LC_MESSAGES/django.po | 48 ++--- radioco/locale/gl/LC_MESSAGES/django.mo | Bin 12104 -> 12104 bytes radioco/locale/gl/LC_MESSAGES/django.po | 48 ++--- radioco/locale/tr/LC_MESSAGES/django.mo | Bin 2927 -> 2927 bytes radioco/locale/tr/LC_MESSAGES/django.po | 48 ++--- requirements.txt | 24 ++- run | 54 ++++- tasks/__init__.py | 7 +- tasks/docker.py | 191 ------------------ tasks/heroku.py | 23 --- tasks/locale.py | 6 +- tasks/radioco.py | 28 --- tasks/utils.py | 89 -------- 118 files changed, 913 insertions(+), 1154 deletions(-) create mode 100644 .dockerignore create mode 100644 .sample.env create mode 100644 docker-compose.override.yaml create mode 100644 docker-compose.staging.yaml create mode 100644 docker/nginx.conf create mode 100755 docker/scripts/launch_dev_server.sh delete mode 100755 docker/scripts/setup.sh create mode 100755 docker/scripts/wait_for.sh delete mode 100644 docs/source/source_code/fab_utils.rst delete mode 100644 docs/source/source_code/fabfile.rst delete mode 100644 docs/source/source_code/radioco.apps.dashboard.rst create mode 100644 docs/source/source_code/radioco.apps.programmes.tests.rst delete mode 100644 docs/source/source_code/radioco.apps.radio.management.commands.rst delete mode 100644 docs/source/source_code/radioco.apps.radio.management.rst delete mode 100644 docs/source/source_code/radioco.apps.radio.rst delete mode 100644 docs/source/source_code/radioco.configs.development.rst delete mode 100644 docs/source/source_code/radioco.configs.heroku.rst delete mode 100644 docs/source/source_code/radioco.configs.openshift.rst delete mode 100644 docs/source/source_code/radioco.configs.staging.rst delete mode 100644 docs/source/source_code/setup.rst create mode 100755 docs/source/upgrade/4.0.rst delete mode 100644 node_modules/.gitkeep create mode 100644 radioco/configs/base/wsgi.py delete mode 100644 tasks/docker.py delete mode 100644 tasks/heroku.py delete mode 100644 tasks/radioco.py delete mode 100644 tasks/utils.py diff --git a/.bowerrc b/.bowerrc index 5af1897..ae24bbd 100644 --- a/.bowerrc +++ b/.bowerrc @@ -1,4 +1,4 @@ { "allow_root": true, - "directory" : "radioco/apps/radioco/static/bower" + "directory" : "tmp_bower" } \ No newline at end of file diff --git a/.coveragerc b/.coveragerc index a612865..6f4f3d6 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,4 +1,7 @@ [paths] source = radioco/ - /radioco/radioco/ \ No newline at end of file + /radioco/radioco/ +[run] +source = + radioco diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..86df58d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +**/node_modules +**/__pycache__ +**/.cache +test_reports/ +venv/ +env/ +**/.pyc +**/.kdbx +**/.ipynb +**/db.sqlite3 +**/.vscode +radioco/static/ +radioco/apps/radioco/static/bower/ diff --git a/.gitignore b/.gitignore index 827f35f..85a7031 100755 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ # django collectstatic files -radioco/media/_versions/ -radioco/components/ -radioco/static/ +/radioco/media/_versions/ +/radioco/components/ +/radioco/static/ +/radioco/media/ # source locale radioco/locale/en/* @@ -52,6 +53,7 @@ pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports +reports/ htmlcov/ nosetests.xml coverage.xml @@ -65,7 +67,3 @@ docs/_build/ # Files ending in ~ *~ - -# Docker tmp files (just in case) -id_rsa.pub -tmp_requirements.txt \ No newline at end of file diff --git a/.sample.env b/.sample.env new file mode 100644 index 0000000..b0fb4f5 --- /dev/null +++ b/.sample.env @@ -0,0 +1,10 @@ +LANG=C.UTF-8 +COMPOSE_PROJECT_NAME=radioco + +SECRET_KEY=REPLACE_ME +DJANGO_LOG_LEVEL=ERROR +TIME_ZONE=Europe/Madrid +DISQUS_API_KEY= +DISQUS_WEBSITE_SHORTNAME= + +PORT_BACKEND=8000 diff --git a/.travis.yml b/.travis.yml index 521631f..d2a4b7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ services: - docker python: - - "2.7" + - "3.6" branches: only: @@ -14,13 +14,11 @@ branches: - develop install: - - pip install coverage coveralls invoke + - pip install coverage coveralls script: - - inv --echo docker.setup -e base - - inv --echo docker.run_coverage -e base - - inv --echo docker.destroy -e base - - coverage combine + - sh -x run coverage + - cd reports && coverage combine after_success: - coveralls + cd reports && coveralls diff --git a/README.rst b/README.rst index 5d950d8..93a3f13 100755 --- a/README.rst +++ b/README.rst @@ -40,7 +40,7 @@ Open a terminal and introduce the following commands:: git clone https://github.com/iago1460/django-radio cd django-radio chmod +x ./run - ./run start + ./run start_dev ./run manage create_example_data diff --git a/docker-compose.override.yaml b/docker-compose.override.yaml new file mode 100644 index 0000000..02ef5cb --- /dev/null +++ b/docker-compose.override.yaml @@ -0,0 +1,16 @@ +version: '3.4' +services: + + + # Backend server ------------------------------------------------------------- + + django: + environment: + - DEBUG=True + volumes: + - ./:/radioco/ + ports: + - ${PORT_BACKEND}:8000 + command: /bin/sh -c "cd /radioco && ./docker/scripts/launch_dev_server.sh" + #stdin_open: true + #tty: true # ERROR: An HTTP request took too long to complete. https://github.com/docker/compose/issues/3633 diff --git a/docker-compose.staging.yaml b/docker-compose.staging.yaml new file mode 100644 index 0000000..9e7a5e1 --- /dev/null +++ b/docker-compose.staging.yaml @@ -0,0 +1,31 @@ +version: '3.4' +services: + + + # Backend server ------------------------------------------------------------- + + django: + environment: + - DEBUG=False + volumes: + - ./radioco/static/:/radioco/radioco/static/ + command: /bin/sh -c "cd /radioco && ./docker/scripts/launch_server.sh" + + nginx: + image: nginx:1.13.1-alpine + restart: always + volumes: + - ./docker/nginx.conf:/etc/nginx/nginx.conf:ro + - ./radioco/static:/static:ro + - ./radioco/media:/media:ro + ports: + - ${PORT_BACKEND}:8000 + env_file: + - .env + command: /bin/sh -c "nginx -g 'daemon off;'" + links: + - django + + memcached: + image: memcached:1.4.37-alpine + command: memcached -m 512m diff --git a/docker-compose.yaml b/docker-compose.yaml index 2833859..45b720a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,4 @@ -version: '3' +version: '3.4' services: @@ -9,14 +9,28 @@ services: context: . dockerfile: docker/django.Dockerfile environment: - - DJANGO_LOG_LEVEL=ERROR - - MANAGE_PY=${MANAGE_PY:-python manage.py} + - SECRET_KEY=$SECRET_KEY + - DJANGO_LOG_LEVEL=$DJANGO_LOG_LEVEL + - TIME_ZONE=$TIME_ZONE + - DISQUS_API_KEY=$DISQUS_API_KEY + - DISQUS_WEBSITE_SHORTNAME=$DISQUS_WEBSITE_SHORTNAME volumes: - - ./:/radioco - expose: - - ${PORT_BACKEND} - ports: - - ${PORT_BACKEND}:8000 - command: /radioco/docker/scripts/launch_server.sh - stdin_open: true - #tty: true # ERROR: An HTTP request took too long to complete. https://github.com/docker/compose/issues/3633 + - ./radioco/media/:/radioco/radioco/media/ + links: + - postgres + + postgres: + image: postgres:11.0 + restart: always + environment: + POSTGRES_DB: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_USER: postgres + volumes: + - database_data:/var/lib/postgresql/data + +# Volumes --------------------------------------------------------------------- + +volumes: + database_data: + name: database_data diff --git a/docker/django.Dockerfile b/docker/django.Dockerfile index 3513476..56b8c37 100644 --- a/docker/django.Dockerfile +++ b/docker/django.Dockerfile @@ -1,24 +1,30 @@ -FROM python:2.7 +FROM python:3.6-jessie - -# Installing libraries - -RUN apt-get update && apt-get install -y --no-install-recommends \ - python-setuptools \ - python-pip \ +RUN apt-get update && apt-get install -yq --fix-missing --no-install-recommends \ + libmysqlclient-dev \ + mysql-client \ + python3-setuptools \ + python3-pip \ git-core \ + netcat \ nodejs-legacy \ npm \ + gettext \ && apt-get clean && rm -rf /var/lib/apt/lists/* -RUN npm install -g bower +# Installing libraries +RUN npm install -g bower # Install pip dependencies +RUN pip3 install --upgrade pip setuptools virtualenv + +COPY .bowerrc bower.json / +RUN bower install + +COPY requirements.txt / +RUN pip3 install -r requirements.txt -RUN pip install --upgrade pip setuptools virtualenv +COPY ./ /radioco/ -COPY requirements.txt requirements.txt -RUN pip install --upgrade pip -RUN pip install -r requirements.txt WORKDIR /radioco/ \ No newline at end of file diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 0000000..89e02e1 --- /dev/null +++ b/docker/nginx.conf @@ -0,0 +1,129 @@ +worker_processes 1; +events { + worker_connections 1024; +} +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + # Hide nginx version information. + server_tokens off; + + # Compression + gunzip on; + gzip on; + gzip_comp_level 2; + gzip_proxied any; + gzip_types + image/svg+xml + image/x-icon + text/x-component + text/css + text/javascript + text/xml + text/plain + application/javascript + application/x-javascript + application/json + application/atom+xml + application/rss+xml + application/xhtml+xml; + + uwsgi_cache_path /tmp/cache1 levels=1:2 keys_zone=web:1m max_size=1g inactive=8h use_temp_path=off; + uwsgi_cache_path /tmp/cache2 levels=1:2 keys_zone=api:10m max_size=1g inactive=24h use_temp_path=off; + + upstream django { + server django:8000; + } + server { + listen 8000; + charset utf-8; + + include /etc/nginx/uwsgi_params; + + uwsgi_param Host $host; + uwsgi_param X-Real-IP $remote_addr; + uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for; + uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto; + + # server cache + uwsgi_cache_key "$scheme$host$uri$is_args$args"; + uwsgi_cache_methods GET HEAD; + + # cache debug info + #add_header X-uWSGI-Cache $upstream_cache_status; + #add_header X-uWSGI-Cache-Key "$scheme$host$uri$is_args$args"; + + location /static/ { + alias /static/; + expires 1d; + log_not_found off; + access_log off; + } + + location /media/ { + alias /media/; + expires 1d; + log_not_found off; + access_log off; + } + + location /admin/ { + # disable any cache + expires 0; + uwsgi_no_cache 1; + uwsgi_pass django; + } + + location / { + # client cache + expires 10m; + + # server cache + uwsgi_cache web; + uwsgi_cache_valid 200 5m; + + uwsgi_pass django; + } + + location ~ /rss/$ { + # client cache + expires 1h; + + # server cache + uwsgi_cache web; + uwsgi_cache_valid 200 45m; + + uwsgi_pass django; + } + + location /api/ { + # disable client cache + expires 0; + + # server cache except for authenticated users (calendar manager) + uwsgi_cache api; + uwsgi_cache_valid 200 30m; + uwsgi_no_cache $cookie_sessionid; + + uwsgi_pass django; + } + + location ~ ^/api/2/(radiocom/)?transmissions/now { + # same as before but cache for a shorter period + expires 0; + + uwsgi_cache api; + uwsgi_cache_valid 200 1m; + + uwsgi_pass django; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + } +} \ No newline at end of file diff --git a/docker/scripts/launch_dev_server.sh b/docker/scripts/launch_dev_server.sh new file mode 100755 index 0000000..2719a3a --- /dev/null +++ b/docker/scripts/launch_dev_server.sh @@ -0,0 +1,8 @@ +#!/bin/bash -x + +script_full_path=$(dirname "$0") +$script_full_path/wait_for.sh postgres 5432 + +mv -f /tmp_bower /radioco/radioco/apps/radioco/static/bower +python3 manage.py migrate +python3 manage.py runserver 0.0.0.0:8000 \ No newline at end of file diff --git a/docker/scripts/launch_server.sh b/docker/scripts/launch_server.sh index e6bb8f0..1fcee51 100755 --- a/docker/scripts/launch_server.sh +++ b/docker/scripts/launch_server.sh @@ -1,2 +1,9 @@ #!/bin/bash -x -${MANAGE_PY} runserver 0.0.0.0:8000 \ No newline at end of file + +script_full_path=$(dirname "$0") +$script_full_path/wait_for.sh postgres 5432 + +mv -f /tmp_bower /radioco/radioco/apps/radioco/static/bower +python3 manage.py migrate +python3 manage.py collectstatic --noinput +uwsgi --socket 0.0.0.0:8000 --module radioco.configs.base.wsgi --master --processes 2 --threads 1 \ No newline at end of file diff --git a/docker/scripts/setup.sh b/docker/scripts/setup.sh deleted file mode 100755 index 6f4fb93..0000000 --- a/docker/scripts/setup.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -x -bower install -${MANAGE_PY} migrate \ No newline at end of file diff --git a/docker/scripts/wait_for.sh b/docker/scripts/wait_for.sh new file mode 100755 index 0000000..e50e48d --- /dev/null +++ b/docker/scripts/wait_for.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +HOST=$1 +PORT=$2 + +if [[ "$HOST" == "" ]]; then + echo "wait_for: Missing host" + exit 1 +fi + +if [[ "$PORT" == "" ]]; then + echo "wait_for: Missing port" + exit 1 +fi + +counter=0 +echo -n "Waiting for $HOST:$PORT..." +while ! nc -z $HOST $PORT > /dev/null; do + echo -n "." + sleep 1 + ((counter+=1)) + if (( counter > 60 )); then + echo " Failed" + exit 1 + fi +done +echo " Ready" diff --git a/docs/source/installation/install_web_app.rst b/docs/source/installation/install_web_app.rst index 4830b36..71dec2d 100755 --- a/docs/source/installation/install_web_app.rst +++ b/docs/source/installation/install_web_app.rst @@ -37,18 +37,13 @@ Next, download the project and cd into it: cd django-radio -Install the python invoke library: +Execute the following commands to deploy the app in docker, this step take some time: .. code-block:: bash - pip install invoke==0.14.0 - - -Execute the next command to deploy the app in docker, this step take some time: - -.. code-block:: bash - - inv quickstart + chmod +x ./run + ./run start_dev + ./run manage create_example_data .. warning:: @@ -81,3 +76,16 @@ Using RadioCo on production The Internet is a hostile environment. Before deploying this project, you should take some time to review your settings, with security, performance, and operations in mind. Keep in mind `this critical settings `_. + +Locally +======= + +RadioCo provides a staging environment, safer than the previous one but still insecure, **use at your own risk**. + + +.. code-block:: bash + + ./run start + + +Now that the server’s running, visit http://127.0.0.1:8000/ diff --git a/docs/source/source_code/fab_utils.rst b/docs/source/source_code/fab_utils.rst deleted file mode 100644 index cdcd90f..0000000 --- a/docs/source/source_code/fab_utils.rst +++ /dev/null @@ -1,7 +0,0 @@ -fab_utils module -================ - -.. automodule:: fab_utils - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/source_code/fabfile.rst b/docs/source/source_code/fabfile.rst deleted file mode 100644 index a25b878..0000000 --- a/docs/source/source_code/fabfile.rst +++ /dev/null @@ -1,7 +0,0 @@ -fabfile module -============== - -.. automodule:: fabfile - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/source_code/modules.rst b/docs/source/source_code/modules.rst index d854964..18ad449 100644 --- a/docs/source/source_code/modules.rst +++ b/docs/source/source_code/modules.rst @@ -1,5 +1,5 @@ -django-radio -============ +radioco +======= .. toctree:: :maxdepth: 4 diff --git a/docs/source/source_code/radioco.apps.api.rst b/docs/source/source_code/radioco.apps.api.rst index c9a8f0f..7c8c590 100644 --- a/docs/source/source_code/radioco.apps.api.rst +++ b/docs/source/source_code/radioco.apps.api.rst @@ -11,8 +11,8 @@ Subpackages Submodules ---------- -radioco.apps.api.recorder_views module --------------------------------------- +radioco.apps.api.recorder\_views module +--------------------------------------- .. automodule:: radioco.apps.api.recorder_views :members: diff --git a/docs/source/source_code/radioco.apps.api.tests.rst b/docs/source/source_code/radioco.apps.api.tests.rst index 07965b1..c573daa 100644 --- a/docs/source/source_code/radioco.apps.api.tests.rst +++ b/docs/source/source_code/radioco.apps.api.tests.rst @@ -4,48 +4,48 @@ radioco.apps.api.tests package Submodules ---------- -radioco.apps.api.tests.test_api module --------------------------------------- +radioco.apps.api.tests.test\_api module +--------------------------------------- .. automodule:: radioco.apps.api.tests.test_api :members: :undoc-members: :show-inheritance: -radioco.apps.api.tests.test_fullcalendar module ------------------------------------------------ +radioco.apps.api.tests.test\_fullcalendar module +------------------------------------------------ .. automodule:: radioco.apps.api.tests.test_fullcalendar :members: :undoc-members: :show-inheritance: -radioco.apps.api.tests.test_programmes module ---------------------------------------------- +radioco.apps.api.tests.test\_programmes module +---------------------------------------------- .. automodule:: radioco.apps.api.tests.test_programmes :members: :undoc-members: :show-inheritance: -radioco.apps.api.tests.test_radiocom_api module ------------------------------------------------ +radioco.apps.api.tests.test\_radiocom\_api module +------------------------------------------------- .. automodule:: radioco.apps.api.tests.test_radiocom_api :members: :undoc-members: :show-inheritance: -radioco.apps.api.tests.test_recorder module -------------------------------------------- +radioco.apps.api.tests.test\_recorder module +-------------------------------------------- .. automodule:: radioco.apps.api.tests.test_recorder :members: :undoc-members: :show-inheritance: -radioco.apps.api.tests.test_schedules module --------------------------------------------- +radioco.apps.api.tests.test\_schedules module +--------------------------------------------- .. automodule:: radioco.apps.api.tests.test_schedules :members: diff --git a/docs/source/source_code/radioco.apps.dashboard.rst b/docs/source/source_code/radioco.apps.dashboard.rst deleted file mode 100644 index 74a6408..0000000 --- a/docs/source/source_code/radioco.apps.dashboard.rst +++ /dev/null @@ -1,38 +0,0 @@ -radioco.apps.dashboard package -============================== - -Submodules ----------- - -radioco.apps.dashboard.forms module ------------------------------------ - -.. automodule:: radioco.apps.dashboard.forms - :members: - :undoc-members: - :show-inheritance: - -radioco.apps.dashboard.urls module ----------------------------------- - -.. automodule:: radioco.apps.dashboard.urls - :members: - :undoc-members: - :show-inheritance: - -radioco.apps.dashboard.views module ------------------------------------ - -.. automodule:: radioco.apps.dashboard.views - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: radioco.apps.dashboard - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/source_code/radioco.apps.global_settings.migrations.rst b/docs/source/source_code/radioco.apps.global_settings.migrations.rst index f08ba0a..05a9188 100644 --- a/docs/source/source_code/radioco.apps.global_settings.migrations.rst +++ b/docs/source/source_code/radioco.apps.global_settings.migrations.rst @@ -1,67 +1,67 @@ -radioco.apps.global_settings.migrations package -=============================================== +radioco.apps.global\_settings.migrations package +================================================ Submodules ---------- -radioco.apps.global_settings.migrations.0001_initial module ------------------------------------------------------------ +radioco.apps.global\_settings.migrations.0001\_initial module +------------------------------------------------------------- .. automodule:: radioco.apps.global_settings.migrations.0001_initial :members: :undoc-members: :show-inheritance: -radioco.apps.global_settings.migrations.0002_remove_calendarconfiguration_display_next_weeks module ---------------------------------------------------------------------------------------------------- +radioco.apps.global\_settings.migrations.0002\_remove\_calendarconfiguration\_display\_next\_weeks module +--------------------------------------------------------------------------------------------------------- .. automodule:: radioco.apps.global_settings.migrations.0002_remove_calendarconfiguration_display_next_weeks :members: :undoc-members: :show-inheritance: -radioco.apps.global_settings.migrations.0003_siteconfiguration_footer module ----------------------------------------------------------------------------- +radioco.apps.global\_settings.migrations.0003\_siteconfiguration\_footer module +------------------------------------------------------------------------------- .. automodule:: radioco.apps.global_settings.migrations.0003_siteconfiguration_footer :members: :undoc-members: :show-inheritance: -radioco.apps.global_settings.migrations.0004_auto_20150606_1335 module ----------------------------------------------------------------------- +radioco.apps.global\_settings.migrations.0004\_auto\_20150606\_1335 module +-------------------------------------------------------------------------- .. automodule:: radioco.apps.global_settings.migrations.0004_auto_20150606_1335 :members: :undoc-members: :show-inheritance: -radioco.apps.global_settings.migrations.0005_auto_20150606_1415 module ----------------------------------------------------------------------- +radioco.apps.global\_settings.migrations.0005\_auto\_20150606\_1415 module +-------------------------------------------------------------------------- .. automodule:: radioco.apps.global_settings.migrations.0005_auto_20150606_1415 :members: :undoc-members: :show-inheritance: -radioco.apps.global_settings.migrations.0006_auto_20160116_1509 module ----------------------------------------------------------------------- +radioco.apps.global\_settings.migrations.0006\_auto\_20160116\_1509 module +-------------------------------------------------------------------------- .. automodule:: radioco.apps.global_settings.migrations.0006_auto_20160116_1509 :members: :undoc-members: :show-inheritance: -radioco.apps.global_settings.migrations.0007__v3_0__calendarconfiguration_tweaks module ---------------------------------------------------------------------------------------- +radioco.apps.global\_settings.migrations.0007\_\_v3\_0\_\_calendarconfiguration\_tweaks module +---------------------------------------------------------------------------------------------- .. automodule:: radioco.apps.global_settings.migrations.0007__v3_0__calendarconfiguration_tweaks :members: :undoc-members: :show-inheritance: -radioco.apps.global_settings.migrations.0008__v3_0__radiocomconfiguration module --------------------------------------------------------------------------------- +radioco.apps.global\_settings.migrations.0008\_\_v3\_0\_\_radiocomconfiguration module +-------------------------------------------------------------------------------------- .. automodule:: radioco.apps.global_settings.migrations.0008__v3_0__radiocomconfiguration :members: diff --git a/docs/source/source_code/radioco.apps.global_settings.rst b/docs/source/source_code/radioco.apps.global_settings.rst index 9a94bf1..368ee93 100644 --- a/docs/source/source_code/radioco.apps.global_settings.rst +++ b/docs/source/source_code/radioco.apps.global_settings.rst @@ -1,5 +1,5 @@ -radioco.apps.global_settings package -==================================== +radioco.apps.global\_settings package +===================================== Subpackages ----------- @@ -12,16 +12,16 @@ Subpackages Submodules ---------- -radioco.apps.global_settings.admin module ------------------------------------------ +radioco.apps.global\_settings.admin module +------------------------------------------ .. automodule:: radioco.apps.global_settings.admin :members: :undoc-members: :show-inheritance: -radioco.apps.global_settings.models module ------------------------------------------- +radioco.apps.global\_settings.models module +------------------------------------------- .. automodule:: radioco.apps.global_settings.models :members: diff --git a/docs/source/source_code/radioco.apps.global_settings.templatetags.rst b/docs/source/source_code/radioco.apps.global_settings.templatetags.rst index 5637501..af6628e 100644 --- a/docs/source/source_code/radioco.apps.global_settings.templatetags.rst +++ b/docs/source/source_code/radioco.apps.global_settings.templatetags.rst @@ -1,11 +1,11 @@ -radioco.apps.global_settings.templatetags package -================================================= +radioco.apps.global\_settings.templatetags package +================================================== Submodules ---------- -radioco.apps.global_settings.templatetags.global_settings_extras module ------------------------------------------------------------------------ +radioco.apps.global\_settings.templatetags.global\_settings\_extras module +-------------------------------------------------------------------------- .. automodule:: radioco.apps.global_settings.templatetags.global_settings_extras :members: diff --git a/docs/source/source_code/radioco.apps.programmes.migrations.rst b/docs/source/source_code/radioco.apps.programmes.migrations.rst index a5091b1..5c3598c 100644 --- a/docs/source/source_code/radioco.apps.programmes.migrations.rst +++ b/docs/source/source_code/radioco.apps.programmes.migrations.rst @@ -4,88 +4,88 @@ radioco.apps.programmes.migrations package Submodules ---------- -radioco.apps.programmes.migrations.0001_initial module ------------------------------------------------------- +radioco.apps.programmes.migrations.0001\_initial module +------------------------------------------------------- .. automodule:: radioco.apps.programmes.migrations.0001_initial :members: :undoc-members: :show-inheritance: -radioco.apps.programmes.migrations.0002_change_language_choices module ----------------------------------------------------------------------- +radioco.apps.programmes.migrations.0002\_change\_language\_choices module +------------------------------------------------------------------------- .. automodule:: radioco.apps.programmes.migrations.0002_change_language_choices :members: :undoc-members: :show-inheritance: -radioco.apps.programmes.migrations.0003_change_textfield_to_richtextfield module --------------------------------------------------------------------------------- +radioco.apps.programmes.migrations.0003\_change\_textfield\_to\_richtextfield module +------------------------------------------------------------------------------------ .. automodule:: radioco.apps.programmes.migrations.0003_change_textfield_to_richtextfield :members: :undoc-members: :show-inheritance: -radioco.apps.programmes.migrations.0004_change_photo_url module ---------------------------------------------------------------- +radioco.apps.programmes.migrations.0004\_change\_photo\_url module +------------------------------------------------------------------ .. automodule:: radioco.apps.programmes.migrations.0004_change_photo_url :members: :undoc-members: :show-inheritance: -radioco.apps.programmes.migrations.0005_auto_20150531_1734 module ------------------------------------------------------------------ +radioco.apps.programmes.migrations.0005\_auto\_20150531\_1734 module +-------------------------------------------------------------------- .. automodule:: radioco.apps.programmes.migrations.0005_auto_20150531_1734 :members: :undoc-members: :show-inheritance: -radioco.apps.programmes.migrations.0006_auto_20160104_2029 module ------------------------------------------------------------------ +radioco.apps.programmes.migrations.0006\_auto\_20160104\_2029 module +-------------------------------------------------------------------- .. automodule:: radioco.apps.programmes.migrations.0006_auto_20160104_2029 :members: :undoc-members: :show-inheritance: -radioco.apps.programmes.migrations.0007_change_default_image module -------------------------------------------------------------------- +radioco.apps.programmes.migrations.0007\_change\_default\_image module +---------------------------------------------------------------------- .. automodule:: radioco.apps.programmes.migrations.0007_change_default_image :members: :undoc-members: :show-inheritance: -radioco.apps.programmes.migrations.0008_auto_20160116_1509 module ------------------------------------------------------------------ +radioco.apps.programmes.migrations.0008\_auto\_20160116\_1509 module +-------------------------------------------------------------------- .. automodule:: radioco.apps.programmes.migrations.0008_auto_20160116_1509 :members: :undoc-members: :show-inheritance: -radioco.apps.programmes.migrations.0009__v3_0__small_tweaks module ------------------------------------------------------------------- +radioco.apps.programmes.migrations.0009\_\_v3\_0\_\_small\_tweaks module +------------------------------------------------------------------------ .. automodule:: radioco.apps.programmes.migrations.0009__v3_0__small_tweaks :members: :undoc-members: :show-inheritance: -radioco.apps.programmes.migrations.0010__v3_2__convert_role module ------------------------------------------------------------------- +radioco.apps.programmes.migrations.0010\_\_v3\_2\_\_convert\_role module +------------------------------------------------------------------------ .. automodule:: radioco.apps.programmes.migrations.0010__v3_2__convert_role :members: :undoc-members: :show-inheritance: -radioco.apps.programmes.migrations.0011__v3_2__ensure_one_user_role module --------------------------------------------------------------------------- +radioco.apps.programmes.migrations.0011\_\_v3\_2\_\_ensure\_one\_user\_role module +---------------------------------------------------------------------------------- .. automodule:: radioco.apps.programmes.migrations.0011__v3_2__ensure_one_user_role :members: diff --git a/docs/source/source_code/radioco.apps.programmes.tests.rst b/docs/source/source_code/radioco.apps.programmes.tests.rst new file mode 100644 index 0000000..364ac12 --- /dev/null +++ b/docs/source/source_code/radioco.apps.programmes.tests.rst @@ -0,0 +1,30 @@ +radioco.apps.programmes.tests package +===================================== + +Submodules +---------- + +radioco.apps.programmes.tests.test\_feed module +----------------------------------------------- + +.. automodule:: radioco.apps.programmes.tests.test_feed + :members: + :undoc-members: + :show-inheritance: + +radioco.apps.programmes.tests.test\_models module +------------------------------------------------- + +.. automodule:: radioco.apps.programmes.tests.test_models + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: radioco.apps.programmes.tests + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/source_code/radioco.apps.radio.management.commands.rst b/docs/source/source_code/radioco.apps.radio.management.commands.rst deleted file mode 100644 index 696154e..0000000 --- a/docs/source/source_code/radioco.apps.radio.management.commands.rst +++ /dev/null @@ -1,22 +0,0 @@ -radioco.apps.radio.management.commands package -============================================== - -Submodules ----------- - -radioco.apps.radio.management.commands.create_example_data module ------------------------------------------------------------------ - -.. automodule:: radioco.apps.radio.management.commands.create_example_data - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: radioco.apps.radio.management.commands - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/source_code/radioco.apps.radio.management.rst b/docs/source/source_code/radioco.apps.radio.management.rst deleted file mode 100644 index cb4fc7c..0000000 --- a/docs/source/source_code/radioco.apps.radio.management.rst +++ /dev/null @@ -1,17 +0,0 @@ -radioco.apps.radio.management package -===================================== - -Subpackages ------------ - -.. toctree:: - - radioco.apps.radio.management.commands - -Module contents ---------------- - -.. automodule:: radioco.apps.radio.management - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/source_code/radioco.apps.radio.rst b/docs/source/source_code/radioco.apps.radio.rst deleted file mode 100644 index 8a932fe..0000000 --- a/docs/source/source_code/radioco.apps.radio.rst +++ /dev/null @@ -1,69 +0,0 @@ -radioco.apps.radio package -========================== - -Subpackages ------------ - -.. toctree:: - - radioco.apps.radio.management - -Submodules ----------- - -radioco.apps.radio.context_processors module --------------------------------------------- - -.. automodule:: radioco.apps.radio.context_processors - :members: - :undoc-members: - :show-inheritance: - -radioco.apps.radio.forms module -------------------------------- - -.. automodule:: radioco.apps.radio.forms - :members: - :undoc-members: - :show-inheritance: - -radioco.apps.radio.tests module -------------------------------- - -.. automodule:: radioco.apps.radio.tests - :members: - :undoc-members: - :show-inheritance: - -radioco.apps.radio.tz_utils module ----------------------------------- - -.. automodule:: radioco.apps.radio.tz_utils - :members: - :undoc-members: - :show-inheritance: - -radioco.apps.radio.utils module -------------------------------- - -.. automodule:: radioco.apps.radio.utils - :members: - :undoc-members: - :show-inheritance: - -radioco.apps.radio.views module -------------------------------- - -.. automodule:: radioco.apps.radio.views - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: radioco.apps.radio - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/source_code/radioco.apps.radioco.management.commands.rst b/docs/source/source_code/radioco.apps.radioco.management.commands.rst index 827c063..c686559 100644 --- a/docs/source/source_code/radioco.apps.radioco.management.commands.rst +++ b/docs/source/source_code/radioco.apps.radioco.management.commands.rst @@ -4,8 +4,8 @@ radioco.apps.radioco.management.commands package Submodules ---------- -radioco.apps.radioco.management.commands.create_example_data module -------------------------------------------------------------------- +radioco.apps.radioco.management.commands.create\_example\_data module +--------------------------------------------------------------------- .. automodule:: radioco.apps.radioco.management.commands.create_example_data :members: diff --git a/docs/source/source_code/radioco.apps.radioco.migrations.rst b/docs/source/source_code/radioco.apps.radioco.migrations.rst index ebcb934..9780105 100644 --- a/docs/source/source_code/radioco.apps.radioco.migrations.rst +++ b/docs/source/source_code/radioco.apps.radioco.migrations.rst @@ -4,8 +4,8 @@ radioco.apps.radioco.migrations package Submodules ---------- -radioco.apps.radioco.migrations.0001__v3_0__mysql_timezone module ------------------------------------------------------------------ +radioco.apps.radioco.migrations.0001\_\_v3\_0\_\_mysql\_timezone module +----------------------------------------------------------------------- .. automodule:: radioco.apps.radioco.migrations.0001__v3_0__mysql_timezone :members: diff --git a/docs/source/source_code/radioco.apps.radioco.rst b/docs/source/source_code/radioco.apps.radioco.rst index 7ab6854..faab897 100644 --- a/docs/source/source_code/radioco.apps.radioco.rst +++ b/docs/source/source_code/radioco.apps.radioco.rst @@ -13,24 +13,24 @@ Subpackages Submodules ---------- -radioco.apps.radioco.context_processors module ----------------------------------------------- +radioco.apps.radioco.context\_processors module +----------------------------------------------- .. automodule:: radioco.apps.radioco.context_processors :members: :undoc-members: :show-inheritance: -radioco.apps.radioco.test_utils module --------------------------------------- +radioco.apps.radioco.test\_utils module +--------------------------------------- .. automodule:: radioco.apps.radioco.test_utils :members: :undoc-members: :show-inheritance: -radioco.apps.radioco.tz_utils module ------------------------------------- +radioco.apps.radioco.tz\_utils module +------------------------------------- .. automodule:: radioco.apps.radioco.tz_utils :members: diff --git a/docs/source/source_code/radioco.apps.schedules.migrations.rst b/docs/source/source_code/radioco.apps.schedules.migrations.rst index 06ccdac..62fadca 100644 --- a/docs/source/source_code/radioco.apps.schedules.migrations.rst +++ b/docs/source/source_code/radioco.apps.schedules.migrations.rst @@ -4,40 +4,40 @@ radioco.apps.schedules.migrations package Submodules ---------- -radioco.apps.schedules.migrations.0001_initial module ------------------------------------------------------ +radioco.apps.schedules.migrations.0001\_initial module +------------------------------------------------------ .. automodule:: radioco.apps.schedules.migrations.0001_initial :members: :undoc-members: :show-inheritance: -radioco.apps.schedules.migrations.0002__v3_0__renaming_calendar_model module ----------------------------------------------------------------------------- +radioco.apps.schedules.migrations.0002\_\_v3\_0\_\_renaming\_calendar\_model module +----------------------------------------------------------------------------------- .. automodule:: radioco.apps.schedules.migrations.0002__v3_0__renaming_calendar_model :members: :undoc-members: :show-inheritance: -radioco.apps.schedules.migrations.0003__v3_0__create_excludeddates_model module -------------------------------------------------------------------------------- +radioco.apps.schedules.migrations.0003\_\_v3\_0\_\_create\_excludeddates\_model module +-------------------------------------------------------------------------------------- .. automodule:: radioco.apps.schedules.migrations.0003__v3_0__create_excludeddates_model :members: :undoc-members: :show-inheritance: -radioco.apps.schedules.migrations.0004__v3_0__adding_rrules module ------------------------------------------------------------------- +radioco.apps.schedules.migrations.0004\_\_v3\_0\_\_adding\_rrules module +------------------------------------------------------------------------ .. automodule:: radioco.apps.schedules.migrations.0004__v3_0__adding_rrules :members: :undoc-members: :show-inheritance: -radioco.apps.schedules.migrations.0005__v3_0__migrating_schedules_to_unique_calendar module -------------------------------------------------------------------------------------------- +radioco.apps.schedules.migrations.0005\_\_v3\_0\_\_migrating\_schedules\_to\_unique\_calendar module +---------------------------------------------------------------------------------------------------- .. automodule:: radioco.apps.schedules.migrations.0005__v3_0__migrating_schedules_to_unique_calendar :members: diff --git a/docs/source/source_code/radioco.apps.schedules.tests.rst b/docs/source/source_code/radioco.apps.schedules.tests.rst index 75c4263..2250881 100644 --- a/docs/source/source_code/radioco.apps.schedules.tests.rst +++ b/docs/source/source_code/radioco.apps.schedules.tests.rst @@ -4,24 +4,24 @@ radioco.apps.schedules.tests package Submodules ---------- -radioco.apps.schedules.tests.test_recurrences module ----------------------------------------------------- +radioco.apps.schedules.tests.test\_recurrences module +----------------------------------------------------- .. automodule:: radioco.apps.schedules.tests.test_recurrences :members: :undoc-members: :show-inheritance: -radioco.apps.schedules.tests.test_schedules module --------------------------------------------------- +radioco.apps.schedules.tests.test\_schedules module +--------------------------------------------------- .. automodule:: radioco.apps.schedules.tests.test_schedules :members: :undoc-members: :show-inheritance: -radioco.apps.schedules.tests.test_timezone module -------------------------------------------------- +radioco.apps.schedules.tests.test\_timezone module +-------------------------------------------------- .. automodule:: radioco.apps.schedules.tests.test_timezone :members: diff --git a/docs/source/source_code/radioco.apps.users.migrations.rst b/docs/source/source_code/radioco.apps.users.migrations.rst index c54886a..da5f54d 100644 --- a/docs/source/source_code/radioco.apps.users.migrations.rst +++ b/docs/source/source_code/radioco.apps.users.migrations.rst @@ -4,32 +4,32 @@ radioco.apps.users.migrations package Submodules ---------- -radioco.apps.users.migrations.0001_initial module -------------------------------------------------- +radioco.apps.users.migrations.0001\_initial module +-------------------------------------------------- .. automodule:: radioco.apps.users.migrations.0001_initial :members: :undoc-members: :show-inheritance: -radioco.apps.users.migrations.0002_change_textfield_to_richtextfield module ---------------------------------------------------------------------------- +radioco.apps.users.migrations.0002\_change\_textfield\_to\_richtextfield module +------------------------------------------------------------------------------- .. automodule:: radioco.apps.users.migrations.0002_change_textfield_to_richtextfield :members: :undoc-members: :show-inheritance: -radioco.apps.users.migrations.0003_auto_20160104_2029 module ------------------------------------------------------------- +radioco.apps.users.migrations.0003\_auto\_20160104\_2029 module +--------------------------------------------------------------- .. automodule:: radioco.apps.users.migrations.0003_auto_20160104_2029 :members: :undoc-members: :show-inheritance: -radioco.apps.users.migrations.0004__v3_0__ckeditor_upload_field module ----------------------------------------------------------------------- +radioco.apps.users.migrations.0004\_\_v3\_0\_\_ckeditor\_upload\_field module +----------------------------------------------------------------------------- .. automodule:: radioco.apps.users.migrations.0004__v3_0__ckeditor_upload_field :members: diff --git a/docs/source/source_code/radioco.configs.base.rst b/docs/source/source_code/radioco.configs.base.rst index 20e21ac..456bf6b 100644 --- a/docs/source/source_code/radioco.configs.base.rst +++ b/docs/source/source_code/radioco.configs.base.rst @@ -4,14 +4,6 @@ radioco.configs.base package Submodules ---------- -radioco.configs.base.manage module ----------------------------------- - -.. automodule:: radioco.configs.base.manage - :members: - :undoc-members: - :show-inheritance: - radioco.configs.base.settings module ------------------------------------ @@ -20,8 +12,8 @@ radioco.configs.base.settings module :undoc-members: :show-inheritance: -radioco.configs.base.test_runner module ---------------------------------------- +radioco.configs.base.test\_runner module +---------------------------------------- .. automodule:: radioco.configs.base.test_runner :members: @@ -36,6 +28,14 @@ radioco.configs.base.urls module :undoc-members: :show-inheritance: +radioco.configs.base.wsgi module +-------------------------------- + +.. automodule:: radioco.configs.base.wsgi + :members: + :undoc-members: + :show-inheritance: + Module contents --------------- diff --git a/docs/source/source_code/radioco.configs.development.rst b/docs/source/source_code/radioco.configs.development.rst deleted file mode 100644 index 18ec76e..0000000 --- a/docs/source/source_code/radioco.configs.development.rst +++ /dev/null @@ -1,30 +0,0 @@ -radioco.configs.development package -=================================== - -Submodules ----------- - -radioco.configs.development.manage module ------------------------------------------ - -.. automodule:: radioco.configs.development.manage - :members: - :undoc-members: - :show-inheritance: - -radioco.configs.development.settings module -------------------------------------------- - -.. automodule:: radioco.configs.development.settings - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: radioco.configs.development - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/source_code/radioco.configs.heroku.rst b/docs/source/source_code/radioco.configs.heroku.rst deleted file mode 100644 index a96a0cd..0000000 --- a/docs/source/source_code/radioco.configs.heroku.rst +++ /dev/null @@ -1,38 +0,0 @@ -radioco.configs.heroku package -============================== - -Submodules ----------- - -radioco.configs.heroku.manage module ------------------------------------- - -.. automodule:: radioco.configs.heroku.manage - :members: - :undoc-members: - :show-inheritance: - -radioco.configs.heroku.settings module --------------------------------------- - -.. automodule:: radioco.configs.heroku.settings - :members: - :undoc-members: - :show-inheritance: - -radioco.configs.heroku.wsgi module ----------------------------------- - -.. automodule:: radioco.configs.heroku.wsgi - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: radioco.configs.heroku - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/source_code/radioco.configs.openshift.rst b/docs/source/source_code/radioco.configs.openshift.rst deleted file mode 100644 index 23147c4..0000000 --- a/docs/source/source_code/radioco.configs.openshift.rst +++ /dev/null @@ -1,22 +0,0 @@ -radioco.configs.openshift package -================================= - -Submodules ----------- - -radioco.configs.openshift.settings module ------------------------------------------ - -.. automodule:: radioco.configs.openshift.settings - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: radioco.configs.openshift - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/source_code/radioco.configs.rst b/docs/source/source_code/radioco.configs.rst index 786ba0f..6a797d8 100644 --- a/docs/source/source_code/radioco.configs.rst +++ b/docs/source/source_code/radioco.configs.rst @@ -7,9 +7,6 @@ Subpackages .. toctree:: radioco.configs.base - radioco.configs.development - radioco.configs.heroku - radioco.configs.staging Module contents --------------- diff --git a/docs/source/source_code/radioco.configs.staging.rst b/docs/source/source_code/radioco.configs.staging.rst deleted file mode 100644 index 00a0189..0000000 --- a/docs/source/source_code/radioco.configs.staging.rst +++ /dev/null @@ -1,38 +0,0 @@ -radioco.configs.staging package -=============================== - -Submodules ----------- - -radioco.configs.staging.manage module -------------------------------------- - -.. automodule:: radioco.configs.staging.manage - :members: - :undoc-members: - :show-inheritance: - -radioco.configs.staging.settings module ---------------------------------------- - -.. automodule:: radioco.configs.staging.settings - :members: - :undoc-members: - :show-inheritance: - -radioco.configs.staging.wsgi module ------------------------------------ - -.. automodule:: radioco.configs.staging.wsgi - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: radioco.configs.staging - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/source_code/setup.rst b/docs/source/source_code/setup.rst deleted file mode 100644 index 31789b1..0000000 --- a/docs/source/source_code/setup.rst +++ /dev/null @@ -1,7 +0,0 @@ -setup module -============ - -.. automodule:: setup - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/source_code/tasks.rst b/docs/source/source_code/tasks.rst index e834871..e9a85a3 100644 --- a/docs/source/source_code/tasks.rst +++ b/docs/source/source_code/tasks.rst @@ -4,14 +4,6 @@ tasks package Submodules ---------- -tasks.docker module -------------------- - -.. automodule:: tasks.docker - :members: - :undoc-members: - :show-inheritance: - tasks.docs module ----------------- @@ -20,14 +12,6 @@ tasks.docs module :undoc-members: :show-inheritance: -tasks.heroku module -------------------- - -.. automodule:: tasks.heroku - :members: - :undoc-members: - :show-inheritance: - tasks.locale module ------------------- @@ -36,22 +20,6 @@ tasks.locale module :undoc-members: :show-inheritance: -tasks.radioco module --------------------- - -.. automodule:: tasks.radioco - :members: - :undoc-members: - :show-inheritance: - -tasks.utils module ------------------- - -.. automodule:: tasks.utils - :members: - :undoc-members: - :show-inheritance: - Module contents --------------- diff --git a/docs/source/upgrade/4.0.rst b/docs/source/upgrade/4.0.rst new file mode 100755 index 0000000..56fe6ba --- /dev/null +++ b/docs/source/upgrade/4.0.rst @@ -0,0 +1,39 @@ +################# +4.0 release notes +################# + +***************** +What's new in 4.0 +***************** + +* Fix django-filebrowser (downgraded version) and ckeditor_uploader +* Simplifying config. +* Updating requirements. +* Upgrading to python3.6 + + +******************** +How this affects you +******************** + +If you’re starting with a new installation, you don’t need to worry about this. +Don’t even bother reading this section; it’s for upgraders. + +You need to replace your current source with the content of https://github.com/iago1460/django-radio. +To setup your settings please read the configuration section. + +You should be able to keep your current database but make sure to create a backup before start. + +Running this project requires **python 3.6** + +.. code-block:: bash + + pip3 install -r requirements.txt + python3 manage.py collectstatic + + +Or if you are using our docker setup: + +.. code-block:: bash + + ./run start diff --git a/docs/source/upgrade/index.rst b/docs/source/upgrade/index.rst index b08675f..305b304 100755 --- a/docs/source/upgrade/index.rst +++ b/docs/source/upgrade/index.rst @@ -22,3 +22,4 @@ on any process that makes changes to your database. 3.2 3.2.1 3.2.2 + 4.0 diff --git a/node_modules/.gitkeep b/node_modules/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/radioco/__init__.py b/radioco/__init__.py index 90c82fb..4dbcf9a 100755 --- a/radioco/__init__.py +++ b/radioco/__init__.py @@ -15,4 +15,4 @@ # along with this program. If not, see . -__version__ = '3.2.2' +__version__ = '4.0' diff --git a/radioco/apps/api/serializers.py b/radioco/apps/api/serializers.py index 42dfbd0..043959d 100644 --- a/radioco/apps/api/serializers.py +++ b/radioco/apps/api/serializers.py @@ -141,7 +141,7 @@ class RadiocomConfigurationSerializer(serializers.ModelSerializer): twitter_url = serializers.SerializerMethodField() def get_station_photos(self, obj): - return filter(lambda x: bool(x), [image_url.strip() for image_url in obj.station_photos.split(',')]) + return [x for x in [image_url.strip() for image_url in obj.station_photos.split(',')] if bool(x)] def get_facebook_url(self, obj): return SiteConfiguration.get_global().facebook_address diff --git a/radioco/apps/api/tests/test_api.py b/radioco/apps/api/tests/test_api.py index c8349e1..e928936 100644 --- a/radioco/apps/api/tests/test_api.py +++ b/radioco/apps/api/tests/test_api.py @@ -26,7 +26,7 @@ def test_programme(self): context=MOCK_CONTEXT ) self.assertListEqual( - serializer.data.keys(), + list(serializer.data.keys()), ['id', 'slug', 'name', 'synopsis', 'runtime', 'photo_url', 'rss_url', 'language', 'category']) def test_programme_photo_url(self): @@ -41,7 +41,7 @@ def test_programme_photo_url(self): def test_episode(self): serializer = serializers.EpisodeSerializer(self.episode) self.assertListEqual( - serializer.data.keys(), + list(serializer.data.keys()), ['title', 'programme', 'summary', 'issue_date', 'season', 'number_in_season']) def test_episode_programme(self): @@ -53,14 +53,14 @@ def test_schedule(self): schedule_id = self.schedule.id calendar_id = self.calendar.id self.assertDictEqual(serializer.data, { - 'title': u'Classic hits', + 'title': 'Classic hits', 'source': None, 'start': '2015-01-01T14:00:00Z', 'calendar': calendar_id, 'runtime': datetime.timedelta(minutes=60), 'type': 'L', 'id': schedule_id, - 'programme': u'classic-hits'}) + 'programme': 'classic-hits'}) def test_transmission(self): serializer = serializers.TransmissionSerializer( @@ -75,12 +75,12 @@ def test_transmission(self): 'programme': self.schedule.programme.id, 'episode': None, 'source': None, - 'type': u'L', + 'type': 'L', 'start': '2015-01-06T14:00:00Z', 'end': '2015-01-06T15:00:00Z', - 'name': u'Classic hits', - 'slug': u'classic-hits', - 'programme_url': u'http://testserver/programmes/classic-hits/', + 'name': 'Classic hits', + 'slug': 'classic-hits', + 'programme_url': 'http://testserver/programmes/classic-hits/', 'episode_url': None, } ) \ No newline at end of file diff --git a/radioco/apps/api/tests/test_fullcalendar.py b/radioco/apps/api/tests/test_fullcalendar.py index b11d90f..197c7f3 100644 --- a/radioco/apps/api/tests/test_fullcalendar.py +++ b/radioco/apps/api/tests/test_fullcalendar.py @@ -49,12 +49,12 @@ def test_schedules_post(self): response = self.client.post('/api/2/schedules', data=self._get_schedule_data()) self.assertEqual(response.status_code, status.HTTP_201_CREATED) - self.assertEquals( + self.assertEqual( {key: response.data[key] for key in response.data if key not in ['id']}, { 'start': '2016-11-17T01:00:00Z', - 'title': u'Classic hits', 'source': None, 'calendar': self.calendar.id, - 'runtime': datetime.timedelta(0, 3600), 'type': 'L', 'programme': u'classic-hits' + 'title': 'Classic hits', 'source': None, 'calendar': self.calendar.id, + 'runtime': datetime.timedelta(0, 3600), 'type': 'L', 'programme': 'classic-hits' }) @override_settings(TIME_ZONE='Europe/Madrid') @@ -63,12 +63,12 @@ def test_schedules_post_in_tz(self): response = self.client.post('/api/2/schedules', data=self._get_schedule_data()) self.assertEqual(response.status_code, status.HTTP_201_CREATED) - self.assertEquals( + self.assertEqual( {key: response.data[key] for key in response.data if key not in ['id']}, { 'start': '2016-11-17T01:00:00+01:00', # Returns the date in the default tz - 'title': u'Classic hits', 'source': None, 'calendar': self.calendar.id, - 'runtime': datetime.timedelta(0, 3600), 'type': 'L', 'programme': u'classic-hits' + 'title': 'Classic hits', 'source': None, 'calendar': self.calendar.id, + 'runtime': datetime.timedelta(0, 3600), 'type': 'L', 'programme': 'classic-hits' }) @override_settings(TIME_ZONE='UTC') @@ -85,7 +85,7 @@ def test_move_schedule(self): ) self.assertEqual(response.status_code, status.HTTP_200_OK) new_schedule.refresh_from_db() - self.assertEquals(new_schedule.start_dt, pytz.utc.localize(datetime.datetime(2015, 1, 1, 20, 30, 0))) + self.assertEqual(new_schedule.start_dt, pytz.utc.localize(datetime.datetime(2015, 1, 1, 20, 30, 0))) @override_settings(TIME_ZONE='Europe/Madrid') def test_move_schedule_in_tz(self): @@ -101,7 +101,7 @@ def test_move_schedule_in_tz(self): ) self.assertEqual(response.status_code, status.HTTP_200_OK) new_schedule.refresh_from_db() - self.assertEquals(new_schedule.start_dt, SPAIN_TZ.localize(datetime.datetime(2015, 1, 1, 20, 30, 0))) + self.assertEqual(new_schedule.start_dt, SPAIN_TZ.localize(datetime.datetime(2015, 1, 1, 20, 30, 0))) @override_settings(TIME_ZONE='UTC') def test_move_schedule_with_schedules(self): @@ -121,8 +121,8 @@ def test_move_schedule_with_schedules(self): start_dt = pytz.utc.localize(datetime.datetime(2015, 1, 1, 18, 30, 0)) new_start_dt = pytz.utc.localize(datetime.datetime(2015, 1, 1, 20, 30, 0)) - self.assertEquals(schedule.start_dt, start_dt) # Original shouldn't change - self.assertEquals(schedule.recurrences.exdates[0], start_dt) # But should be excluded + self.assertEqual(schedule.start_dt, start_dt) # Original shouldn't change + self.assertEqual(schedule.recurrences.exdates[0], start_dt) # But should be excluded self.assertIsNotNone(ExcludedDates.objects.get(schedule=schedule, datetime=start_dt)) # Exclude that date new_schedule = Schedule.objects.get(programme=schedule.programme, start_dt=new_start_dt) @@ -170,8 +170,8 @@ def test_move_schedule_with_schedules_in_tz(self): start_dt = pytz.utc.localize(datetime.datetime(2015, 1, 1, 18, 30, 0)) new_start_dt = SPAIN_TZ.localize(datetime.datetime(2015, 1, 1, 20, 30, 0)) - self.assertEquals(schedule.start_dt, start_dt) # Original shouldn't change - self.assertEquals(schedule.recurrences.exdates[0], start_dt) # But should be excluded + self.assertEqual(schedule.start_dt, start_dt) # Original shouldn't change + self.assertEqual(schedule.recurrences.exdates[0], start_dt) # But should be excluded self.assertIsNotNone(ExcludedDates.objects.get(schedule=schedule, datetime=start_dt)) # Exclude that date new_schedule = Schedule.objects.get(programme=schedule.programme, start_dt=new_start_dt) diff --git a/radioco/apps/api/tests/test_programmes.py b/radioco/apps/api/tests/test_programmes.py index ac89e39..e328331 100644 --- a/radioco/apps/api/tests/test_programmes.py +++ b/radioco/apps/api/tests/test_programmes.py @@ -28,8 +28,8 @@ def test_programmes_get_all(self): 'id': self.summer_programme.id, 'language': 'en', 'name': 'Summer Programme', - 'photo_url': u'http://testserver/media/defaults/default-programme-photo.jpg', - 'rss_url': u'http://testserver/programmes/summer-programme/rss/', + 'photo_url': 'http://testserver/media/defaults/default-programme-photo.jpg', + 'rss_url': 'http://testserver/programmes/summer-programme/rss/', 'runtime': '01:00:00', 'slug': 'summer-programme', 'synopsis': '' @@ -42,14 +42,14 @@ def test_programmes_before(self): { 'before': datetime.date(2015, 6, 1), }) - self.assertIn(u'summer-programme', map(lambda t: t['slug'], response.data)) + self.assertIn('summer-programme', [t['slug'] for t in response.data]) response = self.client.get( '/api/2/programmes', { 'before': datetime.date(2015, 5, 30), }) - self.assertNotIn(u'summer-programme', map(lambda t: t['slug'], response.data)) + self.assertNotIn('summer-programme', [t['slug'] for t in response.data]) def test_programmes_after(self): response = self.client.get( @@ -57,14 +57,14 @@ def test_programmes_after(self): { 'after': datetime.date(2015, 8, 31), }) - self.assertIn(u'summer-programme', map(lambda t: t['slug'], response.data)) + self.assertIn('summer-programme', [t['slug'] for t in response.data]) response = self.client.get( '/api/2/programmes', { 'after': datetime.date(2015, 9, 1), }) - self.assertNotIn(u'summer-programme', map(lambda t: t['slug'], response.data)) + self.assertNotIn('summer-programme', [t['slug'] for t in response.data]) def test_programmes_between(self): response = self.client.get( @@ -73,7 +73,7 @@ def test_programmes_between(self): 'after': datetime.date(2015, 1, 1), 'before': datetime.date(2015, 12, 31), }) - self.assertIn(u'summer-programme', map(lambda t: t['slug'], response.data)) + self.assertIn('summer-programme', [t['slug'] for t in response.data]) response = self.client.get( '/api/2/programmes', @@ -81,7 +81,7 @@ def test_programmes_between(self): 'after': datetime.date(2015, 1, 1), 'before': datetime.date(2015, 5, 30), }) - self.assertNotIn(u'summer-programme', map(lambda t: t['slug'], response.data)) + self.assertNotIn('summer-programme', [t['slug'] for t in response.data]) def test_episodes_get_all(self): response = self.client.get('/api/2/episodes') diff --git a/radioco/apps/api/tests/test_recorder.py b/radioco/apps/api/tests/test_recorder.py index c43ef21..7dcb8a7 100644 --- a/radioco/apps/api/tests/test_recorder.py +++ b/radioco/apps/api/tests/test_recorder.py @@ -18,7 +18,7 @@ class PodcastMock(): @classmethod def _get_podcast_config_mock(cls): podcast_config = PodcastConfiguration() - podcast_config.url_source = u'' + podcast_config.url_source = '' podcast_config.start_delay = 20 podcast_config.end_delay = 10 podcast_config.next_events = 48 @@ -37,12 +37,12 @@ def setUpTestData(cls): cls.recorder_programme, created = Programme.objects.get_or_create( name='Recorder me', defaults={ - u'synopsis': u'synopsis', - u'language': u'en', - u'photo': u'defaults/example/radio_5.jpg', - u'current_season': 3, - u'category': u'News & Politics', - u'_runtime': 60 + 'synopsis': 'synopsis', + 'language': 'en', + 'photo': 'defaults/example/radio_5.jpg', + 'current_season': 3, + 'category': 'News & Politics', + '_runtime': 60 } ) cls.recorder_schedule, created = Schedule.objects.get_or_create( @@ -75,31 +75,31 @@ def _login(self): @mock.patch('radioco.apps.global_settings.models.PodcastConfiguration.get_global', PodcastMock._get_podcast_config_mock) def test_recording_schedules(self): self._login() - self.assertEquals(Episode.objects.count(), 1) + self.assertEqual(Episode.objects.count(), 1) response = self.client.get( - u'/api/1/recording_schedules/', + '/api/1/recording_schedules/', { - u'start': u'2015-01-01 00:00:00', - u'next_hours': 24 + 15 + 'start': '2015-01-01 00:00:00', + 'next_hours': 24 + 15 }, HTTP_AUTHORIZATION='Token {token}'.format(token=PodcastConfiguration.get_global().recorder_token) ) self.assertEqual(response.status_code, status.HTTP_200_OK) - self.assertEquals(Episode.objects.count(), 2) - self.assertEquals( + self.assertEqual(Episode.objects.count(), 2) + self.assertEqual( json.loads(response.content), [ { - u'id': self.recorder_programme.id, u'issue_date': u'2015-01-01 15-00-00', u'start': u'2015-01-01 15-00-20', - u'duration': u'3570', u'genre': u'News & Politics', - u'title': u'Episode 2x1', u'programme_name': u'recorder-me', u'author': u'Recorder me', - u'album': u'Season 2', u'track': 1 + 'id': self.recorder_programme.id, 'issue_date': '2015-01-01 15-00-00', 'start': '2015-01-01 15-00-20', + 'duration': '3570', 'genre': 'News & Politics', + 'title': 'Episode 2x1', 'programme_name': 'recorder-me', 'author': 'Recorder me', + 'album': 'Season 2', 'track': 1 }, { - u'id': self.recorder_programme.id, u'issue_date': u'2015-01-02 15-00-00', u'start': u'2015-01-02 15-00-20', - u'duration': u'3570', u'genre': u'News & Politics', - u'title': None, u'programme_name': u'recorder-me', u'author': u'Recorder me', - u'album': u'Season 3', u'track': 1 + 'id': self.recorder_programme.id, 'issue_date': '2015-01-02 15-00-00', 'start': '2015-01-02 15-00-20', + 'duration': '3570', 'genre': 'News & Politics', + 'title': None, 'programme_name': 'recorder-me', 'author': 'Recorder me', + 'album': 'Season 3', 'track': 1 }, ] ) @@ -108,15 +108,15 @@ def test_recording_schedules(self): def test_submit_recorder(self): self._login() podcast_data = { - u'programme_id': self.recorder_programme.id, - u'date': u'2015-01-02 15-00-00', - u'file_name': u'show.mp3', - u'mime_type': u'audio/mp3', - u'length': 0, - u'duration': 666, + 'programme_id': self.recorder_programme.id, + 'date': '2015-01-02 15-00-00', + 'file_name': 'show.mp3', + 'mime_type': 'audio/mp3', + 'length': 0, + 'duration': 666, } response = self.client.get( - u'/api/1/submit_recorder/', + '/api/1/submit_recorder/', podcast_data, HTTP_AUTHORIZATION='Token {token}'.format(token=PodcastConfiguration.get_global().recorder_token) ) @@ -129,11 +129,11 @@ def test_submit_recorder(self): expected_info = { 'url': PodcastConfiguration.get_global().url_source + podcast_data['file_name'], 'duration': self.recorder_programme._runtime, - 'mime_type': u'audio/mp3', + 'mime_type': 'audio/mp3', 'length': 0, 'episode': episode } - self.assertEquals( + self.assertEqual( expected_info, - {_key: getattr(episode.podcast, _key) for _key in expected_info.keys()} + {_key: getattr(episode.podcast, _key) for _key in list(expected_info.keys())} ) diff --git a/radioco/apps/api/tests/test_schedules.py b/radioco/apps/api/tests/test_schedules.py index 7baeb72..7c48e3b 100644 --- a/radioco/apps/api/tests/test_schedules.py +++ b/radioco/apps/api/tests/test_schedules.py @@ -90,11 +90,11 @@ def test_transmissions_between_requesting_tz(self): self.assertEqual( {_key: response.data[0][_key] for _key in response.data[0] if _key not in ['schedule', 'programme', 'id']}, { - 'end': '2015-02-01T10:00:00+01:00', 'name': u'Morning News', - 'programme_url': u'http://testserver/programmes/morning-news/', + 'end': '2015-02-01T10:00:00+01:00', 'name': 'Morning News', + 'programme_url': 'http://testserver/programmes/morning-news/', 'episode_url': None, 'episode': None, 'start': '2015-02-01T09:00:00+01:00', 'source': None, - 'type': u'L', 'slug': u'morning-news' + 'type': 'L', 'slug': 'morning-news' } ) @@ -129,7 +129,7 @@ def test_transmission_list_filter_non_active_calendar(self): }) self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertListEqual( - map(lambda t: (t['slug'], t['start']), response.data), + [(t['slug'], t['start']) for t in response.data], [('classic-hits', '2015-01-06T16:30:00Z')]) def test_transmission_same_day(self): diff --git a/radioco/apps/api/views.py b/radioco/apps/api/views.py index 325ef66..2ab2e83 100644 --- a/radioco/apps/api/views.py +++ b/radioco/apps/api/views.py @@ -13,7 +13,7 @@ from rest_framework.exceptions import ValidationError as DRFValidationError from rest_framework.response import Response -import serializers +from . import serializers from radioco.apps.api.viewsets import UpdateOnlyModelViewSet from radioco.apps.global_settings.models import RadiocomConfiguration from radioco.apps.programmes.models import Programme, Episode @@ -168,7 +168,7 @@ def now(self, request): now = utils.timezone.now() transmissions = Transmission.at(now) try: - transmission = transmissions.next() + transmission = next(transmissions) except StopIteration: return Response(None) else: diff --git a/radioco/apps/global_settings/migrations/0001_initial.py b/radioco/apps/global_settings/migrations/0001_initial.py index 490528b..7d8077f 100755 --- a/radioco/apps/global_settings/migrations/0001_initial.py +++ b/radioco/apps/global_settings/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import models, migrations import datetime @@ -32,7 +32,7 @@ class Migration(migrations.Migration): name='PodcastConfiguration', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('url_source', models.CharField(default=b'', help_text='The source url where the recordings will be available after the upload. For example: "http://RadioCo.org/recordings/"', max_length=500, verbose_name='URL Source', blank=True)), + ('url_source', models.CharField(default='', help_text='The source url where the recordings will be available after the upload. For example: "http://RadioCo.org/recordings/"', max_length=500, verbose_name='URL Source', blank=True)), ('start_delay', models.PositiveIntegerField(default=0, help_text='In seconds. Initial delay of recordings', verbose_name='start delay')), ('end_delay', models.PositiveIntegerField(default=0, help_text='In seconds.', verbose_name='end delay')), ('next_events', models.PositiveIntegerField(default=32, help_text='In hours. The next events supplied to the recorder program', verbose_name='next events')), @@ -48,7 +48,7 @@ class Migration(migrations.Migration): name='SiteConfiguration', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('site_name', models.CharField(default=b'RadioCo', max_length=255, verbose_name='Site Name')), + ('site_name', models.CharField(default='RadioCo', max_length=255, verbose_name='Site Name')), ], options={ 'default_permissions': ('change',), diff --git a/radioco/apps/global_settings/migrations/0002_remove_calendarconfiguration_display_next_weeks.py b/radioco/apps/global_settings/migrations/0002_remove_calendarconfiguration_display_next_weeks.py index 125deeb..f929663 100755 --- a/radioco/apps/global_settings/migrations/0002_remove_calendarconfiguration_display_next_weeks.py +++ b/radioco/apps/global_settings/migrations/0002_remove_calendarconfiguration_display_next_weeks.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import models, migrations diff --git a/radioco/apps/global_settings/migrations/0003_siteconfiguration_footer.py b/radioco/apps/global_settings/migrations/0003_siteconfiguration_footer.py index 2587fcc..d04df25 100755 --- a/radioco/apps/global_settings/migrations/0003_siteconfiguration_footer.py +++ b/radioco/apps/global_settings/migrations/0003_siteconfiguration_footer.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import models, migrations @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='siteconfiguration', name='footer', - field=models.TextField(default=b'', help_text='Can contain raw HTML.', verbose_name='Footer', blank=True), + field=models.TextField(default='', help_text='Can contain raw HTML.', verbose_name='Footer', blank=True), preserve_default=True, ), ] diff --git a/radioco/apps/global_settings/migrations/0004_auto_20150606_1335.py b/radioco/apps/global_settings/migrations/0004_auto_20150606_1335.py index f7a27d0..cc67f43 100755 --- a/radioco/apps/global_settings/migrations/0004_auto_20150606_1335.py +++ b/radioco/apps/global_settings/migrations/0004_auto_20150606_1335.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import models, migrations @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='siteconfiguration', name='address', - field=models.TextField(default=b'', help_text='Can contain raw HTML.', verbose_name='Address', blank=True), + field=models.TextField(default='', help_text='Can contain raw HTML.', verbose_name='Address', blank=True), preserve_default=True, ), migrations.AddField( @@ -26,7 +26,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='siteconfiguration', name='google_analytics_id', - field=models.CharField(default=b'', max_length=255, verbose_name='Example "UA-00000-0"', blank=True), + field=models.CharField(default='', max_length=255, verbose_name='Example "UA-00000-0"', blank=True), preserve_default=True, ), migrations.AddField( @@ -38,7 +38,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='siteconfiguration', name='footer', - field=models.TextField(default=b'', verbose_name='Footer', blank=True), + field=models.TextField(default='', verbose_name='Footer', blank=True), preserve_default=True, ), ] diff --git a/radioco/apps/global_settings/migrations/0005_auto_20150606_1415.py b/radioco/apps/global_settings/migrations/0005_auto_20150606_1415.py index fbf642a..53bc7ad 100755 --- a/radioco/apps/global_settings/migrations/0005_auto_20150606_1415.py +++ b/radioco/apps/global_settings/migrations/0005_auto_20150606_1415.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import models, migrations @@ -19,7 +19,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='siteconfiguration', name='more_about_us', - field=models.TextField(default=b'', verbose_name='More info', blank=True), + field=models.TextField(default='', verbose_name='More info', blank=True), preserve_default=True, ), ] diff --git a/radioco/apps/global_settings/migrations/0006_auto_20160116_1509.py b/radioco/apps/global_settings/migrations/0006_auto_20160116_1509.py index 8f86de8..5a5d2e3 100644 --- a/radioco/apps/global_settings/migrations/0006_auto_20160116_1509.py +++ b/radioco/apps/global_settings/migrations/0006_auto_20160116_1509.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import migrations, models @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='siteconfiguration', name='google_analytics_id', - field=models.CharField(default=b'', help_text='Example "UA-00000-0"', max_length=255, verbose_name='Google Analytics ID', blank=True), + field=models.CharField(default='', help_text='Example "UA-00000-0"', max_length=255, verbose_name='Google Analytics ID', blank=True), ), ] diff --git a/radioco/apps/global_settings/migrations/0007__v3_0__calendarconfiguration_tweaks.py b/radioco/apps/global_settings/migrations/0007__v3_0__calendarconfiguration_tweaks.py index dc5fd8d..8b541ed 100644 --- a/radioco/apps/global_settings/migrations/0007__v3_0__calendarconfiguration_tweaks.py +++ b/radioco/apps/global_settings/migrations/0007__v3_0__calendarconfiguration_tweaks.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import migrations, models import datetime diff --git a/radioco/apps/global_settings/migrations/0008__v3_0__radiocomconfiguration.py b/radioco/apps/global_settings/migrations/0008__v3_0__radiocomconfiguration.py index 3a52a13..17b1f60 100644 --- a/radioco/apps/global_settings/migrations/0008__v3_0__radiocomconfiguration.py +++ b/radioco/apps/global_settings/migrations/0008__v3_0__radiocomconfiguration.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import migrations, models @@ -15,14 +15,14 @@ class Migration(migrations.Migration): name='RadiocomConfiguration', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('station_name', models.CharField(default=b'RadioCo', help_text='The name of radio station', max_length=255, verbose_name='station name')), + ('station_name', models.CharField(default='RadioCo', help_text='The name of radio station', max_length=255, verbose_name='station name')), ('icon_url', models.URLField(help_text='The icon url where the store icon is.', max_length=255, verbose_name='big icon url', blank=True)), ('big_icon_url', models.URLField(help_text='The icon url where the store icon is.', max_length=255, verbose_name='icon url', blank=True)), - ('history', models.TextField(default=b'', help_text='The history of the station', verbose_name='history', blank=True)), + ('history', models.TextField(default='', help_text='The history of the station', verbose_name='history', blank=True)), ('latitude', models.FloatField(default=0, verbose_name='latitude', blank=True)), ('longitude', models.FloatField(default=0, verbose_name='longitude', blank=True)), ('news_rss', models.URLField(help_text='The news rss url where the recordings news rss', max_length=255, verbose_name='news_rss', blank=True)), - ('station_photos', models.TextField(default=b'', help_text='A list of urls to the station photos', verbose_name='station photos', blank=True)), + ('station_photos', models.TextField(default='', help_text='A list of urls to the station photos', verbose_name='station photos', blank=True)), ('stream_url', models.URLField(help_text='The stream url where its hear actual program', max_length=255, verbose_name='stream url', blank=True)), ], options={ diff --git a/radioco/apps/global_settings/models.py b/radioco/apps/global_settings/models.py index ab47fa1..8f279c6 100755 --- a/radioco/apps/global_settings/models.py +++ b/radioco/apps/global_settings/models.py @@ -79,7 +79,7 @@ class SiteConfiguration(SingletonModel): twitter_address = models.CharField(max_length=255, verbose_name=_('Twitter address'), blank=True, null=True) facebook_address = models.CharField(max_length=255, verbose_name=_('facebook address'), blank=True, null=True) - def __unicode__(self): + def __str__(self): return _u('Global Configuration') class Meta: @@ -118,7 +118,7 @@ def recorder_token(self): else: return _('Variable USERNAME_RADIOCO_RECORDER doesn\'t exist in your settings file') - def __unicode__(self): + def __str__(self): # In django 1.7 we can't use lazy return _u('Podcast Configuration') @@ -150,7 +150,7 @@ class CalendarConfiguration(SingletonModel): ) ) - def __unicode__(self): + def __str__(self): return _u('Calendar Configuration') class Meta: @@ -192,7 +192,7 @@ class RadiocomConfiguration(SingletonModel): help_text=_('The stream url where its hear actual program'), ) - def __unicode__(self): + def __str__(self): return _u('Radiocom Configuration') class Meta: diff --git a/radioco/apps/programmes/admin.py b/radioco/apps/programmes/admin.py index be1e230..be0525a 100755 --- a/radioco/apps/programmes/admin.py +++ b/radioco/apps/programmes/admin.py @@ -216,7 +216,7 @@ def clean_programme(self): after = now try: - next_dates(Calendar.get_active(), programme, after).next() + next(next_dates(Calendar.get_active(), programme, after)) except StopIteration: raise forms.ValidationError(_('There are no available schedules.')) return programme @@ -274,7 +274,7 @@ class PodcastInline(admin.StackedInline): class NonStaffEpisodeAdmin(admin.ModelAdmin): - list_display = ('__unicode__', 'season', 'number_in_season', 'issue_date', 'programme') + list_display = ('__str__', 'season', 'number_in_season', 'issue_date', 'programme') list_select_related = True ordering = ['-season', '-number_in_season'] list_filter = ['issue_date', OwnEpisodeProgrammeListFilter, OwnEpisodeIssueDateListFilter] @@ -294,7 +294,7 @@ def save_model(self, request, obj, form, change): after = now else: after = now - date = next_dates(Calendar.get_active(), programme, after).next() + date = next(next_dates(Calendar.get_active(), programme, after)) Episode.objects.create_episode( episode=obj, last_episode=last_episode, date=date, programme=programme) diff --git a/radioco/apps/programmes/migrations/0001_initial.py b/radioco/apps/programmes/migrations/0001_initial.py index f0b3e2c..9c68192 100755 --- a/radioco/apps/programmes/migrations/0001_initial.py +++ b/radioco/apps/programmes/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import models, migrations from django.conf import settings @@ -34,7 +34,7 @@ class Migration(migrations.Migration): name='Participant', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('role', models.CharField(default=b'NO', max_length=2, verbose_name='role', choices=[(b'NO', 'Not specified'), (b'PR', 'Presenter'), (b'IN', 'Informer'), (b'CO', 'Contributor')])), + ('role', models.CharField(default='NO', max_length=2, verbose_name='role', choices=[('NO', 'Not specified'), ('PR', 'Presenter'), ('IN', 'Informer'), ('CO', 'Contributor')])), ('description', models.TextField(verbose_name='description', blank=True)), ], options={ @@ -65,10 +65,10 @@ class Migration(migrations.Migration): ('start_date', models.DateField(verbose_name='start date')), ('end_date', models.DateField(help_text='This field can be null.', null=True, verbose_name='end date', blank=True)), ('synopsis', models.TextField(verbose_name='synopsis', blank=True)), - ('photo', models.ImageField(default=b'/static/radio/images/default-programme-photo.jpg', upload_to=b'photos/', verbose_name='photo')), - ('language', models.CharField(default=b'ES', max_length=2, verbose_name='language', choices=[(b'ES', 'Spanish'), (b'GA', 'Galician')])), + ('photo', models.ImageField(default='/static/radio/images/default-programme-photo.jpg', upload_to='photos/', verbose_name='photo')), + ('language', models.CharField(default='ES', max_length=2, verbose_name='language', choices=[('ES', 'Spanish'), ('GA', 'Galician')])), ('current_season', models.PositiveIntegerField(verbose_name='current season', validators=[django.core.validators.MinValueValidator(1)])), - ('category', models.CharField(blank=True, max_length=50, null=True, verbose_name='category', choices=[(b'Arts', 'Arts'), (b'Business', 'Business'), (b'Comedy', 'Comedy'), (b'Education', 'Education'), (b'Games & Hobbies', 'Games & Hobbies'), (b'Government & Organizations', 'Government & Organizations'), (b'Health', 'Health'), (b'Kids & Family', 'Kids & Family'), (b'Music', 'Music'), (b'News & Politics', 'News & Politics'), (b'Religion & Spirituality', 'Religion & Spirituality'), (b'Science & Medicine', 'Science & Medicine'), (b'Society & Culture', 'Society & Culture'), (b'Sports & Recreation', 'Sports & Recreation'), (b'Technology', 'Technology'), (b'TV & Film', 'TV & Film')])), + ('category', models.CharField(blank=True, max_length=50, null=True, verbose_name='category', choices=[('Arts', 'Arts'), ('Business', 'Business'), ('Comedy', 'Comedy'), ('Education', 'Education'), ('Games & Hobbies', 'Games & Hobbies'), ('Government & Organizations', 'Government & Organizations'), ('Health', 'Health'), ('Kids & Family', 'Kids & Family'), ('Music', 'Music'), ('News & Politics', 'News & Politics'), ('Religion & Spirituality', 'Religion & Spirituality'), ('Science & Medicine', 'Science & Medicine'), ('Society & Culture', 'Society & Culture'), ('Sports & Recreation', 'Sports & Recreation'), ('Technology', 'Technology'), ('TV & Film', 'TV & Film')])), ('slug', models.SlugField(unique=True, max_length=100)), ('_runtime', models.PositiveIntegerField(help_text='In minutes.', verbose_name='runtime', validators=[django.core.validators.MinValueValidator(1)])), ], @@ -83,7 +83,7 @@ class Migration(migrations.Migration): name='Role', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('role', models.CharField(default=b'NO', max_length=2, verbose_name='role', choices=[(b'NO', 'Not specified'), (b'PR', 'Presenter'), (b'IN', 'Informer'), (b'CO', 'Contributor')])), + ('role', models.CharField(default='NO', max_length=2, verbose_name='role', choices=[('NO', 'Not specified'), ('PR', 'Presenter'), ('IN', 'Informer'), ('CO', 'Contributor')])), ('description', models.TextField(verbose_name='description', blank=True)), ('date_joined', models.DateField(auto_now_add=True)), ('person', models.ForeignKey(verbose_name='person', to=settings.AUTH_USER_MODEL)), diff --git a/radioco/apps/programmes/migrations/0002_change_language_choices.py b/radioco/apps/programmes/migrations/0002_change_language_choices.py index 1ebd17b..dc6f4c5 100755 --- a/radioco/apps/programmes/migrations/0002_change_language_choices.py +++ b/radioco/apps/programmes/migrations/0002_change_language_choices.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import models, migrations @@ -23,6 +23,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='programme', name='language', - field=models.CharField(max_length=7, verbose_name='language', choices=[(b'af', b'Afrikaans'), (b'ar', b'Arabic'), (b'ast', b'Asturian'), (b'az', b'Azerbaijani'), (b'bg', b'Bulgarian'), (b'be', b'Belarusian'), (b'bn', b'Bengali'), (b'br', b'Breton'), (b'bs', b'Bosnian'), (b'ca', b'Catalan'), (b'cs', b'Czech'), (b'cy', b'Welsh'), (b'da', b'Danish'), (b'de', b'German'), (b'el', b'Greek'), (b'en', b'English'), (b'en-au', b'Australian English'), (b'en-gb', b'British English'), (b'eo', b'Esperanto'), (b'es', b'Spanish'), (b'es-ar', b'Argentinian Spanish'), (b'es-mx', b'Mexican Spanish'), (b'es-ni', b'Nicaraguan Spanish'), (b'es-ve', b'Venezuelan Spanish'), (b'et', b'Estonian'), (b'eu', b'Basque'), (b'fa', b'Persian'), (b'fi', b'Finnish'), (b'fr', b'French'), (b'fy', b'Frisian'), (b'ga', b'Irish'), (b'gl', b'Galician'), (b'he', b'Hebrew'), (b'hi', b'Hindi'), (b'hr', b'Croatian'), (b'hu', b'Hungarian'), (b'ia', b'Interlingua'), (b'id', b'Indonesian'), (b'io', b'Ido'), (b'is', b'Icelandic'), (b'it', b'Italian'), (b'ja', b'Japanese'), (b'ka', b'Georgian'), (b'kk', b'Kazakh'), (b'km', b'Khmer'), (b'kn', b'Kannada'), (b'ko', b'Korean'), (b'lb', b'Luxembourgish'), (b'lt', b'Lithuanian'), (b'lv', b'Latvian'), (b'mk', b'Macedonian'), (b'ml', b'Malayalam'), (b'mn', b'Mongolian'), (b'mr', b'Marathi'), (b'my', b'Burmese'), (b'nb', b'Norwegian Bokmal'), (b'ne', b'Nepali'), (b'nl', b'Dutch'), (b'nn', b'Norwegian Nynorsk'), (b'os', b'Ossetic'), (b'pa', b'Punjabi'), (b'pl', b'Polish'), (b'pt', b'Portuguese'), (b'pt-br', b'Brazilian Portuguese'), (b'ro', b'Romanian'), (b'ru', b'Russian'), (b'sk', b'Slovak'), (b'sl', b'Slovenian'), (b'sq', b'Albanian'), (b'sr', b'Serbian'), (b'sr-latn', b'Serbian Latin'), (b'sv', b'Swedish'), (b'sw', b'Swahili'), (b'ta', b'Tamil'), (b'te', b'Telugu'), (b'th', b'Thai'), (b'tr', b'Turkish'), (b'tt', b'Tatar'), (b'udm', b'Udmurt'), (b'uk', b'Ukrainian'), (b'ur', b'Urdu'), (b'vi', b'Vietnamese'), (b'zh-cn', b'Simplified Chinese'), (b'zh-hans', b'Simplified Chinese'), (b'zh-hant', b'Traditional Chinese'), (b'zh-tw', b'Traditional Chinese')]), + field=models.CharField(max_length=7, verbose_name='language', choices=[('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmal'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-cn', 'Simplified Chinese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese'), ('zh-tw', 'Traditional Chinese')]), ), ] diff --git a/radioco/apps/programmes/migrations/0003_change_textfield_to_richtextfield.py b/radioco/apps/programmes/migrations/0003_change_textfield_to_richtextfield.py index 114b651..c24b452 100755 --- a/radioco/apps/programmes/migrations/0003_change_textfield_to_richtextfield.py +++ b/radioco/apps/programmes/migrations/0003_change_textfield_to_richtextfield.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import models, migrations import ckeditor.fields @@ -21,7 +21,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='programme', name='language', - field=models.CharField(default=b'af', max_length=7, verbose_name='language', choices=[(b'af', 'Afrikaans'), (b'ar', 'Arabic'), (b'ast', 'Asturian'), (b'az', 'Azerbaijani'), (b'bg', 'Bulgarian'), (b'be', 'Belarusian'), (b'bn', 'Bengali'), (b'br', 'Breton'), (b'bs', 'Bosnian'), (b'ca', 'Catalan'), (b'cs', 'Czech'), (b'cy', 'Welsh'), (b'da', 'Danish'), (b'de', 'German'), (b'el', 'Greek'), (b'en', 'English'), (b'en-au', 'Australian English'), (b'en-gb', 'British English'), (b'eo', 'Esperanto'), (b'es', 'Spanish'), (b'es-ar', 'Argentinian Spanish'), (b'es-mx', 'Mexican Spanish'), (b'es-ni', 'Nicaraguan Spanish'), (b'es-ve', 'Venezuelan Spanish'), (b'et', 'Estonian'), (b'eu', 'Basque'), (b'fa', 'Persian'), (b'fi', 'Finnish'), (b'fr', 'French'), (b'fy', 'Frisian'), (b'ga', 'Irish'), (b'gl', 'Galician'), (b'he', 'Hebrew'), (b'hi', 'Hindi'), (b'hr', 'Croatian'), (b'hu', 'Hungarian'), (b'ia', 'Interlingua'), (b'id', 'Indonesian'), (b'io', 'Ido'), (b'is', 'Icelandic'), (b'it', 'Italian'), (b'ja', 'Japanese'), (b'ka', 'Georgian'), (b'kk', 'Kazakh'), (b'km', 'Khmer'), (b'kn', 'Kannada'), (b'ko', 'Korean'), (b'lb', 'Luxembourgish'), (b'lt', 'Lithuanian'), (b'lv', 'Latvian'), (b'mk', 'Macedonian'), (b'ml', 'Malayalam'), (b'mn', 'Mongolian'), (b'mr', 'Marathi'), (b'my', 'Burmese'), (b'nb', 'Norwegian Bokmal'), (b'ne', 'Nepali'), (b'nl', 'Dutch'), (b'nn', 'Norwegian Nynorsk'), (b'os', 'Ossetic'), (b'pa', 'Punjabi'), (b'pl', 'Polish'), (b'pt', 'Portuguese'), (b'pt-br', 'Brazilian Portuguese'), (b'ro', 'Romanian'), (b'ru', 'Russian'), (b'sk', 'Slovak'), (b'sl', 'Slovenian'), (b'sq', 'Albanian'), (b'sr', 'Serbian'), (b'sr-latn', 'Serbian Latin'), (b'sv', 'Swedish'), (b'sw', 'Swahili'), (b'ta', 'Tamil'), (b'te', 'Telugu'), (b'th', 'Thai'), (b'tr', 'Turkish'), (b'tt', 'Tatar'), (b'udm', 'Udmurt'), (b'uk', 'Ukrainian'), (b'ur', 'Urdu'), (b'vi', 'Vietnamese'), (b'zh-cn', 'Simplified Chinese'), (b'zh-hans', 'Simplified Chinese'), (b'zh-hant', 'Traditional Chinese'), (b'zh-tw', 'Traditional Chinese')]), + field=models.CharField(default='af', max_length=7, verbose_name='language', choices=[('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmal'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-cn', 'Simplified Chinese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese'), ('zh-tw', 'Traditional Chinese')]), preserve_default=True, ), migrations.AlterField( diff --git a/radioco/apps/programmes/migrations/0004_change_photo_url.py b/radioco/apps/programmes/migrations/0004_change_photo_url.py index 88ac20d..5fd3e90 100755 --- a/radioco/apps/programmes/migrations/0004_change_photo_url.py +++ b/radioco/apps/programmes/migrations/0004_change_photo_url.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import migrations from django.templatetags.static import static diff --git a/radioco/apps/programmes/migrations/0005_auto_20150531_1734.py b/radioco/apps/programmes/migrations/0005_auto_20150531_1734.py index ccd4bd1..f5e5e4b 100755 --- a/radioco/apps/programmes/migrations/0005_auto_20150531_1734.py +++ b/radioco/apps/programmes/migrations/0005_auto_20150531_1734.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import models, migrations diff --git a/radioco/apps/programmes/migrations/0006_auto_20160104_2029.py b/radioco/apps/programmes/migrations/0006_auto_20160104_2029.py index 2385a37..871eeb1 100644 --- a/radioco/apps/programmes/migrations/0006_auto_20160104_2029.py +++ b/radioco/apps/programmes/migrations/0006_auto_20160104_2029.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import migrations, models @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='programme', name='photo', - field=models.ImageField(default=b'defaults/default-programme-photo.jpg', upload_to=b'photos/', verbose_name='photo'), + field=models.ImageField(default='defaults/default-programme-photo.jpg', upload_to='photos/', verbose_name='photo'), ), ] diff --git a/radioco/apps/programmes/migrations/0007_change_default_image.py b/radioco/apps/programmes/migrations/0007_change_default_image.py index 411c1e6..e35f75f 100644 --- a/radioco/apps/programmes/migrations/0007_change_default_image.py +++ b/radioco/apps/programmes/migrations/0007_change_default_image.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import migrations from django.templatetags.static import static @@ -9,7 +9,7 @@ def change_programmes(apps, schema_editor): # version than this migration expects. We use the historical version. Programme = apps.get_model("programmes", "Programme") for programme in Programme.objects.all(): - print programme.photo.name + print(programme.photo.name) if programme.photo.name == static('radio/images/default-programme-photo.jpg'): programme.photo = 'defaults/default-programme-photo.jpg' programme.save() diff --git a/radioco/apps/programmes/migrations/0008_auto_20160116_1509.py b/radioco/apps/programmes/migrations/0008_auto_20160116_1509.py index cb22746..aafb0d9 100644 --- a/radioco/apps/programmes/migrations/0008_auto_20160116_1509.py +++ b/radioco/apps/programmes/migrations/0008_auto_20160116_1509.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import migrations, models @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='programme', name='language', - field=models.CharField(default=b'es', max_length=7, verbose_name='language', choices=[(b'es', 'Spanish'), (b'en', 'English'), (b'gl', 'Galician')]), + field=models.CharField(default='es', max_length=7, verbose_name='language', choices=[('es', 'Spanish'), ('en', 'English'), ('gl', 'Galician')]), ), ] diff --git a/radioco/apps/programmes/migrations/0009__v3_0__small_tweaks.py b/radioco/apps/programmes/migrations/0009__v3_0__small_tweaks.py index 69da09a..e365883 100644 --- a/radioco/apps/programmes/migrations/0009__v3_0__small_tweaks.py +++ b/radioco/apps/programmes/migrations/0009__v3_0__small_tweaks.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import migrations, models from django.conf import settings diff --git a/radioco/apps/programmes/migrations/0010__v3_2__convert_role.py b/radioco/apps/programmes/migrations/0010__v3_2__convert_role.py index a041789..334e1d3 100644 --- a/radioco/apps/programmes/migrations/0010__v3_2__convert_role.py +++ b/radioco/apps/programmes/migrations/0010__v3_2__convert_role.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from itertools import chain diff --git a/radioco/apps/programmes/migrations/0011__v3_2__ensure_one_user_role.py b/radioco/apps/programmes/migrations/0011__v3_2__ensure_one_user_role.py index ebc05c7..a5bc8d2 100644 --- a/radioco/apps/programmes/migrations/0011__v3_2__ensure_one_user_role.py +++ b/radioco/apps/programmes/migrations/0011__v3_2__ensure_one_user_role.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import migrations diff --git a/radioco/apps/programmes/models.py b/radioco/apps/programmes/models.py index aaca65d..6d51894 100755 --- a/radioco/apps/programmes/models.py +++ b/radioco/apps/programmes/models.py @@ -75,7 +75,7 @@ class Meta: ) language = models.CharField( default=PROGRAMME_LANGUAGES[0][0], verbose_name=_("language"), - choices=map(lambda (k, v): (k, _(v)), PROGRAMME_LANGUAGES), max_length=7 + choices=[(k_v[0], _(k_v[1])) for k_v in PROGRAMME_LANGUAGES], max_length=7 ) # XXX ensure not decreasing current_season = models.PositiveIntegerField( @@ -135,8 +135,8 @@ def rearrange_episodes(self, after, calendar): # Further dates and episodes available -> re-order while True: try: - date = dates.next() - episode = episodes.next() + date = next(dates) + episode = next(episodes) except StopIteration: break else: @@ -146,7 +146,7 @@ def rearrange_episodes(self, after, calendar): # No further dates available -> unschedule while True: try: - episode = episodes.next() + episode = next(episodes) except StopIteration: break else: @@ -156,8 +156,8 @@ def rearrange_episodes(self, after, calendar): def get_absolute_url(self): return reverse('programmes:detail', args=[self.slug]) - def __unicode__(self): - return u"%s" % (self.name) + def __str__(self): + return "%s" % (self.name) def update_schedule_performance(programme): @@ -246,10 +246,10 @@ def runtime(self): def get_absolute_url(self): return reverse('programmes:episode_detail', args=[self.programme.slug, self.season, self.number_in_season]) - def __unicode__(self): + def __str__(self): if self.title: - return u"%sx%s %s" % (self.season, self.number_in_season, self.title) - return u"%sx%s %s" % (self.season, self.number_in_season, self.programme) + return "%sx%s %s" % (self.season, self.number_in_season, self.title) + return "%sx%s %s" % (self.season, self.number_in_season, self.programme) class Participant(models.Model): @@ -266,8 +266,8 @@ class Meta: ("see_all_participants", "Can see all participants"), ) - def __unicode__(self): - return u"%s: %s" % (self.episode, self.person.username) + def __str__(self): + return "%s: %s" % (self.episode, self.person.username) class Role(models.Model): @@ -285,8 +285,8 @@ class Meta: ("see_all_roles", "Can see all roles"), ) - def __unicode__(self): - return u"%s: %s" % (self.programme.name, self.person.username) + def __str__(self): + return "%s: %s" % (self.programme.name, self.person.username) class Podcast(models.Model): diff --git a/radioco/apps/programmes/tests/test_feed.py b/radioco/apps/programmes/tests/test_feed.py index 5d68103..9698958 100644 --- a/radioco/apps/programmes/tests/test_feed.py +++ b/radioco/apps/programmes/tests/test_feed.py @@ -4,16 +4,16 @@ from radioco.apps.radioco.test_utils import TestDataMixin -EXPECTED_RESULT = ''' -Morning Newshttp://example.com/programmes/morning-news/ +EXPECTED_RESULT = b""" +Morning Newshttp://example.com/programmes/morning-news/ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. - enThu, 01 Jan 2015 08:00:00 +0000clean + enThu, 01 Jan 2015 08:00:00 +0000clean Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. - 1x1 Episode 1http://example.com/programmes/morning-news/1x1/ + 1x1 Episode 1http://example.com/programmes/morning-news/1x1/ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. @@ -21,7 +21,7 @@ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. - 0:14:13''' + 0:14:13""" class TestFeed(TestDataMixin, APITestCase): diff --git a/radioco/apps/programmes/tests/test_models.py b/radioco/apps/programmes/tests/test_models.py index f60e39d..b6863c7 100755 --- a/radioco/apps/programmes/tests/test_models.py +++ b/radioco/apps/programmes/tests/test_models.py @@ -128,12 +128,12 @@ def test_unfinished(self): episodes = self.manager.unfinished( self.programme, pytz.utc.localize(datetime.datetime(2015, 1, 1))) self.assertEqual( - episodes.next().issue_date, pytz.utc.localize(datetime.datetime(2015, 1, 1, 14, 0))) + next(episodes).issue_date, pytz.utc.localize(datetime.datetime(2015, 1, 1, 14, 0))) def test_unfinished_none(self): episodes = self.manager.unfinished(Programme()) with self.assertRaises(StopIteration): - episodes.next() + next(episodes) class EpisodeModelTests(TestCase): diff --git a/radioco/apps/programmes/utils.py b/radioco/apps/programmes/utils.py index 6e59310..b1acb52 100644 --- a/radioco/apps/programmes/utils.py +++ b/radioco/apps/programmes/utils.py @@ -1,5 +1,6 @@ from radioco.apps.schedules.models import Schedule from radioco.apps.schedules.utils import next_dates -from models import Episode +from .models import Episode +#TODO: remove me \ No newline at end of file diff --git a/radioco/apps/radioco/migrations/0001__v3_0__mysql_timezone.py b/radioco/apps/radioco/migrations/0001__v3_0__mysql_timezone.py index b516c38..1553e88 100644 --- a/radioco/apps/radioco/migrations/0001__v3_0__mysql_timezone.py +++ b/radioco/apps/radioco/migrations/0001__v3_0__mysql_timezone.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + import datetime import pytz diff --git a/radioco/apps/radioco/tests/tests.py b/radioco/apps/radioco/tests/tests.py index 0c31a6a..2937ef1 100644 --- a/radioco/apps/radioco/tests/tests.py +++ b/radioco/apps/radioco/tests/tests.py @@ -40,8 +40,8 @@ def test_dictionary_key(self): utc_dict = {utc_dt: 'Created using utc dt'} spain_dict = {spanish_dt: 'Created using spanish dt'} - self.assertEquals(utc_dict.get(utc_dt), utc_dict.get(utc_dt.astimezone(SPAIN_TZ))) - self.assertEquals(spain_dict.get(spanish_dt), spain_dict.get(spanish_dt.astimezone(pytz.utc))) + self.assertEqual(utc_dict.get(utc_dt), utc_dict.get(utc_dt.astimezone(SPAIN_TZ))) + self.assertEqual(spain_dict.get(spanish_dt), spain_dict.get(spanish_dt.astimezone(pytz.utc))) class RadioIntegrationTests(TestDataMixin, TestCase): diff --git a/radioco/apps/radioco/views.py b/radioco/apps/radioco/views.py index 99b8842..f4f2557 100755 --- a/radioco/apps/radioco/views.py +++ b/radioco/apps/radioco/views.py @@ -36,7 +36,7 @@ def index(request): next_transmissions = [] try: - live_transmission = transmissions_between.next() + live_transmission = next(transmissions_between) if live_transmission.start <= now < live_transmission.end: percentage = int(round( (now - live_transmission.start).total_seconds() / @@ -52,7 +52,7 @@ def index(request): try: max_num_of_next_transmissions = 6 - len(next_transmissions) for num in range(max_num_of_next_transmissions): - next_transmissions.append(transmissions_between.next()) + next_transmissions.append(next(transmissions_between)) except StopIteration: pass diff --git a/radioco/apps/schedules/admin.py b/radioco/apps/schedules/admin.py index ef3411a..578f634 100755 --- a/radioco/apps/schedules/admin.py +++ b/radioco/apps/schedules/admin.py @@ -104,7 +104,7 @@ def changelist_view(self, request, extra_context=None): calendar_configuration = CalendarConfiguration.get_global() extra_context = extra_context or {} extra_context['calendars'] = Calendar.objects.all() - extra_context['slot_duration'] = unicode(calendar_configuration.slot_duration) + extra_context['slot_duration'] = str(calendar_configuration.slot_duration) return super(ScheduleAdmin, self).changelist_view(request, extra_context=extra_context) def has_add_permission(self, request): diff --git a/radioco/apps/schedules/migrations/0001_initial.py b/radioco/apps/schedules/migrations/0001_initial.py index a021b8e..a092de8 100755 --- a/radioco/apps/schedules/migrations/0001_initial.py +++ b/radioco/apps/schedules/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import models, migrations import django.db.models.deletion @@ -18,7 +18,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('day', models.IntegerField(choices=[(0, 'Monday'), (1, 'Tuesday'), (2, 'Wednesday'), (3, 'Thursday'), (4, 'Friday'), (5, 'Saturday'), (6, 'Sunday')])), ('start_hour', models.TimeField(verbose_name='start time')), - ('type', models.CharField(max_length=1, verbose_name='type', choices=[(b'L', 'live'), (b'B', 'broadcast'), (b'S', 'broadcast syndication')])), + ('type', models.CharField(max_length=1, verbose_name='type', choices=[('L', 'live'), ('B', 'broadcast'), ('S', 'broadcast syndication')])), ('programme', models.ForeignKey(verbose_name='programme', to='programmes.Programme')), ], options={ diff --git a/radioco/apps/schedules/migrations/0002__v3_0__renaming_calendar_model.py b/radioco/apps/schedules/migrations/0002__v3_0__renaming_calendar_model.py index 32d17cb..cc4ae57 100644 --- a/radioco/apps/schedules/migrations/0002__v3_0__renaming_calendar_model.py +++ b/radioco/apps/schedules/migrations/0002__v3_0__renaming_calendar_model.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import migrations, models diff --git a/radioco/apps/schedules/migrations/0003__v3_0__create_excludeddates_model.py b/radioco/apps/schedules/migrations/0003__v3_0__create_excludeddates_model.py index 23fcc1f..9694aed 100644 --- a/radioco/apps/schedules/migrations/0003__v3_0__create_excludeddates_model.py +++ b/radioco/apps/schedules/migrations/0003__v3_0__create_excludeddates_model.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import migrations, models diff --git a/radioco/apps/schedules/migrations/0004__v3_0__adding_rrules.py b/radioco/apps/schedules/migrations/0004__v3_0__adding_rrules.py index 3178de0..70b9cda 100644 --- a/radioco/apps/schedules/migrations/0004__v3_0__adding_rrules.py +++ b/radioco/apps/schedules/migrations/0004__v3_0__adding_rrules.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + import datetime diff --git a/radioco/apps/schedules/migrations/0005__v3_0__migrating_schedules_to_unique_calendar.py b/radioco/apps/schedules/migrations/0005__v3_0__migrating_schedules_to_unique_calendar.py index e060354..42a993a 100644 --- a/radioco/apps/schedules/migrations/0005__v3_0__migrating_schedules_to_unique_calendar.py +++ b/radioco/apps/schedules/migrations/0005__v3_0__migrating_schedules_to_unique_calendar.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + import datetime from collections import namedtuple @@ -122,7 +122,7 @@ def calculate_effective_schedule_end_dt(schedule): rrules_until_dates = [_rrule.until for _rrule in schedule.recurrences.rrules] # If we have a rrule without a until date we don't know the last date - if any(map(lambda x: x is None, rrules_until_dates)): + if any([x is None for x in rrules_until_dates]): return None possible_limit_dates = schedule.recurrences.rdates + rrules_until_dates @@ -205,7 +205,7 @@ def migrate_schedules(apps, schema_editor): if not can_be_migrated: # We cannot copy that schedule (it hasn't effective dates) - print("WARNING Migration: schedule {id} cannot be migrated (doesn't have a effective date)".format(id=schedule.id)) + print(("WARNING Migration: schedule {id} cannot be migrated (doesn't have a effective date)".format(id=schedule.id))) continue assert not calendar.end_date or calendar.end_date >= schedule.start_dt.date(), "_generate_schedule_start_date doesn't work" @@ -224,7 +224,7 @@ def migrate_schedules(apps, schema_editor): ) if sources: if len(sources) > 1: - print('WARNING Migration: schedule.source has more than one candidate "{objects}"'.format(objects=[_obj.id for _obj in sources])) + print(('WARNING Migration: schedule.source has more than one candidate "{objects}"'.format(objects=[_obj.id for _obj in sources]))) schedule.source = sources.last() else: print('WARNING Migration: schedule.source was not found in the new calendar') diff --git a/radioco/apps/schedules/models.py b/radioco/apps/schedules/models.py index 3224dd1..cff992a 100755 --- a/radioco/apps/schedules/models.py +++ b/radioco/apps/schedules/models.py @@ -16,7 +16,7 @@ import datetime import heapq from functools import partial -from itertools import imap + from django.core.urlresolvers import reverse from django.db import models @@ -87,8 +87,8 @@ def get_active(cls): except Calendar.DoesNotExist: return None - def __unicode__(self): - return u"%s" % (self.name) + def __str__(self): + return "%s" % (self.name) # We are not rearranging episodes during deletion @@ -269,7 +269,7 @@ def _merge_before(self, before): return before return min(before, self.effective_end_dt) - def __unicode__(self): + def __str__(self): return ' - '.join([self.start_dt.strftime('%A'), self.start_dt.strftime('%X')]) @@ -327,7 +327,7 @@ def calculate_effective_schedule_end_dt(schedule): rrules_until_dates = [_rrule.until for _rrule in schedule.recurrences.rrules] # If we have a rrule without a until date we don't know the last date - if any(map(lambda x: x is None, rrules_until_dates)): + if any([x is None for x in rrules_until_dates]): return None possible_limit_dates = schedule.recurrences.rdates + rrules_until_dates @@ -422,7 +422,7 @@ def between(cls, after, before, schedules=None): episodes = {_episode.issue_date: _episode for _episode in episodes} transmission_dates = [ - imap(partial(_return_tuple, item2=schedule), schedule.dates_between(after, before)) + map(partial(_return_tuple, item2=schedule), schedule.dates_between(after, before)) for schedule in schedules ] sorted_transmission_dates = heapq.merge(*transmission_dates) diff --git a/radioco/apps/schedules/tests/test_recurrences.py b/radioco/apps/schedules/tests/test_recurrences.py index 635922b..f9f8db5 100644 --- a/radioco/apps/schedules/tests/test_recurrences.py +++ b/radioco/apps/schedules/tests/test_recurrences.py @@ -36,7 +36,7 @@ def test_when_date_doesnt_exist_on_february(self): start_dt = after_dt dts = self.monthly_recurrence.between(after_dt, before_dt, inc=True, dtstart=start_dt) - self.assertEquals(10, len(dts), dts) + self.assertEqual(10, len(dts), dts) # assert datetime.datetime(2014, 2, 29, 14, 0, 0) not in dts, day is out of range for month assert datetime.datetime(2014, 12, 29, 14, 0, 0) not in dts @@ -48,7 +48,7 @@ def test_last_date_is_equals_before_limit(self): dts = self.monthly_recurrence.between(after_dt, before_dt, inc=True, dtstart=start_dt) - self.assertEquals(2, len(dts), dts) + self.assertEqual(2, len(dts), dts) assert datetime.datetime(2014, 2, 20, 14, 0, 0) in dts def test_start_date_is_before_start_limit(self): @@ -58,30 +58,30 @@ def test_start_date_is_before_start_limit(self): dts = self.monthly_recurrence.between(after_dt, before_dt, inc=True, dtstart=start_dt) - self.assertEquals(1, len(dts), dts) + self.assertEqual(1, len(dts), dts) assert datetime.datetime(2014, 2, 19, 14, 0, 0) in dts def test_after(self): start_dt = datetime.datetime(2014, 1, 20, 14, 0, 0) after = datetime.datetime(2014, 1, 1, 13, 59, 59) dt = self.monthly_recurrence.after(after, dtstart=start_dt) - self.assertEquals(datetime.datetime(2014, 1, 20, 14, 0, 0), dt) + self.assertEqual(datetime.datetime(2014, 1, 20, 14, 0, 0), dt) after = start_dt dt = self.monthly_recurrence.after(after, dtstart=start_dt) - self.assertEquals(datetime.datetime(2014, 2, 20, 14, 0, 0), dt) + self.assertEqual(datetime.datetime(2014, 2, 20, 14, 0, 0), dt) def test_after_inclusive(self): start_dt = datetime.datetime(2014, 1, 20, 14, 0, 0) after = start_dt dt = self.monthly_recurrence.after(after, True, dtstart=start_dt) - self.assertEquals(datetime.datetime(2014, 1, 20, 14, 0, 0), dt) + self.assertEqual(datetime.datetime(2014, 1, 20, 14, 0, 0), dt) def test_before_dt(self): start_dt = datetime.datetime(2014, 1, 20, 14, 0, 0) before = datetime.datetime(2014, 1, 20, 14, 0, 1) dt = self.monthly_recurrence.before(before, dtstart=start_dt) - self.assertEquals(datetime.datetime(2014, 1, 20, 14, 0, 0), dt) + self.assertEqual(datetime.datetime(2014, 1, 20, 14, 0, 0), dt) before = start_dt assert self.monthly_recurrence.before(before, dtstart=start_dt) is None @@ -90,7 +90,7 @@ def test_before_inclusive(self): start_dt = datetime.datetime(2014, 1, 20, 14, 0, 0) before = start_dt dt = self.monthly_recurrence.before(before, True, dtstart=start_dt) - self.assertEquals(datetime.datetime(2014, 1, 20, 14, 0, 0), dt) + self.assertEqual(datetime.datetime(2014, 1, 20, 14, 0, 0), dt) def test_impossible_recurrence_after(self): """ @@ -102,7 +102,7 @@ def test_impossible_recurrence_after(self): rrules=[recurrence.Rule(recurrence.DAILY, until=until_dt)]) dt = daily_recurrence.after(start_dt, True, dtstart=start_dt) - self.assertEquals(start_dt, dt) # wrong! + self.assertEqual(start_dt, dt) # wrong! self.assertIsNone(recurrence_after(daily_recurrence, start_dt, start_dt)) @@ -116,7 +116,7 @@ def test_impossible_recurrence_before(self): rrules=[recurrence.Rule(recurrence.MONTHLY, until=until_dt)]) dt = daily_recurrence.before(start_dt + datetime.timedelta(seconds=1), dtstart=start_dt) - self.assertEquals(start_dt, dt) # wrong! + self.assertEqual(start_dt, dt) # wrong! self.assertIsNone(recurrence_before(daily_recurrence, start_dt + datetime.timedelta(seconds=1), start_dt)) @@ -135,7 +135,7 @@ def test_after(self): start_dt = datetime.datetime(2014, 1, 1, 14, 0, 0) after = datetime.datetime(2014, 1, 1, 13, 59, 59) dt = self.empty_recurrence.after(after, dtstart=start_dt) - self.assertEquals(datetime.datetime(2014, 1, 1, 14, 0, 0), dt) + self.assertEqual(datetime.datetime(2014, 1, 1, 14, 0, 0), dt) after = start_dt self.assertIsNone(self.empty_recurrence.after(after, dtstart=start_dt)) @@ -147,11 +147,11 @@ def test_after_inclusive(self): start_dt = datetime.datetime(2014, 1, 1, 14, 0, 0) after = datetime.datetime(2014, 1, 1, 13, 59, 59) dt = self.empty_recurrence.after(after, True, dtstart=start_dt) - self.assertEquals(datetime.datetime(2014, 1, 1, 14, 0, 0), dt) + self.assertEqual(datetime.datetime(2014, 1, 1, 14, 0, 0), dt) after = start_dt dt = self.empty_recurrence.after(after, True, dtstart=start_dt) - self.assertEquals(datetime.datetime(2014, 1, 1, 14, 0, 0), dt) + self.assertEqual(datetime.datetime(2014, 1, 1, 14, 0, 0), dt) after = datetime.datetime(2014, 1, 1, 14, 0, 1) self.assertIsNone(self.empty_recurrence.after(after, True, dtstart=start_dt)) @@ -160,7 +160,7 @@ def test_before(self): start_dt = datetime.datetime(2014, 1, 1, 14, 0, 0) before = datetime.datetime(2014, 1, 1, 14, 0, 1) dt = self.empty_recurrence.before(before, dtstart=start_dt) - self.assertEquals(datetime.datetime(2014, 1, 1, 14, 0, 0), dt) + self.assertEqual(datetime.datetime(2014, 1, 1, 14, 0, 0), dt) before = start_dt self.assertIsNone(self.empty_recurrence.before(before, dtstart=start_dt)) @@ -172,11 +172,11 @@ def test_before_inclusive(self): start_dt = datetime.datetime(2014, 1, 1, 14, 0, 0) before = datetime.datetime(2014, 1, 1, 14, 0, 1) dt = self.empty_recurrence.before(before, True, dtstart=start_dt) - self.assertEquals(datetime.datetime(2014, 1, 1, 14, 0, 0), dt) + self.assertEqual(datetime.datetime(2014, 1, 1, 14, 0, 0), dt) before = start_dt dt = self.empty_recurrence.before(before, True, dtstart=start_dt) - self.assertEquals(datetime.datetime(2014, 1, 1, 14, 0, 0), dt) + self.assertEqual(datetime.datetime(2014, 1, 1, 14, 0, 0), dt) before = datetime.datetime(2014, 1, 1, 13, 59, 59) self.assertIsNone(self.empty_recurrence.before(before, True, dtstart=start_dt)) diff --git a/radioco/apps/schedules/tests/test_schedules.py b/radioco/apps/schedules/tests/test_schedules.py index f949332..376ade5 100755 --- a/radioco/apps/schedules/tests/test_schedules.py +++ b/radioco/apps/schedules/tests/test_schedules.py @@ -45,10 +45,8 @@ def test_fields(self): schedule = Schedule() with self.assertRaisesMessage( ValidationError, - "{'calendar': [u'This field cannot be null.'], " - "'start_dt': [u'This field cannot be null.'], " - "'type': [u'This field cannot be blank.'], " - "'programme': [u'This field cannot be null.']}"): + "{'programme': ['This field cannot be null.'], 'type': ['This field cannot be blank.'], 'calendar': ['This field cannot be null.'], 'start_dt': ['This field cannot be null.']}" + ): schedule.clean_fields() @@ -132,7 +130,7 @@ def test_date_after_exclude(self): utc.localize(datetime.datetime(2014, 1, 13, 14, 0))) def test_dates_between(self): - self.assertItemsEqual( + self.assertCountEqual( self.schedule.dates_between( utc.localize(datetime.datetime(2014, 1, 1)), utc.localize(datetime.datetime(2014, 1, 14))), [utc.localize(datetime.datetime(2014, 1, 6, 14, 0)), @@ -142,7 +140,7 @@ def test_dates_between_later_start_by_programme(self): self.programme.start_date = datetime.date(2014, 1, 7) self.programme.save() self.schedule.refresh_from_db() - self.assertItemsEqual( + self.assertCountEqual( self.schedule.dates_between( utc.localize(datetime.datetime(2014, 1, 1)), utc.localize(datetime.datetime(2014, 1, 14))), [utc.localize(datetime.datetime(2014, 1, 13, 14, 0))]) @@ -151,7 +149,7 @@ def test_dates_between_earlier_end_by_programme(self): self.programme.end_date = datetime.date(2014, 1, 7) self.programme.save() self.schedule.refresh_from_db() - self.assertItemsEqual( + self.assertCountEqual( self.schedule.dates_between( utc.localize(datetime.datetime(2014, 1, 1)), utc.localize(datetime.datetime(2014, 1, 14))), [utc.localize(datetime.datetime(2014, 1, 6, 14, 0))]) @@ -167,7 +165,7 @@ def test_dates_between_complex_ruleset(self): exrules=[recurrence.Rule( recurrence.WEEKLY, byday=[recurrence.MO, recurrence.TU])])) - self.assertItemsEqual( + self.assertCountEqual( schedule.dates_between( utc.localize(datetime.datetime(2014, 1, 1)), utc.localize(datetime.datetime(2014, 1, 9))), [utc.localize(datetime.datetime(2014, 1, 2, 14, 0)), @@ -175,7 +173,7 @@ def test_dates_between_complex_ruleset(self): utc.localize(datetime.datetime(2014, 1, 8, 14, 0))]) def test_unicode(self): - self.assertEqual(unicode(self.schedule), 'Monday - 14:00:00') + self.assertEqual(str(self.schedule), 'Monday - 14:00:00') @mock.patch('django.utils.timezone.now', mock_now) def test_save_rearrange_episodes(self): @@ -206,7 +204,7 @@ def setUp(self): calendar=self.calendar) def test_dates_between_includes_started_episode(self): - self.assertItemsEqual( + self.assertCountEqual( self.schedule.dates_between( utc.localize(datetime.datetime(2014, 1, 2, 0, 0, 0)), utc.localize(datetime.datetime(2014, 1, 3, 23, 59, 59)) @@ -224,11 +222,11 @@ def test_between_includes_started_episode(self): utc.localize(datetime.datetime(2014, 1, 3, 23, 59, 59)) ) self.assertListEqual( - map(lambda t: (t.slug, t.start), list(between)), - [(u'classic-hits', utc.localize(datetime.datetime(2014, 1, 1, 23, 30, 0))), # Not finished yet - (u'classic-hits', utc.localize(datetime.datetime(2014, 1, 2, 0, 30, 0))), - (u'classic-hits', utc.localize(datetime.datetime(2014, 1, 2, 23, 30, 0))), - (u'classic-hits', utc.localize(datetime.datetime(2014, 1, 3, 23, 30, 0)))]) + [(t.slug, t.start) for t in list(between)], + [('classic-hits', utc.localize(datetime.datetime(2014, 1, 1, 23, 30, 0))), # Not finished yet + ('classic-hits', utc.localize(datetime.datetime(2014, 1, 2, 0, 30, 0))), + ('classic-hits', utc.localize(datetime.datetime(2014, 1, 2, 23, 30, 0))), + ('classic-hits', utc.localize(datetime.datetime(2014, 1, 3, 23, 30, 0)))]) class CalendarManagerTests(TestDataMixin, TestCase): @@ -247,11 +245,11 @@ def setUp(self): self.CalendarForm = modelform_factory(Calendar, fields=("name",)) def test_only_one_calendar_active(self): - self.assertEquals(len(Calendar.objects.filter(is_active=True)), 1) + self.assertEqual(len(Calendar.objects.filter(is_active=True)), 1) new_active_calendar = Calendar.objects.create(name="test", is_active=True) - self.assertEquals(Calendar.objects.get(is_active=True), new_active_calendar) + self.assertEqual(Calendar.objects.get(is_active=True), new_active_calendar) # XXX there is something fishy with form validation, check! # def test_name_required(self): @@ -293,13 +291,10 @@ def test_clone_calendar(self): self.assertEqual(num_of_schedules, cloned_calendar.schedule_set.count()) self.assertFalse( any( - map( - lambda x: x in schedule_ids, - [_schedule.id for _schedule in cloned_calendar.schedule_set.all()] - ) + [x in schedule_ids for x in [_schedule.id for _schedule in cloned_calendar.schedule_set.all()]] ) ) - self.assertNotEquals( + self.assertNotEqual( frozenset([_schedule.id for _schedule in self.calendar.schedule_set.all()]), frozenset([_schedule.id for _schedule in cloned_calendar.schedule_set.all()]), ) @@ -351,18 +346,18 @@ def test_episode__url(self): def test_at(self): now = Transmission.at(utc.localize(datetime.datetime(2015, 1, 6, 11, 59, 59))) self.assertListEqual( - map(lambda t: (t.slug, t.start), list(now)), - [(u'the-best-wine', utc.localize(datetime.datetime(2015, 1, 6, 11, 0, 0)))]) + [(t.slug, t.start) for t in list(now)], + [('the-best-wine', utc.localize(datetime.datetime(2015, 1, 6, 11, 0, 0)))]) now = Transmission.at(utc.localize(datetime.datetime(2015, 1, 6, 12, 0, 0))) self.assertListEqual( - map(lambda t: (t.slug, t.start), list(now)), - [(u'local-gossips', utc.localize(datetime.datetime(2015, 1, 6, 12, 0, 0)))]) + [(t.slug, t.start) for t in list(now)], + [('local-gossips', utc.localize(datetime.datetime(2015, 1, 6, 12, 0, 0)))]) now = Transmission.at(utc.localize(datetime.datetime(2015, 1, 6, 12, 59, 59))) self.assertListEqual( - map(lambda t: (t.slug, t.start), list(now)), - [(u'local-gossips', utc.localize(datetime.datetime(2015, 1, 6, 12, 0, 0)))]) + [(t.slug, t.start) for t in list(now)], + [('local-gossips', utc.localize(datetime.datetime(2015, 1, 6, 12, 0, 0)))]) now = Transmission.at(utc.localize(datetime.datetime(2015, 1, 6, 13, 0, 0))) self.assertListEqual(list(now), []) @@ -372,10 +367,10 @@ def test_between(self): utc.localize(datetime.datetime(2015, 1, 6, 11, 0, 0)), utc.localize(datetime.datetime(2015, 1, 6, 17, 0, 0))) self.assertListEqual( - map(lambda t: (t.slug, t.start), list(between)), - [(u'the-best-wine', utc.localize(datetime.datetime(2015, 1, 6, 11, 0))), - (u'local-gossips', utc.localize(datetime.datetime(2015, 1, 6, 12, 0))), - (u'classic-hits', utc.localize(datetime.datetime(2015, 1, 6, 14, 0)))]) + [(t.slug, t.start) for t in list(between)], + [('the-best-wine', utc.localize(datetime.datetime(2015, 1, 6, 11, 0))), + ('local-gossips', utc.localize(datetime.datetime(2015, 1, 6, 12, 0))), + ('classic-hits', utc.localize(datetime.datetime(2015, 1, 6, 14, 0)))]) def test_between_by_queryset(self): between = Transmission.between( @@ -384,8 +379,8 @@ def test_between_by_queryset(self): schedules=Schedule.objects.filter( calendar=self.another_calendar).all()) self.assertListEqual( - map(lambda t: (t.slug, t.start), list(between)), - [(u'classic-hits', utc.localize(datetime.datetime(2015, 1, 6, 16, 30, 0)))]) + [(t.slug, t.start) for t in list(between)], + [('classic-hits', utc.localize(datetime.datetime(2015, 1, 6, 16, 30, 0)))]) @override_settings(TIME_ZONE='UTC') @@ -427,19 +422,19 @@ def test_available_dates_after(self): rrules=[recurrence.Rule(recurrence.WEEKLY)])) dates = next_dates(self.calendar, self.programme, utc.localize(datetime.datetime(2015, 1, 5))) - self.assertEqual(dates.next(), utc.localize(datetime.datetime(2015, 1, 5, 14, 0))) - self.assertEqual(dates.next(), utc.localize(datetime.datetime(2015, 1, 6, 14, 0))) - self.assertEqual(dates.next(), utc.localize(datetime.datetime(2015, 1, 6, 16, 0))) + self.assertEqual(next(dates), utc.localize(datetime.datetime(2015, 1, 5, 14, 0))) + self.assertEqual(next(dates), utc.localize(datetime.datetime(2015, 1, 6, 14, 0))) + self.assertEqual(next(dates), utc.localize(datetime.datetime(2015, 1, 6, 16, 0))) def test_available_dates_none(self): dates = next_dates(self.calendar, Programme(), timezone.now()) with self.assertRaises(StopIteration): - dates.next() + next(dates) def test_rearrange_episodes(self): self.programme.rearrange_episodes(pytz.utc.localize(datetime.datetime(2015, 1, 1)), Calendar.get_active()) self.assertListEqual( - map(lambda e: e.issue_date, self.programme.episode_set.all().order_by('issue_date')[:5]), + [e.issue_date for e in self.programme.episode_set.all().order_by('issue_date')[:5]], [ utc.localize(datetime.datetime(2015, 1, 1, 14, 0)), utc.localize(datetime.datetime(2015, 1, 2, 14, 0)), @@ -468,7 +463,7 @@ def test_rearrange_episodes_new_schedule(self): # save should call rearrange # rearrange_programme_episodes(self.programme, pytz.utc.localize(datetime.datetime(2015, 1, 1))) self.assertListEqual( - map(lambda e: e.issue_date, self.programme.episode_set.all().order_by('issue_date')[:5]), + [e.issue_date for e in self.programme.episode_set.all().order_by('issue_date')[:5]], [ utc.localize(datetime.datetime(2015, 1, 1, 14, 0)), utc.localize(datetime.datetime(2015, 1, 2, 14, 0)), @@ -492,7 +487,7 @@ def test_rearrange_only_non_emited_episodes(self): recurrence.WEEKLY, until=utc.localize(datetime.datetime(2015, 1, 31, 16, 0, 0)))])) # save should call rearrange self.assertListEqual( - map(lambda e: e.issue_date, self.programme.episode_set.all().order_by('issue_date')[:5]), + [e.issue_date for e in self.programme.episode_set.all().order_by('issue_date')[:5]], [ utc.localize(datetime.datetime(2015, 1, 1, 14, 0)), utc.localize(datetime.datetime(2015, 1, 2, 14, 0)), diff --git a/radioco/apps/schedules/tests/test_timezone.py b/radioco/apps/schedules/tests/test_timezone.py index e6ef96c..e2ec09a 100644 --- a/radioco/apps/schedules/tests/test_timezone.py +++ b/radioco/apps/schedules/tests/test_timezone.py @@ -70,11 +70,11 @@ def setUp(self): def test_transform_dt_to_default_tz(self): utc_dt = pytz.utc.localize(datetime.datetime(2017, 1, 1, 0, 00, 00)) spain_dt = transform_dt_to_default_tz(utc_dt) - self.assertEquals(spain_dt.tzinfo.zone, 'Europe/Madrid') - self.assertEquals(spain_dt, SPAIN_TZ.localize(datetime.datetime(2017, 1, 1, 1, 0, 0))) + self.assertEqual(spain_dt.tzinfo.zone, 'Europe/Madrid') + self.assertEqual(spain_dt, SPAIN_TZ.localize(datetime.datetime(2017, 1, 1, 1, 0, 0))) def test_cleaned_internal_recurrence_dates(self): - self.assertEquals( + self.assertEqual( self.cest_schedule.recurrences.rrules[0].until, SPAIN_TZ.localize(datetime.datetime(2017, 3, 27, 23, 59, 59))) @@ -89,7 +89,7 @@ def test_CEST_transition(self): SPAIN_TZ.localize(datetime.datetime(2017, 3, 26, 10, 0, 0)), SPAIN_TZ.localize(datetime.datetime(2017, 3, 27, 10, 0, 0)), ) - self.assertItemsEqual(expected_dates, dates_between) + self.assertCountEqual(expected_dates, dates_between) def test_CET_transition(self): after = SPAIN_TZ.localize(datetime.datetime(2017, 10, 28, 14, 0, 0)) @@ -102,4 +102,4 @@ def test_CET_transition(self): SPAIN_TZ.localize(datetime.datetime(2017, 10, 29, 14, 0, 0)), SPAIN_TZ.localize(datetime.datetime(2017, 10, 30, 14, 0, 0)), ) - self.assertItemsEqual(expected_dates, dates_between) \ No newline at end of file + self.assertCountEqual(expected_dates, dates_between) \ No newline at end of file diff --git a/radioco/apps/schedules/utils.py b/radioco/apps/schedules/utils.py index 9262086..e60aeae 100644 --- a/radioco/apps/schedules/utils.py +++ b/radioco/apps/schedules/utils.py @@ -13,9 +13,9 @@ def next_dates(calendar, programme, after): schedules = Schedule.objects.filter(programme=programme, type='L', calendar=calendar) while True: - candidates = map(lambda s: s.date_after(after), schedules) + candidates = [s.date_after(after) for s in schedules] try: - next_date = min(filter(lambda _dt: _dt is not None, candidates)) + next_date = min([_dt for _dt in candidates if _dt is not None]) except ValueError: break diff --git a/radioco/apps/schedules/views.py b/radioco/apps/schedules/views.py index 8b0599b..1366460 100755 --- a/radioco/apps/schedules/views.py +++ b/radioco/apps/schedules/views.py @@ -38,7 +38,7 @@ def schedule_list(request): context = { 'min_time': calendar_configuration.min_time.strftime('%H:%M:%S'), 'max_time': calendar_configuration.max_time.strftime('%H:%M:%S'), - 'slot_duration': unicode(calendar_configuration.slot_duration), + 'slot_duration': str(calendar_configuration.slot_duration), 'first_day': calendar_configuration.first_day + 1, 'language': request.LANGUAGE_CODE, 'transmissions': reverse('api:transmission-list'), diff --git a/radioco/apps/users/migrations/0001_initial.py b/radioco/apps/users/migrations/0001_initial.py index b1088c0..218db4b 100755 --- a/radioco/apps/users/migrations/0001_initial.py +++ b/radioco/apps/users/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import models, migrations from django.conf import settings @@ -17,7 +17,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('bio', models.TextField(verbose_name='biography', blank=True)), - ('avatar', models.ImageField(default=b'/static/radio/images/default-userprofile-avatar.jpg', upload_to=b'avatars/', verbose_name='avatar')), + ('avatar', models.ImageField(default='/static/radio/images/default-userprofile-avatar.jpg', upload_to='avatars/', verbose_name='avatar')), ('display_personal_page', models.BooleanField(default=False, verbose_name='display personal page')), ('slug', models.SlugField(max_length=30)), ('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)), diff --git a/radioco/apps/users/migrations/0002_change_textfield_to_richtextfield.py b/radioco/apps/users/migrations/0002_change_textfield_to_richtextfield.py index 9c95392..de82844 100755 --- a/radioco/apps/users/migrations/0002_change_textfield_to_richtextfield.py +++ b/radioco/apps/users/migrations/0002_change_textfield_to_richtextfield.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import models, migrations import ckeditor.fields diff --git a/radioco/apps/users/migrations/0003_auto_20160104_2029.py b/radioco/apps/users/migrations/0003_auto_20160104_2029.py index 919eb89..babdc47 100644 --- a/radioco/apps/users/migrations/0003_auto_20160104_2029.py +++ b/radioco/apps/users/migrations/0003_auto_20160104_2029.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import migrations, models @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='userprofile', name='avatar', - field=models.ImageField(default=b'defaults/default-userprofile-avatar.jpg', upload_to=b'avatars/', verbose_name='avatar'), + field=models.ImageField(default='defaults/default-userprofile-avatar.jpg', upload_to='avatars/', verbose_name='avatar'), ), ] diff --git a/radioco/apps/users/migrations/0004__v3_0__ckeditor_upload_field.py b/radioco/apps/users/migrations/0004__v3_0__ckeditor_upload_field.py index ce3a2bb..f8ebf25 100644 --- a/radioco/apps/users/migrations/0004__v3_0__ckeditor_upload_field.py +++ b/radioco/apps/users/migrations/0004__v3_0__ckeditor_upload_field.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals + from django.db import migrations, models import ckeditor_uploader.fields diff --git a/radioco/apps/users/models.py b/radioco/apps/users/models.py index d1fb04a..8434d5e 100755 --- a/radioco/apps/users/models.py +++ b/radioco/apps/users/models.py @@ -51,7 +51,7 @@ class Meta: verbose_name = _('user profile') verbose_name_plural = _('user profile') - def __unicode__(self): + def __str__(self): return "%s's profile" % self.user diff --git a/radioco/configs/base/settings.py b/radioco/configs/base/settings.py index 86d69a2..851967a 100755 --- a/radioco/configs/base/settings.py +++ b/radioco/configs/base/settings.py @@ -17,6 +17,11 @@ import os + +def str_to_bool(text): + return str(text).lower() not in ('none', 'false', 'no', '0') + + BASE_DIR = os.path.dirname(os.path.dirname(__file__)) SITE_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) @@ -30,11 +35,11 @@ ################################################################################## -# SECURITY WARNING: override this variable and keep the secret key used in production secret! -SECRET_KEY = '(h_$1pj(&usx%kw^m6$7*x9pnar+t_136g!3)g#+eje5r^3(!+' +SECRET_KEY = os.environ['SECRET_KEY'] -DEBUG = True +DEBUG = str_to_bool(os.environ.get('DEBUG')) TESTING_MODE = False +ALLOWED_HOSTS = '*' # Application definition INSTALLED_APPS = ( @@ -53,6 +58,7 @@ 'django.contrib.humanize', 'ckeditor', + 'ckeditor_uploader', 'rest_framework', 'rest_framework.authtoken', 'django_filters', @@ -111,8 +117,12 @@ DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'postgres', + 'USER': 'postgres', + 'PASSWORD': 'postgres', + 'HOST': 'postgres', + 'PORT': 5432, } } @@ -121,7 +131,7 @@ LANGUAGE_CODE = 'en' -TIME_ZONE = 'Europe/Madrid' +TIME_ZONE = os.environ['TIME_ZONE'] USE_I18N = True @@ -190,9 +200,9 @@ ) # Disqus -DISQUS_ENABLE = False -DISQUS_API_KEY = '' -DISQUS_WEBSITE_SHORTNAME = '' +DISQUS_ENABLE = bool(os.environ['DISQUS_API_KEY']) +DISQUS_API_KEY = os.environ['DISQUS_API_KEY'] +DISQUS_WEBSITE_SHORTNAME = os.environ['DISQUS_WEBSITE_SHORTNAME'] # Admin GRAPPELLI_ADMIN_HEADLINE = 'RadioCo' @@ -203,3 +213,26 @@ from local_settings import * except ImportError: pass + + +if DEBUG: + # Django Debug Toolbar + INSTALLED_APPS += ( + 'debug_toolbar', + ) + MIDDLEWARE_CLASSES += ( + 'debug_toolbar.middleware.DebugToolbarMiddleware', + ) + DEBUG_TOOLBAR_CONFIG = { + 'SHOW_TOOLBAR_CALLBACK': lambda request: True, + } +else: + # Enabling cache + TEMPLATES[0]['OPTIONS']['loaders'] = [('django.template.loaders.cached.Loader', TEMPLATES[0]['OPTIONS']['loaders'])] + CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', + 'LOCATION': 'memcached:11211', + } + } + SESSION_ENGINE = 'django.contrib.sessions.backends.cache' \ No newline at end of file diff --git a/radioco/configs/base/urls.py b/radioco/configs/base/urls.py index 9785351..0026644 100755 --- a/radioco/configs/base/urls.py +++ b/radioco/configs/base/urls.py @@ -62,8 +62,8 @@ url(r'^$', 'radioco.apps.radioco.views.index', name="home"), url(r'^jsi18n/$', javascript_catalog, js_info_dict, name='javascript-catalog'), url(r'^logout/$', 'radioco.apps.radioco.views.user_logout', name="logout"), - url(r'^grappelli/', include('grappelli.urls')), url(r'^admin/filebrowser/', include(site.urls)), + url(r'^grappelli/', include('grappelli.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^admin/password_reset/$', auth_views.password_reset, name='admin_password_reset'), url(r'^admin/password_reset/done/$', auth_views.password_reset_done, name='password_reset_done'), diff --git a/radioco/configs/base/wsgi.py b/radioco/configs/base/wsgi.py new file mode 100644 index 0000000..31baa44 --- /dev/null +++ b/radioco/configs/base/wsgi.py @@ -0,0 +1,5 @@ +import os +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "radioco.configs.base.settings") + +from django.core.wsgi import get_wsgi_application +application = get_wsgi_application() diff --git a/radioco/locale/es/LC_MESSAGES/django.mo b/radioco/locale/es/LC_MESSAGES/django.mo index 0bd94d9d7001ea55cfd04e67af20271d02c13f00..e6888f64276b6d8d4e7e83d4b8f857ad2029ce41 100755 GIT binary patch delta 29 kcmZ3PyfS&iRCxglT|)z1BMSvXLn{MIZ3Dy2OXXRF0F4X?C;$Ke delta 29 kcmZ3PyfS&iRCxh&T>~>+BNGKfLn~8LZ3CmtOXXRF0F5XJDgXcg diff --git a/radioco/locale/es/LC_MESSAGES/django.po b/radioco/locale/es/LC_MESSAGES/django.po index c1d9e01..b2cacbf 100755 --- a/radioco/locale/es/LC_MESSAGES/django.po +++ b/radioco/locale/es/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: django-radio\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-06-24 11:55+0200\n" +"POT-Creation-Date: 2018-10-28 11:09+0100\n" "PO-Revision-Date: 2016-12-24 16:19+0000\n" "Last-Translator: RadioCo.org \n" "Language-Team: Spanish (http://www.transifex.com/radioco/django-radio/" @@ -249,36 +249,36 @@ msgstr "Este usuario ya tiene un papel en este programa" msgid "Advanced options" msgstr "Opciones avanzadas" -#: radioco/apps/programmes/admin.py:159 +#: radioco/apps/programmes/admin.py:161 msgid "This user has already a role in this episode." msgstr "Este usuario ya tiene un papel en este episodio" -#: radioco/apps/programmes/admin.py:212 radioco/apps/programmes/admin.py:219 +#: radioco/apps/programmes/admin.py:214 radioco/apps/programmes/admin.py:221 msgid "There are no available schedules." msgstr "No hay horarios disponibles" -#: radioco/apps/programmes/admin.py:227 radioco/apps/programmes/models.py:44 +#: radioco/apps/programmes/admin.py:229 radioco/apps/programmes/models.py:44 #: radioco/apps/radioco/templates/radioco/base.html:68 msgid "programmes" msgstr "programas" -#: radioco/apps/programmes/admin.py:243 radioco/apps/programmes/models.py:233 +#: radioco/apps/programmes/admin.py:245 radioco/apps/programmes/models.py:233 msgid "issue date" msgstr "fecha de emisión" -#: radioco/apps/programmes/admin.py:248 +#: radioco/apps/programmes/admin.py:250 msgid "Next episodes" msgstr "Próximos episodios" -#: radioco/apps/programmes/admin.py:249 +#: radioco/apps/programmes/admin.py:251 msgid "Until now" msgstr "Hasta ahora" -#: radioco/apps/programmes/admin.py:250 +#: radioco/apps/programmes/admin.py:252 msgid "Last week" msgstr "Última semana" -#: radioco/apps/programmes/admin.py:251 +#: radioco/apps/programmes/admin.py:253 msgid "Since two weeks ago" msgstr "Desde hace dos semanas" @@ -664,17 +664,17 @@ msgid "Make a Clone of the selected calendar" msgstr "Hacer una copia del calendario selecionado" #: radioco/apps/schedules/models.py:33 -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:340 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:339 msgid "live" msgstr "directo" #: radioco/apps/schedules/models.py:34 -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:346 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:345 msgid "broadcast" msgstr "retransmisión" #: radioco/apps/schedules/models.py:35 -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:352 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:351 msgid "broadcast syndication" msgstr "redifusión" @@ -782,35 +782,35 @@ msgstr "Ocurrió un error en la petición" msgid "There was an error while reloading programmes" msgstr "Ocurrió un error mientras se actualizaban los programas" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:288 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:287 msgid "Updated programme" msgstr "Actualizado programa" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:291 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:290 msgid "Added programme" msgstr "Añadido programa" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:294 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:293 msgid "Updated schedule" msgstr "Actualizado horario" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:328 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:327 msgid "Programmes" msgstr "Programas" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:336 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:335 msgid "Programme type" msgstr "Tipo de programa" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:371 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:370 msgid "Delete transmission?" msgstr "Eliminar transmisión?" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:377 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:376 msgid "Cancel" msgstr "Cancelar" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:378 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:377 msgid "I am sure" msgstr "Estoy seguro" @@ -826,7 +826,7 @@ msgstr "" msgid "Would you like to delete this transmission?" msgstr "Quieres borrar esta transmisión?" -#: radioco/apps/schedules/templates/schedules/schedules_list.html:8 +#: radioco/apps/schedules/templates/schedules/schedules_list.html:12 msgid "Schedule" msgstr "Horarios" @@ -892,15 +892,15 @@ msgstr "Personas que han hecho esto posible" msgid "No userprofiles are available" msgstr "No hay perfiles disponibles" -#: radioco/configs/base/settings.py:187 +#: radioco/configs/base/settings.py:197 msgid "Spanish" msgstr "Español" -#: radioco/configs/base/settings.py:188 +#: radioco/configs/base/settings.py:198 msgid "English" msgstr "Inglés" -#: radioco/configs/base/settings.py:189 +#: radioco/configs/base/settings.py:199 msgid "Galician" msgstr "Gallego" diff --git a/radioco/locale/gl/LC_MESSAGES/django.mo b/radioco/locale/gl/LC_MESSAGES/django.mo index 472872dbf63a506b5c015be95224df352f5f83c5..ea4ff4cf52a688670f83ca6770c52775b3830936 100755 GIT binary patch delta 29 kcmX>RcOq`XF*yMXT|)z1BMSvXLn{MIZ3Dy2*W`)>0GQ$lC;$Ke delta 29 kcmX>RcOq`XF*yNqT>~>+BNGKfLn~8LZ3Cmt*W`)>0GR#>DgXcg diff --git a/radioco/locale/gl/LC_MESSAGES/django.po b/radioco/locale/gl/LC_MESSAGES/django.po index 430ce3e..3b3d99c 100755 --- a/radioco/locale/gl/LC_MESSAGES/django.po +++ b/radioco/locale/gl/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-06-24 11:55+0200\n" +"POT-Creation-Date: 2018-10-28 11:09+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -248,36 +248,36 @@ msgstr "Este usuario xa ten un papel neste programa." msgid "Advanced options" msgstr "Opcions avanzadas" -#: radioco/apps/programmes/admin.py:159 +#: radioco/apps/programmes/admin.py:161 msgid "This user has already a role in this episode." msgstr "Este usuario xa ten un papel neste episodio." -#: radioco/apps/programmes/admin.py:212 radioco/apps/programmes/admin.py:219 +#: radioco/apps/programmes/admin.py:214 radioco/apps/programmes/admin.py:221 msgid "There are no available schedules." msgstr "Non hai horarios dispoñibles" -#: radioco/apps/programmes/admin.py:227 radioco/apps/programmes/models.py:44 +#: radioco/apps/programmes/admin.py:229 radioco/apps/programmes/models.py:44 #: radioco/apps/radioco/templates/radioco/base.html:68 msgid "programmes" msgstr "programas" -#: radioco/apps/programmes/admin.py:243 radioco/apps/programmes/models.py:233 +#: radioco/apps/programmes/admin.py:245 radioco/apps/programmes/models.py:233 msgid "issue date" msgstr "Data de emisión" -#: radioco/apps/programmes/admin.py:248 +#: radioco/apps/programmes/admin.py:250 msgid "Next episodes" msgstr "Próximos episodios" -#: radioco/apps/programmes/admin.py:249 +#: radioco/apps/programmes/admin.py:251 msgid "Until now" msgstr "Ata agora" -#: radioco/apps/programmes/admin.py:250 +#: radioco/apps/programmes/admin.py:252 msgid "Last week" msgstr "Ultima semana" -#: radioco/apps/programmes/admin.py:251 +#: radioco/apps/programmes/admin.py:253 msgid "Since two weeks ago" msgstr "Desde fai dúas semanas" @@ -663,17 +663,17 @@ msgid "Make a Clone of the selected calendar" msgstr "Facer unha copia da grella" #: radioco/apps/schedules/models.py:33 -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:340 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:339 msgid "live" msgstr "Directo" #: radioco/apps/schedules/models.py:34 -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:346 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:345 msgid "broadcast" msgstr "Retransmisión" #: radioco/apps/schedules/models.py:35 -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:352 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:351 msgid "broadcast syndication" msgstr "Redifusión" @@ -779,35 +779,35 @@ msgstr "Ocorreu un erro na petición" msgid "There was an error while reloading programmes" msgstr "Ocorreu un erro cando se actualizaban os programas" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:288 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:287 msgid "Updated programme" msgstr "Actualizouse o programa" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:291 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:290 msgid "Added programme" msgstr "Añadiuse o programa" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:294 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:293 msgid "Updated schedule" msgstr "Actualizouse o horario" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:328 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:327 msgid "Programmes" msgstr "Programas" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:336 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:335 msgid "Programme type" msgstr "Tipo de programa" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:371 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:370 msgid "Delete transmission?" msgstr "Borrar transmisión?" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:377 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:376 msgid "Cancel" msgstr "Cancelar" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:378 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:377 msgid "I am sure" msgstr "Estou seguro" @@ -823,7 +823,7 @@ msgstr "" msgid "Would you like to delete this transmission?" msgstr "Queres borrar esta transmisión?" -#: radioco/apps/schedules/templates/schedules/schedules_list.html:8 +#: radioco/apps/schedules/templates/schedules/schedules_list.html:12 msgid "Schedule" msgstr "Horario" @@ -889,15 +889,15 @@ msgstr "As persoas que fan isto posible" msgid "No userprofiles are available" msgstr "Non hai perfiles de usuario dispoñibles" -#: radioco/configs/base/settings.py:187 +#: radioco/configs/base/settings.py:197 msgid "Spanish" msgstr "Castelán" -#: radioco/configs/base/settings.py:188 +#: radioco/configs/base/settings.py:198 msgid "English" msgstr "Inglés" -#: radioco/configs/base/settings.py:189 +#: radioco/configs/base/settings.py:199 msgid "Galician" msgstr "Galego" diff --git a/radioco/locale/tr/LC_MESSAGES/django.mo b/radioco/locale/tr/LC_MESSAGES/django.mo index 9e46d4942ff19010813a65ccf65cc8598191739d..40d0f1421fb53aa2c0579191b4d01ad96f8da5b9 100644 GIT binary patch delta 29 kcmaDa_Fim*DZ7A$uAzahk%fYxp_PH9wt?YhS9UEH0Do);LI3~& delta 29 kcmaDa_Fim*DZ7BVu7R1Zk%@w#p_Qqrwt>-RS9UEH0Dp)FL;wH) diff --git a/radioco/locale/tr/LC_MESSAGES/django.po b/radioco/locale/tr/LC_MESSAGES/django.po index a3ac981..a520d83 100644 --- a/radioco/locale/tr/LC_MESSAGES/django.po +++ b/radioco/locale/tr/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: django-radio\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-06-24 11:55+0200\n" +"POT-Creation-Date: 2018-10-28 11:09+0100\n" "PO-Revision-Date: 2016-12-24 16:08+0000\n" "Last-Translator: RadioCo.org \n" "Language-Team: Turkish (http://www.transifex.com/radioco/django-radio/" @@ -246,36 +246,36 @@ msgstr "Bu kullanıcı zaten bu program içerisinde bir role sahip." msgid "Advanced options" msgstr "" -#: radioco/apps/programmes/admin.py:159 +#: radioco/apps/programmes/admin.py:161 msgid "This user has already a role in this episode." msgstr "Bu kullanıcı zaten bu bölüm içerisinde bir role sahip." -#: radioco/apps/programmes/admin.py:212 radioco/apps/programmes/admin.py:219 +#: radioco/apps/programmes/admin.py:214 radioco/apps/programmes/admin.py:221 msgid "There are no available schedules." msgstr "Hiç geçerli zamanlama yok." -#: radioco/apps/programmes/admin.py:227 radioco/apps/programmes/models.py:44 +#: radioco/apps/programmes/admin.py:229 radioco/apps/programmes/models.py:44 #: radioco/apps/radioco/templates/radioco/base.html:68 msgid "programmes" msgstr "programlar" -#: radioco/apps/programmes/admin.py:243 radioco/apps/programmes/models.py:233 +#: radioco/apps/programmes/admin.py:245 radioco/apps/programmes/models.py:233 msgid "issue date" msgstr "yayın tarihi" -#: radioco/apps/programmes/admin.py:248 +#: radioco/apps/programmes/admin.py:250 msgid "Next episodes" msgstr "Sonraki bölümler" -#: radioco/apps/programmes/admin.py:249 +#: radioco/apps/programmes/admin.py:251 msgid "Until now" msgstr "Şimdiye kadar" -#: radioco/apps/programmes/admin.py:250 +#: radioco/apps/programmes/admin.py:252 msgid "Last week" msgstr "Son hafta" -#: radioco/apps/programmes/admin.py:251 +#: radioco/apps/programmes/admin.py:253 msgid "Since two weeks ago" msgstr "İki haftadan beri" @@ -661,17 +661,17 @@ msgid "Make a Clone of the selected calendar" msgstr "" #: radioco/apps/schedules/models.py:33 -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:340 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:339 msgid "live" msgstr "canlı" #: radioco/apps/schedules/models.py:34 -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:346 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:345 msgid "broadcast" msgstr "yayın" #: radioco/apps/schedules/models.py:35 -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:352 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:351 msgid "broadcast syndication" msgstr "" @@ -777,35 +777,35 @@ msgstr "İstek yapılırken bir sorun oluştu" msgid "There was an error while reloading programmes" msgstr "" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:288 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:287 msgid "Updated programme" msgstr "" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:291 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:290 msgid "Added programme" msgstr "" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:294 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:293 msgid "Updated schedule" msgstr "" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:328 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:327 msgid "Programmes" msgstr "" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:336 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:335 msgid "Programme type" msgstr "Program tipi" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:371 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:370 msgid "Delete transmission?" msgstr "" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:377 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:376 msgid "Cancel" msgstr "" -#: radioco/apps/schedules/templates/admin/schedules/calendar.html:378 +#: radioco/apps/schedules/templates/admin/schedules/calendar.html:377 msgid "I am sure" msgstr "" @@ -819,7 +819,7 @@ msgstr "" msgid "Would you like to delete this transmission?" msgstr "" -#: radioco/apps/schedules/templates/schedules/schedules_list.html:8 +#: radioco/apps/schedules/templates/schedules/schedules_list.html:12 msgid "Schedule" msgstr "" @@ -884,15 +884,15 @@ msgstr "" msgid "No userprofiles are available" msgstr "" -#: radioco/configs/base/settings.py:187 +#: radioco/configs/base/settings.py:197 msgid "Spanish" msgstr "" -#: radioco/configs/base/settings.py:188 +#: radioco/configs/base/settings.py:198 msgid "English" msgstr "" -#: radioco/configs/base/settings.py:189 +#: radioco/configs/base/settings.py:199 msgid "Galician" msgstr "" diff --git a/requirements.txt b/requirements.txt index 9aed376..ced76f4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,12 +1,26 @@ -Django==1.8.18 +Django==1.8.19 +psycopg2-binary==2.7.5 Pillow==3.4.2 python-dateutil==2.6.0 -pytz==2017.2 +pytz==2018.6 django-grappelli==2.7.3 -django-filebrowser==3.7.2 +django-filebrowser==3.6.4 djangorestframework==3.6.3 django-filter==1.0.4 -django-ckeditor==5.1.1 +django-ckeditor==5.3.1 django-disqus==0.5 beautifulsoup4==4.6.0 -git+git://github.com/iago1460/django-recurrence.git@v3.1 \ No newline at end of file +git+git://github.com/iago1460/django-recurrence.git@v3.1 + +# Prod +python-memcached==1.59 +uwsgi==2.0.17.1 + +# Dev +invoke==0.14.0 +django-debug-toolbar==1.6 +transifex-client==0.13.5 +coverage==4.5.1 +sphinx==1.8.1 +sphinx-intl==0.9.11 +sphinx_rtd_theme==0.4.2 diff --git a/run b/run index ae8ec1d..8666895 100755 --- a/run +++ b/run @@ -21,23 +21,65 @@ If an unknown command is specified, it will be passed to docker-compose. e.g: EOF } +STAGING_COMPOSE_FILES="-f docker-compose.yaml -f docker-compose.staging.yaml" +COMPOSE_FILES="" + +function start_dev(){ + if [ ! -f ".env" ]; then + cp -v .sample.env .env + echo "Creating .env file. Update your environment variables and try again." + exit 0 + fi + docker-compose $COMPOSE_FILES down --remove-orphans + docker-compose $COMPOSE_FILES build + export_file_vars .env + docker-compose $COMPOSE_FILES up -d + echo "RadioCo is running at http://127.0.0.1:${PORT_BACKEND}" +} + function start(){ - docker-compose down - docker-compose build - docker-compose run --rm django sh /radioco/docker/scripts/setup.sh - docker-compose up -d + COMPOSE_FILES=$STAGING_COMPOSE_FILES + start_dev } function shell(){ - docker-compose run --rm django /bin/bash + docker-compose run --rm django /bin/bash "$@" } function manage(){ - docker-compose run --rm --no-deps django python manage.py "$@" + docker-compose run --rm --no-deps django python3 manage.py "$@" } +function test(){ + manage test radioco "$@" +} + + +function coverage(){ + docker-compose run -e COVERAGE_FILE=reports/.coverage.docker.xml --rm --volume "$(pwd)/reports:/radioco/reports" django coverage run manage.py test radioco +} + + +function export_file_vars() { + # Exports values from .env files, but without clobbering existing variables + filename=$1 + while read -r line; do + if [[ $line =~ ^([^=#]+)=(.*)$ ]]; then + key=${BASH_REMATCH[1]} + value=${BASH_REMATCH[2]} + existing_value=${!key} + if [ -z $existing_value ]; then + export $key="$value" + fi + fi + done < $filename +} + +export_file_vars .env + + if [ $# -eq 0 ]; then help elif [ "$(type -t $1)" == 'function' ]; then diff --git a/tasks/__init__.py b/tasks/__init__.py index 85cfe21..ddb2ff4 100644 --- a/tasks/__init__.py +++ b/tasks/__init__.py @@ -1,13 +1,8 @@ from invoke import Collection -from . import heroku, radioco, docker, docs, locale +from . import docs, locale ns = Collection() -ns.add_collection(heroku) -ns.add_collection(docker) ns.add_collection(docs) ns.add_collection(locale) -ns.add_task(radioco.quickstart) -ns.add_task(radioco.commit_changes) -ns.add_task(radioco.checkout_latest) diff --git a/tasks/docker.py b/tasks/docker.py deleted file mode 100644 index ff9e7aa..0000000 --- a/tasks/docker.py +++ /dev/null @@ -1,191 +0,0 @@ -from contextlib import contextmanager -from functools import wraps - -from invoke import task - -import os -from .utils import chdir, HOME_DIR, BASE_DIR, parse_requirements - - -@contextmanager -def _generate_requirements_file(ctx): - requirements_path = os.path.join(ctx['env_path'], 'requirements.txt') - tmp_requirement_path = os.path.join(ctx['env_path'], 'tmp_requirements.txt') - requirements = [_req for _req in parse_requirements(requirements_path)] - with open(tmp_requirement_path, 'w+') as file: - file.writelines('\n'.join(requirements)) - yield - ctx.run('rm {env_path}/tmp_requirements.txt'.format(**ctx)) - - -@contextmanager -def _ssh_support(ctx): - if os.path.isfile(os.path.join(HOME_DIR, '.ssh/id_rsa.pub')): - ctx.run('cp ~/.ssh/id_rsa.pub {env_path}/id_rsa.pub'.format(**ctx)) - else: - ctx.run('touch {env_path}/id_rsa.pub'.format(**ctx)) - yield - ctx.run('rm {env_path}/id_rsa.pub'.format(**ctx)) - - -def _set_env(ctx, environment): - ctx['environment'] = ctx.get('environment', environment) or 'base' - ctx['env_path'] = os.path.join(BASE_DIR, 'radioco/configs/{environment}'.format(**ctx)) - return ctx - - -def _docker_compose_run(service_name, command): - return 'docker-compose run --no-deps --rm {service} {command}'.format(service=service_name, command=command) - - -def _get_service_name(ctx, service=None): - return '{environment}_{service}'.format(environment=ctx['environment'], service=service or 'django') - - -def set_env(func): - @wraps(func) - def func_wrapper(ctx, environment=None): - ctx = _set_env(ctx, environment) - with chdir(ctx['env_path']): - return func(ctx) - return func_wrapper - - -@task -@set_env -def setup(ctx): - # Build images - with _generate_requirements_file(ctx): - if ctx['environment'] == 'development': - # Copying ssh key to allow remote debugging - with _ssh_support(ctx): - ctx.run('docker-compose build') - else: - ctx.run('docker-compose build') - - # Start containers - ctx.run('docker-compose up -d --no-recreate --no-build') - - # Adding executable permissions to docker scripts - ctx.run('chmod -R +x {env_path}/docker/scripts'.format(**ctx)) - - # Dependency services has to be running before start this service - ctx.run( - _docker_compose_run( - _get_service_name(ctx), - '/radioco/radioco/configs/{environment}/docker/scripts/setup.sh'.format(**ctx) - ) - ) - - -@task -def start(ctx, environment=None, daemon=True): - """ - This command will start the containers - """ - ctx = _set_env(ctx, environment) - with chdir(ctx['env_path']): - # --no-recreate --no-build avoid rebuilding or building the image - ctx.run('docker-compose up {} --no-recreate --no-build'.format('-d' if daemon else '')) - - -@task -@set_env -def stop(ctx): - ctx.run('docker-compose stop') - - -@task -def manage(ctx, environment=None, command='help'): - """ - Run manage.py management_command inside docker - Args: - command: management command - """ - ctx = _set_env(ctx, environment) - with chdir(ctx['env_path']): - ctx.run( - _docker_compose_run( - _get_service_name(ctx), - 'bash -c "cd radioco && python {docker_path}/manage.py {command}"'.format( - docker_path='radioco/configs/{environment}'.format(**ctx), - command=command - ) - ), - pty=True - ) - - -@task -def ssh(ctx, environment=None, service_name=None): - ctx = _set_env(ctx, environment) - # WARNING: Control+C is not being handle properly? looks fixed on version 0.14.0 - with chdir(ctx['env_path']): - ctx.run( - 'docker-compose exec {image} {command}'.format( - image=_get_service_name(ctx, service_name), - command='bash -c "cd /radioco{path} && bash"'.format(path=ctx['env_path'].replace(BASE_DIR, '')) - ), pty=True - ) - - -@task(name='exec') -def execute(ctx, command, environment=None, service_name=None): - ctx = _set_env(ctx, environment) - relative_path = ctx['env_path'].replace(BASE_DIR, '') - with chdir(ctx['env_path']): - ctx.run( - 'docker-compose exec {image} {command}'.format( - image=_get_service_name(ctx, service_name), - command='/bin/sh -c "cd /radioco{path}; {command}"'.format(path=relative_path, command=command) - ), pty=True - ) - - -@task -def attach(ctx, environment=None, service_name=None): - ctx = _set_env(ctx, environment) - - with chdir(ctx['env_path']): - ctx.run( - 'docker attach $(docker-compose ps -q {service})'.format( - service=_get_service_name(ctx, service_name) # service is always required - ) - ) - - -@task -def logs(ctx, environment=None, service_name=None): - ctx = _set_env(ctx, environment) - - with chdir(ctx['env_path']): - ctx.run('docker-compose logs {service}'.format( - service=_get_service_name(ctx, service_name) if service_name else '') - ) - - -@task -def run_coverage(ctx, environment): - coverage_command = 'COVERAGE_FILE=.coverage.docker_{environment}.xml coverage run --source="radioco" radioco/configs/{environment}/manage.py test'.format(environment=environment) - ctx.run('inv docker.exec -e {environment} -c "cd /radioco; pip install coverage; {command}"'.format(environment=environment, command=coverage_command)) - - -@task -@set_env -def clean(ctx): - """ - Use this command to remove the containers. - The data stored in the database will survive. - """ - ctx.run('docker-compose down') - - -@task -@set_env -def destroy(ctx): - """ - Use this command to remove the containers, the volumes and the images - WARNING: This command will remove all your data - """ - ctx.run('docker-compose down --rmi all') - ctx.run('docker-compose down --volumes') diff --git a/tasks/heroku.py b/tasks/heroku.py deleted file mode 100644 index 832d34d..0000000 --- a/tasks/heroku.py +++ /dev/null @@ -1,23 +0,0 @@ -from invoke import task, Collection - -HEROKU_CONFIG_PATH = 'radioco/configs/heroku/' - -# FIXME: BROKEN MODULE - -@task -def setup(ctx, project_name='radioco'): - ctx.run('heroku login') - ctx.run('heroku create {0}'.format(project_name)) - ctx.run('git init') - ctx.run('heroku git:remote -a {0}'.format(project_name)) - - -@task -def deploy(ctx, branch='master'): - # Deploy changes - ctx.run('git push heroku {0}'.format(branch)) - # Install requirements and run migrations - ctx.run('heroku run "python {0}manage.py migrate"'.format(HEROKU_CONFIG_PATH)) - - -ns = Collection(setup, deploy) diff --git a/tasks/locale.py b/tasks/locale.py index a34b367..9138a19 100644 --- a/tasks/locale.py +++ b/tasks/locale.py @@ -1,14 +1,14 @@ from invoke import task -@task(default=True) +@task def make(ctx): ctx.run('python manage.py makemessages -l en --ignore=venv/*') ctx.run('python manage.py makemessages --ignore=venv/* --all') -@task -def compile(ctx): +@task(make, default=True) +def update(ctx): ctx.run('python manage.py compilemessages') diff --git a/tasks/radioco.py b/tasks/radioco.py deleted file mode 100644 index f714959..0000000 --- a/tasks/radioco.py +++ /dev/null @@ -1,28 +0,0 @@ -from invoke import task, call -from .docker import setup, manage - - -@task( - pre=[setup], - post=[call(manage, command='create_example_data')] -) -def quickstart(ctx): - print('RadioCo should be running') - print('Generating some data...') - - -@task -def commit_changes(ctx): - # Add files - ctx.run('git add .') - # Add local settings excluded on gitignore - ctx.run('git add -f radioco/configs/base/local_settings.py') - ctx.run('git add -f radioco/configs/development/local_settings.py') - ctx.run('git add -f radioco/configs/heroku/local_settings.py') - # Commit all - ctx.run('git commit -am "autocommit: save changes"') - - -@task -def checkout_latest(ctx): - ctx.run('git pull') diff --git a/tasks/utils.py b/tasks/utils.py deleted file mode 100644 index 8f0b61e..0000000 --- a/tasks/utils.py +++ /dev/null @@ -1,89 +0,0 @@ -import tempfile -from contextlib import contextmanager -from invoke import UnexpectedExit -import os - - -BASE_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) -HOME_DIR = os.path.expanduser('~') - - -def run_ignoring_failure(method, command): - try: - method(command) - except UnexpectedExit: - pass - - -@contextmanager -def chdir(dirname=None): - """ - Not safe running concurrence tasks - """ - current_dir = os.getcwd() - os.chdir(dirname) - yield - os.chdir(current_dir) - -@contextmanager -def use_tmp_dir(ctx): - """ - Not safe running concurrence tasks - """ - tmp_path = tempfile.mkdtemp() - ctx.run('cp -R {repo_path} {tmp_path}'.format( - repo_path=os.path.join(BASE_DIR, '.'), - tmp_path=tmp_path) - ) - current_dir = os.getcwd() - os.chdir(tmp_path) - yield tmp_path - os.chdir(current_dir) - - -def commit_settings(ctx, message, dir_name=None, environment='base'): - with chdir(dir_name or BASE_DIR): - run_ignoring_failure(ctx.run, 'git add -f radioco/configs/base/local_settings.py') - if environment != 'base': - run_ignoring_failure(ctx.run, 'git add -f radioco/configs/{}/local_settings.py'.format(environment)) - run_ignoring_failure(ctx.run, 'git commit -am "{}"'.format(message)) - - -def get_current_branch(ctx): - return ctx.run('git rev-parse --abbrev-ref HEAD').stdout.strip() - - -# @contextmanager -# def change_branch(ctx, branch=None): -# """ -# Change to other branch temporally if a branch is provided -# """ -# current_branch = ctx.run('git rev-parse --abbrev-ref HEAD').stdout -# if branch: -# ctx.run('git checkout {}'.format(branch)) -# yield -# ctx.run('git checkout {}'.format(current_branch)) - - -def _read_requirements_file(filename, parent=None): - parent = (parent or __file__) - try: - with open(os.path.join(os.path.dirname(parent), filename)) as f: - return f.read() - except IOError: - return '' - - -def parse_requirements(filename, parent=None): - parent = (parent or __file__) - filepath = os.path.join(os.path.dirname(parent), filename) - content = _read_requirements_file(filename, parent) - - for line_number, line in enumerate(content.splitlines(), 1): - candidate = line.strip() - - if candidate.startswith('-r'): - for item in parse_requirements(candidate[2:].strip(), filepath): - yield item - else: - yield candidate \ No newline at end of file