Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix html #4

Open
wants to merge 88 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
180612d
local config
AnnaWolska Mar 13, 2023
34d938d
local config2
AnnaWolska Mar 13, 2023
5123bf6
view of all groups statiscics
AnnaWolska Mar 13, 2023
eb26002
how to add tournament_id to group_participnats
AnnaWolska Mar 13, 2023
cf9ab1c
group details view works better
AnnaWolska Mar 16, 2023
0e2b037
group details for all groups works
AnnaWolska Mar 17, 2023
77370c1
group details bottom table corrected
AnnaWolska Mar 17, 2023
2fa2925
group participants has from now tournamnet_id when added to the group
AnnaWolska Mar 17, 2023
8ab93c4
working on average
AnnaWolska Mar 17, 2023
cd0e22b
individual average, tournament points, modified points, number of rou…
AnnaWolska Mar 18, 2023
9b63ab4
problem with models
AnnaWolska Mar 18, 2023
7f17032
the sum table of the groups under the table of points works
AnnaWolska Mar 20, 2023
cb8f00d
the completion table starts working
AnnaWolska Mar 20, 2023
be48088
the completion table in progress
AnnaWolska Mar 20, 2023
4c442f4
the completion table no retreat effect, does not work when two retrea…
AnnaWolska Mar 21, 2023
ea96348
the completion table, at two retreating opponents are not fighting
AnnaWolska Mar 21, 2023
8bcabd4
if there is no fight, the first one has points
AnnaWolska Mar 21, 2023
7ef91a8
points table test ok
AnnaWolska Mar 22, 2023
8172870
the view of finalists works, I write adding to the database
AnnaWolska Mar 22, 2023
75c716c
trying to create correctly and display the finalists
AnnaWolska Mar 22, 2023
5ccae4f
writing adding to the database
AnnaWolska Mar 23, 2023
6bc837f
way to save participant id and finalist id in FinalistParticipant model
AnnaWolska Mar 23, 2023
9d6837f
grup_summary works with finals part
AnnaWolska Mar 27, 2023
7f7e3aa
link to participant details from fights table works
AnnaWolska Mar 28, 2023
b459812
commit to deploy
AnnaWolska Mar 28, 2023
97e8d44
new settings for deploy
AnnaWolska Mar 28, 2023
a11586f
new settings for deploy cloudinary try
AnnaWolska Mar 28, 2023
cf1cb06
new settings for deploy cloudinary try2
AnnaWolska Mar 28, 2023
cee65fd
new settings for deploy cloudinary try3 database-url
AnnaWolska Mar 29, 2023
d29020e
new settings for deploy cloudinary try4 database-url
AnnaWolska Apr 2, 2023
5fa090e
cloudinary try
AnnaWolska Apr 3, 2023
06b410c
cloudinary try2
AnnaWolska Apr 3, 2023
a689145
cloudinary try3
AnnaWolska Apr 3, 2023
6efe5ed
cloudinary try4
AnnaWolska Apr 3, 2023
740b9f8
cloudinary try5 models
AnnaWolska Apr 3, 2023
b27770e
cloudinary try5 image
AnnaWolska Apr 4, 2023
d13ef87
cloudinary try5 image2
AnnaWolska Apr 4, 2023
15e94c8
cloudinary try5 image3k
AnnaWolska Apr 4, 2023
73a93e6
cloudinary BASE_DIR SATICFILES_DIRS
AnnaWolska Apr 4, 2023
d866768
cloudinary BASE_DIR SATICFILES_DIRS3
AnnaWolska Apr 4, 2023
953c616
cloudinary BASE_DIR SATICFILES_DIRS4
AnnaWolska Apr 4, 2023
23e5d75
cloudinary SATICFILES_DIRS arma no
AnnaWolska Apr 4, 2023
41f8589
cloudinary SATICFILES_DIR no
AnnaWolska Apr 4, 2023
fa9ce55
cloudinary gallery
AnnaWolska Apr 4, 2023
33cea64
cloudinary participant group_details
AnnaWolska Apr 4, 2023
b56204e
group_details participants images
AnnaWolska Apr 4, 2023
4d2658c
cloudinary images in templates
AnnaWolska Apr 5, 2023
4dbd97c
cloudinary images in templates2
AnnaWolska Apr 5, 2023
ceecbd1
new cloudinary images try
AnnaWolska Apr 6, 2023
e5d0fad
new cloudinary images try tournament_details.html
AnnaWolska Apr 6, 2023
0c6811a
new cloudinary images try tournament_details.html 2
AnnaWolska Apr 6, 2023
318837e
settings adjust
AnnaWolska Apr 6, 2023
e4d5200
settings adjust
AnnaWolska Apr 6, 2023
de2c467
settings adjust whitenoise
AnnaWolska Apr 6, 2023
63f6090
settings adjust whitenoise
AnnaWolska Apr 6, 2023
90623f9
settings adjustcloudinary
AnnaWolska Apr 6, 2023
206ba9a
settings adjustcloudinary
AnnaWolska Apr 6, 2023
25e12ee
settings adjustcloudinary
AnnaWolska Apr 6, 2023
1799011
settings adjustcloudinary
AnnaWolska Apr 6, 2023
d778986
imige fields
AnnaWolska Apr 6, 2023
8e2a68f
participant_details.html thumbnail
AnnaWolska Apr 6, 2023
558a772
participant_details.html thumbnail2
AnnaWolska Apr 6, 2023
7791193
participant_details.html thumbnail 3 it work well
AnnaWolska Apr 6, 2023
7feb6f8
galleries
AnnaWolska Apr 6, 2023
d3bacbf
home content
AnnaWolska Apr 6, 2023
3da0da1
home content 2
AnnaWolska Apr 6, 2023
5616d2f
heart AK
AnnaWolska Apr 7, 2023
5b9c832
heart AK pix
AnnaWolska Apr 7, 2023
082a85a
heart AK pix
AnnaWolska Apr 7, 2023
dd39522
heart 2
AnnaWolska Apr 7, 2023
3d8101b
heart 2
AnnaWolska Apr 7, 2023
9deff93
logo
AnnaWolska Apr 7, 2023
a21e226
logo2
AnnaWolska Apr 7, 2023
bd01d3a
logo2
AnnaWolska Apr 7, 2023
0db5ae9
settings work
AnnaWolska Apr 7, 2023
cae36ba
is production
AnnaWolska Apr 7, 2023
6c92023
is production
AnnaWolska Apr 7, 2023
6c6bee1
STATIC_ROOT
AnnaWolska Apr 7, 2023
c49514a
calculating changes
AnnaWolska Apr 7, 2023
84b885b
counting tab
AnnaWolska Apr 7, 2023
8081d93
table works with problematic fighters at the begining
AnnaWolska Apr 12, 2023
286ad7e
js start
AnnaWolska Apr 14, 2023
f5efea8
many buttons starting to work
AnnaWolska Apr 24, 2023
f679d43
many buttons starting to look
AnnaWolska May 9, 2023
d70e92c
my first anchor works
AnnaWolska May 9, 2023
a318875
style=" vertical-align:top" ?
AnnaWolska May 9, 2023
0623a60
tab working better
AnnaWolska May 16, 2023
6e67f6b
fixing html
AnnaWolska May 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,4 @@ images/cache
*.jpg
*.jpeg
*.pyc
log_read_me
Binary file modified arma/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file modified arma/__pycache__/settings.cpython-310.pyc
Binary file not shown.
Binary file modified arma/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file modified arma/__pycache__/wsgi.cpython-310.pyc
Binary file not shown.
111 changes: 46 additions & 65 deletions arma/settings.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,25 @@
"""
Django settings for arma project.
Generated by 'django-admin startproject' using Django 4.0.6.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""

from pathlib import Path
import os
import dj_database_url
from dotenv import load_dotenv
load_dotenv()

IS_PRODUCTION = False # helper

if os.getcwd() == "/app":
DEBUG = False
IS_PRODUCTION = True
IS_PRODUCTION = False

# DATABASES['default'] = dj_database_url.parse('postgres://username:[email protected]:5432/database')
# DATABASES['default'] = dj_database_url.config()
# DATABASES['default'] = dj_database_url.config('postgres://username:[email protected]:5432/database')
# Get the current working
cwd = os.getcwd()
print("Current working directory:", cwd)

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
DATABASE_URL = os.environ['DATABASE_URL']

# DATABASE_URL = os.environ['DATABASE_URL']
DATABASE_URL = 'postgres://tubphmzekpfhbv:d901cee21a961066447a15323a0555af25cb008f35eb69b762d64c853c979e47@ec2-176-34-211-0.eu-west-1.compute.amazonaws.com:5432/djjlihih2flh9'
db_from_env = dj_database_url.config(conn_max_age=600)
DATABASES['default'].update(db_from_env)

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/

# SECURITY WARNING: don't run with debug turned on in production!
# DEBUG = True

ALLOWED_HOSTS = ['armatournaments.herokuapp.com', '127.0.0.1']
# ALLOWED_HOSTS = os.environ.get(ALLOWED_HOSTS)
# ALLOWED_HOSTS = ['arma.com']

INSTALLED_APPS = [
'dal',
Expand All @@ -52,8 +34,8 @@
'import_export',
'crispy_forms',
'sorl.thumbnail',
'whitenoise.runserver_nostatic',
# 'tinymce',
'cloudinary_storage',
'cloudinary',
#arma:
'tournaments.apps.TournamentsConfig',
'posts.apps.PostsConfig',
Expand All @@ -76,7 +58,7 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_cprofile_middleware.middleware.ProfilerMiddleware'
'django_cprofile_middleware.middleware.ProfilerMiddleware',
]

DJANGO_CPROFILE_MIDDLEWARE_REQUIRE_STAFF = False
Expand Down Expand Up @@ -106,14 +88,12 @@

}
}

WSGI_APPLICATION = 'arma.wsgi.application'

# Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
# Password validation
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
Expand All @@ -131,56 +111,27 @@

# Internationalization
# https://docs.djangoproject.com/en/4.0/topics/i18n/

LANGUAGE_CODE = 'pl-Pl'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/

# STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATIC_URL = 'static/'
if DEBUG:
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
else:
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

# STATIC_ROOT = BASE_DIR / "static"
# STATICFILES_DIRS = [
# # BASE_DIR / 'static'
# os.path.join(BASE_DIR, 'static'),
# ]
STATICFILES_DIRS = [os.path.join(BASE_DIR,'arma/static')
]

# potrzebne TU do pracy na lokalnym serwerze
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

# MEDIA_ROOT = BASE_DIR / "images"
MEDIA_ROOT = os.path.join(BASE_DIR, "images")
MEDIA_URL = "/images/"

# LOCALE_PATHS = [str(BASE_DIR / "locale")]
# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

SHELL_PLUS_PRINT_SQL = True

LOGIN_REDIRECT_URL = "/home"
LOGOUT_REDIRECT_URL = "/home"

# PYDEVD_USE_CYTHON=NO
# PYDEVD_USE_FRAME_EVAL=NO
# DISABLE_COLLECTSTATIC = 1

SECRET_KEY = os.getenv('SECRET_KEY')

try:
Expand All @@ -189,17 +140,27 @@
print("no local_settings.py file?")

if IS_PRODUCTION:
import dj_database_url

import dj_database_url
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES["default"].update(db_from_env)

DEBUG = False
DATABASES["default"].update(db_from_env)
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
ALLOWED_HOSTS = ["armatournaments.herokuapp.com"]
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

CLOUDINARY_STORAGE = {
'CLOUD_NAME': 'dcgtoiogb',
'API_KEY': '327397828378715',
'API_SECRET': os.getenv('API_SECRET')
}
DEFAULT_FILE_STORAGE = 'cloudinary_storage.storage.MediaCloudinaryStorage'

# debug heroku
if DEBUG:
import logging

import logging
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
Expand All @@ -215,4 +176,24 @@
},
},
}
# else:

else:
DEBUG = True

if DEBUG:
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
else:
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

STATICFILES_DIRS = [os.path.join(BASE_DIR,'arma/static')]
#
# CACHES = {
# "default": {
# "BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
# "LOCATION": "127.0.0.1:11211",
# }
# }
# pip install pymemcache

32 changes: 17 additions & 15 deletions finals/templates/final.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,41 @@
<ol>
<br class="list-group-item">
<p>
uczestnicy fazy pucharowej turnieju {{ tournament.title }}:

uczestnicy fazy pucharowej:

{% for group in groups %}
{% for group in groups|dictsort:"number" %}
<ol>

grupa {{ group.number }}:
{# {% for p in prtcp_ls|dictsortreversed:"points_average" %}#}
{% for p in group.participants.all|dictsortreversed:"points_average" %}
{% for p in group.participants.all%}

{# {% for p in finalists %}#}
<li>
{{ p.name }} z {{ p.school }} {{ p.points_average }} {{ p.group_id }}

{{ p.name }} z {{ p.school }} -

{% for g_p in group_participants %}
{% if g_p.participant_id == p.id %}

{{ g_p.tournament_points_modified }}
{% endif %}
{% endfor %}

{% if p.image %}
{% thumbnail p.image "100x100" as im %}
<img src="{{ im.url }}" alt="zdj">
{% endthumbnail %}
{% endif %}


</li>
{# {% endif %}#}

{% endfor %}
<hr>
</ol>



{% endfor %}
</div>
<hr>
Expand All @@ -44,12 +54,4 @@
<br>










{% endblock %}
15 changes: 10 additions & 5 deletions finals/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# from django.core.paginator import Paginator
from django.shortcuts import render
from tournaments.models import Tournament
from finals.models import Finalist
from tournament_calculating.models import Group, Fight, Participant, Round
from finals.models import Finalist, ParticipantFinalist
from tournament_calculating.models import Group, Fight, Participant, Round, ParticipantGroup
# from tournament_calculating.forms import (
# AddParticipantForm,
# AddGroupForm,
Expand All @@ -20,11 +20,13 @@
def finals(request, group_id):
prtcp_ls = []
group = Group.objects.get(pk=group_id)

group_participants = ParticipantGroup.objects.filter(group_id=group_id)
tournament = group.tournament
groups = tournament.groups.all()
participants = group.participants.all()
finalists = Finalist.objects.filter(group = group)
# finalists = Finalist.objects.filter(group = group)
finalists = ParticipantFinalist.objects.all()
# print("TUTITU:", finalists)
# for f in finalists:
# for p in participants:
# prtcp_ls.append( Finalist.objects.get(participant_id=p.id))
Expand All @@ -40,5 +42,8 @@ def finals(request, group_id):
return render(request, "final.html", context={
"finalists": finalists,
"prtcp_ls": prtcp_ls,
"groups": groups
"groups": groups,
"group_participants": group_participants,
"tournament": tournament,
"finalists": finalists
})
19 changes: 19 additions & 0 deletions galleries/migrations/0002_alter_photo_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.2.12 on 2023-04-04 10:47

import cloudinary.models
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('galleries', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='photo',
name='image',
field=cloudinary.models.CloudinaryField(blank=True, max_length=255, null=True),
),
]
19 changes: 19 additions & 0 deletions galleries/migrations/0003_alter_photo_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.2.12 on 2023-04-06 13:03

from django.db import migrations, models
import galleries.models


class Migration(migrations.Migration):

dependencies = [
('galleries', '0002_alter_photo_image'),
]

operations = [
migrations.AlterField(
model_name='photo',
name='image',
field=models.ImageField(blank=True, null=True, upload_to=galleries.models.upload_to),
),
]
3 changes: 2 additions & 1 deletion galleries/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import string
from random import random
from django.db import models
# from django.utils.text import slugify
from cloudinary.models import CloudinaryField


class Gallery(Timestamped):
Expand Down Expand Up @@ -38,6 +38,7 @@ class Photo(Timestamped):
title = models.CharField(max_length=100)
short_description = models.CharField(max_length=300, null=True, blank=True)
image = models.ImageField(upload_to=upload_to, null=True, blank=True)
# image = CloudinaryField(blank=True, null=True)
gallery = models.ForeignKey("Gallery",on_delete=models.CASCADE, related_name="photos")

def __str__(self):
Expand Down
4 changes: 4 additions & 0 deletions galleries/templates/galleries/galleries.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
{% load crispy_forms_filters %}
{% load crispy_forms_tags %}
{% load thumbnail %}
{% load cloudinary %}

{% block content %}
<h3 id="delete_tournament" type="button" style="background-color:lightseagreen " class="btn btn-primary">
<a style="color:white; text-decoration: none;" href = "{% url 'galleries:add_gallery' %}">
Expand Down Expand Up @@ -44,6 +46,8 @@ <h4>
{% thumbnail gallery.photos.first.image "300x300" crop="center" as im %}
<img class=card-img-top" src="{{ im.url }}" alt="">
{% endthumbnail %}
{# {% cloudinary gallery.photos.first.image width="100" crop="fill"%}#}

<div class="card-body">
<h4 class="card-title text-center">
{{ gallery.title }}
Expand Down
Loading