Skip to content

Commit

Permalink
Pull Request issues solved
Browse files Browse the repository at this point in the history
+ 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
  • Loading branch information
ferran98campos committed Jul 17, 2023
1 parent 4f0e010 commit 05b2e0c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 36 deletions.
20 changes: 0 additions & 20 deletions api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <name of migration> <name of module where field was added>
```

## 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
Expand Down
21 changes: 21 additions & 0 deletions make-migration.sh
Original file line number Diff line number Diff line change
@@ -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 <name of migration> <name of module where field was added>

if [ $# -lt 2 ]; then
echo 1>&2 "usage: $0 <name of migration> <name of module where field was added>"
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
16 changes: 0 additions & 16 deletions templates/register/outside/create_user.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@
<p class="h1">Create a new account</p>
</div>
</div>

<!--
<div class="row">
<div class="col-md-8">
<a href="{% url 'anmalan:create_company' %}">
<p>Not in the company list? Create a new company profile here!</p>
</a>
</div>
</div>
-->
<div class="row">
<div class="col-md-12">
<ul id="form-step-tracker" class="center-block">
Expand Down Expand Up @@ -86,12 +76,6 @@
<button type="button" class="btn btn-default" id="next-step-btn">Next</button>
<button type="button" class="btn btn-success" id="submit-form-btn">Submit</button>
</div>

<!--
{% csrf_token %} {{ contact_form | crispy }}
<p align="left">* Required fields</p>{{ user_form | crispy }}
<button type="submit" class="btn btn-success">Submit</button>
<a href="{% url 'anmalan:choose_company' %}"><button type="button" class="btn btn-default">Back</button></a>-->
</form>
</div>
</div>
Expand Down

0 comments on commit 05b2e0c

Please sign in to comment.