Skip to content

Commit

Permalink
upgrade dependencies, fix bugs in forms
Browse files Browse the repository at this point in the history
  • Loading branch information
ddunne6 committed May 12, 2023
1 parent da8970b commit 75fbfef
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 55 deletions.
5 changes: 0 additions & 5 deletions app_ratings/standardising.py

This file was deleted.

13 changes: 7 additions & 6 deletions app_ratings/templates/app_ratings/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<!-- BS JavaScript -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>

{% if title %}
<title>EuroVote - {{ title }}</title>
Expand All @@ -21,6 +20,7 @@
<body>
<header>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href="{% url 'my_ratings' %}">EuroVote</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
Expand All @@ -47,6 +47,7 @@
<a class="nav-link" href="{% url 'login' %}">Register/Login</a>
</li>
{% endif %}
</div>
</ul>
</div>
</nav>
Expand All @@ -56,10 +57,10 @@
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
<div class="container">
{{message}}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</div>
{% endfor %}
{% endif %}
Expand Down
11 changes: 5 additions & 6 deletions app_ratings/templates/app_ratings/rate.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
{% block content %}

<div class="container">
<br>
<form method="post">
{% csrf_token %}
<fieldset>
<legend>Vote out of 10 for {{ country_name }}</legend>
<div class="">
<input type="range" name="score" min="1" max="10" step="1" value="1"
oninput="num.value = this.value" class="rangeinput form-control" required="" id="id_score">
<p text-align="center"><output id="num" text-align="center">1</output></p>
</div>
<label for="customRange2" class="form-label">Vote out of 10 for <b>{{ country_name }}</b></label>
<input type="range" name="score" min="1" max="10" step="1" value="1"
oninput="num.value = this.value" class="form-range" required="" id="id_score">
<p text-align="center"><output id="num" text-align="center">1</output></p>
</fieldset>
<input type="submit" name="save" value="Submit vote" class="btn btn-primary" id="submit-id-save">
</form>
Expand Down
2 changes: 0 additions & 2 deletions app_ratings/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ def get_countries_ratings(self, ratings):
})
return ratings_combined

from app_ratings.standardising import z_scores

class AllRatings(LoginRequiredMixin, ListView):
model = Rating
template_name = 'app_ratings/all_ratings.html'
Expand Down
6 changes: 3 additions & 3 deletions app_users/templates/app_users/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<fieldset class="form-group">
<h2>Login</h2>
<hr>
{{form|crispy}}
{{ form|crispy }}
</fieldset>
<div class="form-group2">
<button class="btn btn-outline-info" type="submit"><b>Log in</b></button>
<a href="{% url 'signup' %}" class="btn btn-outline-info signupbutton"><b>Sign Up</b></a>
<button class="btn btn-primary" type="submit"><b>Log in</b></button>
<a href="{% url 'signup' %}" class="btn btn-outline-primary signupbutton"><b>Sign Up</b></a>
</div>
</form>
</div>
Expand Down
1 change: 1 addition & 0 deletions app_users/templates/app_users/logout.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{% block content %}

<div class="container">
<br>
<p>You have succesfully logged out!</p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app_users/templates/app_users/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h2>Login</h2>
{{form|crispy}}
</fieldset>
<div class="form-group2">
<button class="btn btn-outline-info" type="submit"><b>Sign Up</b></button>
<button class="btn btn-outline-primary" type="submit"><b>Sign Up</b></button>
</div>
</form>
</div>
Expand Down
7 changes: 5 additions & 2 deletions django_euro_vote/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
'app_ratings.apps.AppRatingsConfig',
'django_countries',
'crispy_forms',
"crispy_bootstrap5",
'import_export',
'django.contrib.admin',
'django.contrib.auth',
Expand All @@ -52,6 +53,10 @@
'django.contrib.staticfiles',
]

CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"

CRISPY_TEMPLATE_PACK = "bootstrap5"

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
Expand Down Expand Up @@ -139,8 +144,6 @@

USE_TZ = True

CRISPY_TEMPLATE_PACK = 'bootstrap4'

LOGIN_URL = '/accounts/login/'


Expand Down
36 changes: 6 additions & 30 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,6 @@
asgiref==3.3.4
boto3==1.17.77
botocore==1.20.77
defusedxml==0.7.1
diff-match-patch==20200713
Django==3.2.3
django-countries==7.3.2
django-crispy-forms==1.11.2
django-import-export==2.5.0
django-storages==1.11.1
django-storages[azure]
et-xmlfile==1.1.0
jmespath==0.10.0
MarkupPy==1.14
mysqlclient==2.1.0
numpy==1.22.3
odfpy==1.4.1
openpyxl==3.0.7
python-dateutil==2.8.1
python-environ==0.4.54
pytz==2021.1
PyYAML==5.4.1
s3transfer==0.4.2
six==1.16.0
scipy==1.8.0
sqlparse==0.4.1
tablib==3.0.0
urllib3==1.26.4
xlrd==2.0.1
xlwt==1.3.0
Django==4.2.1
django-environ==0.10.0
django_countries==7.5.1
django-crispy-forms==2.0
django-import-export==3.2.0
crispy-bootstrap5==0.7

0 comments on commit 75fbfef

Please sign in to comment.