From 05b2e0cb7fff5d97bbee40f4ee3eee9de4d9d27c Mon Sep 17 00:00:00 2001 From: Ferran Campos Date: Mon, 17 Jul 2023 17:19:15 +0200 Subject: [PATCH] Pull Request issues solved + README.md has been returned to its original version +Old endpoint ('status') deleted from api/views.py + Commented code deleted from 'create_user.html' + 'make-migration.sh' has been restablished --- api/views.py | 20 -------------------- docs/README.md | 8 ++++++++ make-migration.sh | 21 +++++++++++++++++++++ templates/register/outside/create_user.html | 16 ---------------- 4 files changed, 29 insertions(+), 36 deletions(-) create mode 100644 make-migration.sh diff --git a/api/views.py b/api/views.py index 7a7c957a1..9e0d70d5c 100644 --- a/api/views.py +++ b/api/views.py @@ -368,26 +368,6 @@ def companies(request): return HttpResponseBadRequest("Unsupported method!", content_type="text/plain") -def status(request): - hostname = platform.node() - python_version = platform.python_version() - git_hash = ( - subprocess.check_output("cd ~/git && git rev-parse HEAD", shell=True) - .decode("utf-8") - .strip() - ) - data = OrderedDict( - [ - ("status", "OK"), - ("time", datetime.now().strftime("%Y-%m-%d %H:%M:%S")), - ("hostname", hostname), - ("commit", git_hash), - ("python_version", python_version), - ] - ) - return JsonResponse(data, safe=False) - - @cache_page(60 * 5) def organization_v2(request): fair = get_object_or_404(Fair, current=True) diff --git a/docs/README.md b/docs/README.md index 135bbb0b4..41a3a0e1d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -70,6 +70,14 @@ After setting up the AIS with Docker, you can access it in a web browser with th 4. Now you need to fill out some information. Fill out the necessary fields (Registration start date & end date, Complete registration start date & end date). Make sure end dates come after start dates. Tick the "Current" box, and press save at the bottom of the page. The fair will be created, and you can go back to `localhost:3000` to see the landing page for the fair. +## Creating Database Migrations + +When adding new fields to models, you will need to create a database migration. This migration will be performed on the server to update the database to the latest structure. After adding a field, and making sure the docker instance of AIS is up and running through docker compose, you run the following command: + +```bash +./make-migrations +``` + ## Scripts A number of scripts are available in the scripts folder. Others can be run with `manage.py [scriptname]`. Run `manage.py help` to list what scripts are available through manage.py diff --git a/make-migration.sh b/make-migration.sh new file mode 100644 index 000000000..a17c22834 --- /dev/null +++ b/make-migration.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# This script will execute the makemigrations script inside +# the ais-web docker container, given it's up and running. + +# Usage: ./make-migrations + +if [ $# -lt 2 ]; then + echo 1>&2 "usage: $0 " + exit 2 +fi + +ID=$(docker ps | grep ais-web | awk '{ print $1 }') + +if [ -z "$ID" ] +then + echo 1>&2 "$0: Could not find the ais-web container. Is AIS running?" + exit 2 +fi + +docker exec -it $ID python manage.py makemigrations --name $1 $2 --settings=local_settings \ No newline at end of file diff --git a/templates/register/outside/create_user.html b/templates/register/outside/create_user.html index 5c5141c1e..68847e7ba 100644 --- a/templates/register/outside/create_user.html +++ b/templates/register/outside/create_user.html @@ -22,16 +22,6 @@

Create a new account

- -
    @@ -86,12 +76,6 @@
- -