changing SQLite to PGSQL database

This commit is contained in:
Trullemans Gregory 2021-11-19 13:11:25 +01:00
parent e7c9e75d8c
commit 13f6dd08b4
10 changed files with 61 additions and 47 deletions

1
.gitignore vendored
View File

@ -19,6 +19,7 @@ venv/
ENV/
env.bak/
venv.bak/
data/
# Visual Studio Code #
.vscode/*

View File

@ -80,10 +80,21 @@ WSGI_APPLICATION = 'Ultron.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': BASE_DIR / 'db.sqlite3',
# }
# }
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'ultron',
'USER': 'my_user',
'PASSWORD': 'my_password',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}

14
docker-compose.yml Normal file
View File

@ -0,0 +1,14 @@
version: "3"
services:
db:
image: "postgres:14"
restart: always
container_name: "ultron_db"
environment:
POSTGRES_DB: "ultron"
POSTGRES_USER: "my_user"
POSTGRES_PASSWORD: "my_password"
ports:
- "5432:5432"
volumes:
- ./data:/var/lib/postgresql/data

View File

@ -35,6 +35,7 @@
<h4 class="">Next Events</h4>
</div>
<div class="card-body">
{% if event_list %}
<table class="table tablesorter table-striped table-condensed" data-sort="table" id="event_table">
{% for event in event_list %}
<tr>
@ -43,6 +44,9 @@
</tr>
{% endfor %}
</table>
{% else %}
No future event defined
{% endif %}
</div>
</div>
</div>
@ -50,10 +54,21 @@
<div class="col-md-4">
<div class="card">
<div class="card-header">
<h4 class="">(line 2 cadre 2)</h4>
<h4 class="">Last updated gymnasts</h4>
</div>
<div class="card-body">
{% if gymnast_list %}
<table class="table tablesorter table-striped table-condensed" data-sort="table" id="event_table">
{% for event in gymnast_list %}
<tr>
<td class="text-left"><a href="{% url 'event_details' event.id %}">{{ event.name }}</a></td>
<td>{% if event.number_of_week_from_today < 0 %}{{event.number_of_week_from_today}}{% else %}<span class="text-{% if event.number_of_week_from_today > 12 %}success{% elif event.number_of_week_from_today > 9 %}info{% elif event.number_of_week_from_today > 6 %}warning{% else %}danger{% endif %}"><b>{{event.number_of_week_from_today}}</b></span>{% endif %}</td>
</tr>
{% endfor %}
</table>
{% else %}
No updated gymnast defined
{% endif %}
</div>
</div>
</div>

View File

@ -16,8 +16,8 @@
</div>
</div>
</div>
<div class="card-body pb-0">
<div class="table-responsive pb-0">
<div class="card-body">
<div class="table-responsive">
{% if event_list %}
<table class="table tablesorter table-striped table-condensed" data-sort="table" id="maintable">
<thead>
@ -50,11 +50,7 @@
</tbody>
</table>
{% else %}
<table class="table">
<tr>
<td>There are no events corresponding to your criterias</td>
</tr>
</table>
There are no events corresponding to your criterias.
{% endif %}
</div>
</div>

View File

@ -1,19 +1,12 @@
{% extends "listing.html" %}
<!-- {% block page_title %}.: Accident's list :.{% endblock %}
{% block searchurl %}accident{% endblock %}
{% block title %}Accidents{% endblock %}
{% block addurl %}accident{% endblock %}
{% block modurl %}accident{% endblock %}
{% block search %}accident{% endblock %} -->
{% block datacontent %}
<div class="card mb-0">
<div class="card-header">
<h4 class="card-title"> Accidents' Listing</h4>
</div>
<div class="card-body pb-0">
<div class="table-responsive pb-0">
<div class="card-body">
<div class="table-responsive">
{% if accident_list.count >= 1 %}
<table class="table tablesorter table-striped table-condensed" data-sort="table" id="maintable">
<thead class="text-primary">
@ -41,11 +34,7 @@
</tbody>
</table>
{% else %}
<table class="table">
<tr>
<td>There are no accident corresponding to your criterias</td>
</tr>
</table>
There are no accident corresponding to your criterias.
{% endif %}
</div>
</div>

View File

@ -16,8 +16,8 @@
</div>
</div>
</div>
<div class="card-body pb-0">
<div class="table-responsive pb-0">
<div class="card-body">
<div class="table-responsive">
{% if chrono_list %}
<table class="table tablesorter table-striped table-condensed" data-sort="table" id="maintable">
<thead>
@ -46,11 +46,7 @@
</tbody>
</table>
{% else %}
<table class="table">
<tr>
<td>There are no chronos corresponding to your criterias</td>
</tr>
</table>
There are no chronos corresponding to your criterias.
{% endif %}
</div>
</div>

View File

@ -16,8 +16,8 @@
</div>
</div>
</div>
<div class="card-body pb-0">
<div class="table-responsive pb-0">
<div class="card-body">
<div class="table-responsive">
{% if gymnast_list %}
<table class="table tablesorter table-striped table-condensed" data-sort="table" id="maintable">
<thead>
@ -48,11 +48,7 @@
</tbody>
</table>
{% else %}
<table class="table">
<tr>
<td>There are no places corresponding to your criterias</td>
</tr>
</table>
There are no gymnast corresponding to your criterias.
{% endif %}
</div>
</div>

View File

@ -16,8 +16,8 @@
</div>
</div>
</div>
<div class="card-body pb-0">
<div class="table-responsive pb-0">
<div class="card-body">
<div class="table-responsive">
{% if place_list %}
<table class="table tablesorter table-striped table-condensed" data-sort="table" id="maintable">
<thead>
@ -54,11 +54,7 @@
</tbody>
</table>
{% else %}
<table class="table">
<tr>
<td>There are no places corresponding to your criterias</td>
</tr>
</table>
There are no places corresponding to your criterias.
{% endif %}
</div>
</div>

View File

@ -39,7 +39,7 @@
</tbody>
</table>
{% else %}
<p>There are no skills corresponding to your criterias</p>
There are no skills corresponding to your criterias.
{% endif %}
</div>
</div>