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

terms&conditions telegram_nickname #70

Merged
merged 6 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,4 @@ cython_debug/
*/.*
*/*.tmp
Database/*




/FRONTEND/git-version.txt
28 changes: 28 additions & 0 deletions FRONTEND/fastparking/accounts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 5.0.4 on 2024-04-11 21:38

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
('cars', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='MyCars',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('brand', models.CharField(max_length=100)),
('car_type', models.CharField(max_length=100)),
('car_number', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='cars.car')),
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 5.0.4 on 2024-04-12 20:39

from django.db import migrations


class Migration(migrations.Migration):

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

operations = [
migrations.RemoveField(
model_name='mycars',
name='car_number',
),
]
20 changes: 20 additions & 0 deletions FRONTEND/fastparking/accounts/migrations/0003_mycars_car_number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 5.0.4 on 2024-04-13 12:15

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


class Migration(migrations.Migration):

dependencies = [
('accounts', '0002_remove_mycars_car_number'),
('cars', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='mycars',
name='car_number',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='cars.car'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 5.0.4 on 2024-04-13 13:54

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('accounts', '0003_mycars_car_number'),
]

operations = [
migrations.RemoveField(
model_name='mycars',
name='car_number',
),
]
20 changes: 20 additions & 0 deletions FRONTEND/fastparking/accounts/migrations/0005_mycars_car_number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 5.0.4 on 2024-04-13 14:50

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


class Migration(migrations.Migration):

dependencies = [
('accounts', '0004_remove_mycars_car_number'),
('cars', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='mycars',
name='car_number',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='cars.car'),
),
]
Empty file.
37 changes: 37 additions & 0 deletions FRONTEND/fastparking/accounts/templates/accounts/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{% extends "parking/base.html" %}
{% block content %}
<title>{{ title }}</title>
</head>
<body>
<h1>{{ title }}</h1>
{% if entries %}
<table>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
<!-- інші колонки за необхідністю -->
</tr>
</thead>
<tbody>
{% for entry in entries %}
<tr>
<td>{{ entry.entry_time }}</td>
<td>{{ entry.exit_time }}</td>
<td>{{ entry.car_number }}</td>
<!-- інші поля запису за необхідності -->
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No entries found.</p>
{% endif %}

<div class="card-body" style="display: inline-block">
<a href="{% url 'accounts:add_car' %}" class="btn btn-success">Report Car</a>
</div>
</body>
</html>
{% endblock content %}
19 changes: 19 additions & 0 deletions FRONTEND/fastparking/cars/migrations/0003_mycars.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 5.0.4 on 2024-04-14 16:37

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('cars', '0002_rename_photo_car_photo_car_car_paypass_car_blocked'),
]

operations = [
migrations.CreateModel(
name='MyCars',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
),
]
2 changes: 1 addition & 1 deletion FRONTEND/fastparking/cars/templates/cars/car_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<h1>List of Cars</h1>

<!-- Форма фільтрації -->
<form method="GET" action="{% url 'car_list' %}">
<form method="GET" action="{% url 'cars:car_list' %}">
<!-- Додайте поля фільтрації за вашими потребами -->
<label for="car_number">Car Number:</label>
<input type="text" name="car_number">
Expand Down
6 changes: 1 addition & 5 deletions FRONTEND/fastparking/cars/urls.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
from django.urls import path
from django.contrib.auth.views import LoginView, LogoutView, PasswordResetDoneView, PasswordResetConfirmView, PasswordResetCompleteView

from .views import CarListView

# from .forms import LoginForm

app_name = "cars"
app_name = 'cars'

urlpatterns = [
path('', CarListView.as_view(), name='car_list'),
Expand Down
29 changes: 29 additions & 0 deletions FRONTEND/fastparking/communications/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 5.0.4 on 2024-04-13 19:16

from django.db import migrations, models


class Migration(migrations.Migration):
initial = True

dependencies = []

operations = [
migrations.CreateModel(
name="Message",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("date_displayed", models.DateTimeField(auto_now_add=True)),
("news_text", models.TextField()),
("is_displayed", models.BooleanField(default=False)),
],
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 5.0.4 on 2024-04-13 21:26

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("communications", "0001_initial"),
]

operations = [
migrations.AlterField(
model_name="message",
name="date_displayed",
field=models.DateTimeField(blank=True, null=True),
),
]
Empty file.
8 changes: 8 additions & 0 deletions FRONTEND/fastparking/communications/notifications.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.db.models import Q
from django.utils import timezone

from utils.telegram_api import send_message_news


def send_limits():
...
27 changes: 21 additions & 6 deletions FRONTEND/fastparking/fastparking/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,27 @@
from dotenv import load_dotenv
import os
import tempfile
import configparser

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
env_file = BASE_DIR.parent.parent.joinpath("deploy").joinpath(".env")
if env_file.exists():
load_dotenv(env_file)

git_version = ""
GIT_VERSION_FILE = BASE_DIR.parent.joinpath("git-version.txt")
if GIT_VERSION_FILE.exists():
git_version = GIT_VERSION_FILE.read_text().strip()

proj_version = ""
PYPROJECT_FILE = BASE_DIR.parent.joinpath("pyproject.toml")
if PYPROJECT_FILE.exists():
config = configparser.ConfigParser()
config.read(PYPROJECT_FILE)
proj_version = config["tool.poetry"]["version"].strip('"')

VERSION = f"{proj_version}-{git_version}"

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
Expand All @@ -40,7 +53,9 @@
DJANGO_ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS")
if DJANGO_ALLOWED_HOSTS:
ALLOWED_HOSTS = DJANGO_ALLOWED_HOSTS.split(",")
CSRF_TRUSTED_ORIGINS = [f"https://{host}" for host in DJANGO_ALLOWED_HOSTS.split(",")]
CSRF_TRUSTED_ORIGINS = [
f"https://{host}" for host in DJANGO_ALLOWED_HOSTS.split(",")
]
else:
ALLOWED_HOSTS = []

Expand All @@ -63,7 +78,7 @@
"accounts",
]

AUTH_USER_MODEL = 'users.CustomUser'
AUTH_USER_MODEL = "users.CustomUser"

MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
Expand Down Expand Up @@ -192,14 +207,14 @@
}

# print(f"{CACHES=}")
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = os.getenv("MAIL_SERVER")
EMAIL_PORT = os.getenv("MAIL_PORT", 465)
EMAIL_STARTTLS = False
EMAIL_USE_SSL = True
EMAIL_USE_TLS = False
EMAIL_HOST_USER = os.getenv('MAIL_USERNAME')
EMAIL_HOST_PASSWORD = os.getenv('MAIL_PASSWORD')
EMAIL_HOST_USER = os.getenv("MAIL_USERNAME")
EMAIL_HOST_PASSWORD = os.getenv("MAIL_PASSWORD")
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
5 changes: 5 additions & 0 deletions FRONTEND/fastparking/finance/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.db import models
from django.urls import reverse
from parking.models import Registration

class Tariff(models.Model):
Expand All @@ -10,6 +11,8 @@ class Tariff(models.Model):

def __str__(self):
return self.description
def get_absolute_url(self):
return reverse('tariff-detail', kwargs={'pk': self.pk})

class Payment(models.Model):
# user_id = models.IntegerField(blank=True, null=True) # ID користувача, який здійснив оплату (не обов'язкове)
Expand All @@ -20,3 +23,5 @@ class Payment(models.Model):
def __str__(self):
return f"Payment {self.id}"

def get_absolute_url(self):
return reverse('post', kwargs={'post_slug': self.id})
4 changes: 2 additions & 2 deletions FRONTEND/fastparking/finance/templates/finance/add_pay.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!-- У вашому файлі add_tariff.html -->
{% extends "parking/base.html" %}
{% block content %}
<h2>Оплата</h2>
<h2>Payments</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Оплатити</button>
<button class="btn btn-primary" type="submit">Pay</button>
</form>
{% endblock content %}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ <h2>Add Tariff</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Save</button>
<button class="btn btn-primary" type="submit">Save</button>
</form>
{% endblock content %}
4 changes: 2 additions & 2 deletions FRONTEND/fastparking/finance/templates/finance/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<h2>Main Page</h2>
<!-- Додайте посилання на сторінку додавання тарифу -->
<ul>
<li><a href="{% url 'finance:add_tariff' %}">Add Tariff</a></li>
<li><a href="{% url 'finance:add_pay' %}">Оплата</a></li>
<li><a class="btn btn-primary" href="{% url 'finance:add_tariff' %}">Add Tariff</a></li>
<li><a class="btn btn-primary" href="{% url 'finance:add_pay' %}">Payments</a></li>
</ul>

<!-- Інші елементи сторінки, такі як таблиці, графіки тощо -->
Expand Down
2 changes: 2 additions & 0 deletions FRONTEND/fastparking/parking/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from django.contrib.auth.models import User

from django.db import models
from photos.models import Photo
from django.db import models
Expand Down
Loading
Loading