Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
8645fbe
Add DB Models
natcza Feb 3, 2022
e3dd977
Merge pull request #1 from natcza/1.1/Participant_DB_Model
natcza Feb 3, 2022
6e5939f
add missing files
natcza Feb 3, 2022
c2e4871
Update of db-still not working
natcza Feb 7, 2022
ba078f7
Merge pull request #4 from natcza/1.3/update_datebase
natcza Feb 7, 2022
35881a4
Update DB_Models
natcza Feb 10, 2022
4d0c2c2
add view and url dashboard
jz-CL Feb 11, 2022
374da8b
update model STATUS_EVENT, STATUS_PARTICIPANT
jz-CL Feb 11, 2022
dec3d34
add managment commands:: create_event, create_organizer
jz-CL Feb 14, 2022
648c7fc
add managment commands:: create_event, create_organizer, create_parti…
jz-CL Feb 16, 2022
dfda26d
delete create_db.py, fill_db.py
jz-CL Feb 16, 2022
959792a
managment/command add create_photo.py
jz-CL Feb 17, 2022
777d486
Merge pull request #6 from natcza/2.1.1_-_View_event_list_(view.py)_+…
natcza Feb 17, 2022
d4bc843
add base.html
jz-CL Feb 17, 2022
8876a49
update managment/commands
jz-CL Feb 17, 2022
27f2fd4
Merge pull request #8 from natcza/2.2.2_-_Template_(HTML)_of_Event_De…
natcza Feb 20, 2022
2a5a0e5
update settings, views
jz-CL Feb 20, 2022
ba6a404
Merge pull request #9 from natcza/2.2.2_-_Template_(HTML)_of_Event_De…
natcza Feb 20, 2022
9a74101
Update of db-still not working
natcza Feb 20, 2022
2e21c53
Update of db-still not working
natcza Feb 20, 2022
5111615
update settings, views
jz-CL Feb 20, 2022
9b557c4
dashboard.html
natcza Feb 20, 2022
678834e
20220220: Add Event View and Event Details
natcza Feb 20, 2022
64ee53b
update (url, views) -> addParticipant
jz-CL Feb 22, 2022
6eedd73
update accept_rodo
jz-CL Feb 23, 2022
40081b3
update accept_rodo
jz-CL Feb 23, 2022
1e9a929
update add participant to event
jz-CL Feb 23, 2022
c2b83c5
update ParticipantAddView2
jz-CL Feb 24, 2022
54a4c46
update forms.py, views.py
jz-CL Feb 27, 2022
8ff955c
update EventDetailsView_(DetailView)
jz-CL Feb 28, 2022
c50c9e4
3.1 update natalia
natcza Mar 3, 2022
6f83846
3.1 update natalia 06.03.22
natcza Mar 6, 2022
0c0c2aa
update EmailMessage
jz-CL Mar 7, 2022
5f7cbaa
update EmailMessage, html
jz-CL Mar 8, 2022
d4f1f60
update EmailMessage, html
jz-CL Mar 8, 2022
fb31f96
update EmailMultiAlternatives, render_to_string
jz-CL Mar 8, 2022
c46cdfb
3.1 update natalia 11.03.22 v2
natcza Mar 11, 2022
e473190
Merge pull request #11 from natcza/3.1-update-natalia
natcza Mar 11, 2022
e23fca4
update EmailMultiAlternatives,
jz-CL Mar 13, 2022
856bab1
update EmailMultiAlternatives,
jz-CL Mar 14, 2022
018c59b
update EmailMultiAlternatives,
jz-CL Mar 14, 2022
4da42b9
update EmailMultiAlternatives,
jz-CL Mar 14, 2022
219f4a9
update EmailMultiAlternatives,
jz-CL Mar 14, 2022
c340427
update EmailMultiAlternatives,
jz-CL Mar 14, 2022
e887684
make SendMailView, info_send_mail.html
jz-CL Mar 17, 2022
b330231
make ? 404
jz-CL Mar 21, 2022
9a28804
make ? 404
jz-CL Mar 21, 2022
33feea7
make 404
jz-CL Mar 21, 2022
279d51b
make 404
jz-CL Mar 21, 2022
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
__pycache__/
*.py[cod]
*$py.class
../.DS_Store
.DS_Store

# C extensions
*.so
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Event_N-J
# Event_N-J

przy próbie powtórnego uruchomienia linka ma wystąpić błąd 404

10 changes: 10 additions & 0 deletions db_input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

python3 manage.py shell
from events.models import Participant, Event, Organizer, Status_Participant, Photo

o1 = Organizer.objects.create(name="organizer1", description="description_organizer_1", mail="organizer1@.o2.pl")
o1.save() --> save
o2 = Organizer.objects.create(name="organizer2", description="description_organizer_2", mail="organizer2@.o2.pl")
o3 = Organizer.objects.create(name="organizer3", description="description_organizer_3", mail="organizer3@.o2.pl")
o4 = Organizer.objects.create(name="organizer4", description="description_organizer_4", mail="organizer4@.o2.pl")

27 changes: 20 additions & 7 deletions eventnj/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


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

Expand All @@ -25,8 +24,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

ALLOWED_HOSTS = ["127.0.0.1"]

# Application definition

Expand All @@ -37,6 +35,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'events',
]

MIDDLEWARE = [
Expand All @@ -54,7 +53,7 @@
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [BASE_DIR / 'templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
Expand All @@ -69,7 +68,6 @@

WSGI_APPLICATION = 'config.wsgi.application'


# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases

Expand All @@ -80,6 +78,15 @@
}
}

# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql',
# 'NAME': 'eventnj',
# 'USER': 'postgres',
# 'PASSWORD': '',
# 'HOST': 'localhost'
# }
# }

# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
Expand All @@ -99,7 +106,6 @@
},
]


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

Expand All @@ -113,7 +119,6 @@

USE_TZ = True


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

Expand All @@ -123,3 +128,11 @@
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / "media"

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

# zmiana tymczasowa
HOST = '127.0.0.1:8000'
17 changes: 17 additions & 0 deletions eventnj/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@
from django.contrib import admin
from django.urls import path

from events.views import (
DashboardView,
# EventDetailsView,
SendMailView,
EventDetailsView_,
ParticipantAddView2,
AuthenticateParticipantView
)

urlpatterns = [
path('admin/', admin.site.urls),
path('', DashboardView.as_view(), name="dashboard"),
path('event-details/<int:pk>/', EventDetailsView_.as_view(), name="event-details"),
# path('add-participant/<int:pk>', ParticipantAddView.as_view(), name="add-participant"),
path('add-participant/<int:pk>/', ParticipantAddView2.as_view(), name="add-participant"),

# https://docs.djangoproject.com/en/4.0/topics/http/urls/#path-converters
path('authenticate-participant/<uuid:authenticate_code>/', AuthenticateParticipantView.as_view(), name="authenticate-participant"),
path('send-mail/<int:pk>/', SendMailView.as_view(), name='send-mail'),
]
18 changes: 18 additions & 0 deletions eventnj/events/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from django import forms
from django.core.exceptions import ValidationError
from django.forms import widgets, ModelForm



class AddParticipantForm(forms.Form):
name = forms.CharField(label="Imię ", max_length=255)
mail = forms.CharField(label="email ", max_length=255)

# defaultowo required jest false
accept_rodo = forms.BooleanField()

# https://www.youtube.com/watch?v=pFMrOpDs4QQ
# accept_rodo = forms.BooleanField(label='accept rodo', help_text='zaakceptuj warunki rodo')

# modelForm
# https://youtu.be/EX6Tt-ZW0so
69 changes: 69 additions & 0 deletions eventnj/events/management/commands/create_event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
from django.core.management.base import BaseCommand
from django.utils import timezone

from events.models import Event, Organizer
from datetime import datetime
from random import choice, randint


# from django.conf import settings
# from django.utils.timezone import make_aware


class Command(BaseCommand):
help = "wypełnij organizer danymi -- python manage.py create_event 1"

def add_arguments(self, parser):
parser.add_argument('total', type=int, help='Indicates the number of organizers to be created')

def handle(self, *args, **options):
total = options['total']

len_events = len(Event.objects.all())

# sprawdzaj jaki postfix ma ostatni rekord
# ostatni = Event.objects.all()[len_events - 1:len_events].get().id

if len_events != 0:
ostatni = Event.objects.last().id
else:
ostatni = 0

# postfix kolejnej wartości
# https://docs.python.org/3.9/library/string.html
# postfix = "{:0>5}".format(str(ostatni + 1))

formatedDate = datetime.now(tz=timezone.utc)

# myDate = datetime(2013, 11, 20, 20, 8, 7, 127325, tzinfo=pytz.UTC)

# formatedDate = myDate #.strftime("%Y-%m-%d %H:%M:%S")
CONST_RANDINT_RESERVE = 25
CONST_RANDINT = 50
CONST_PRICE = 25

print("create_event")

for i in range(total):
postfix = str("{:0>5}".format(str(ostatni + 1 + i)))
# print(postfix)
Event.objects.create(
title="event_" + postfix,
description="description_" + postfix,
limit_participant_reserve=CONST_RANDINT_RESERVE + randint(1, 3) * 10,
limit_participant=CONST_RANDINT + randint(1, 6) * 10,
start=formatedDate,
end=formatedDate,
start_registration=formatedDate,
end_registration=formatedDate,
country="country_" + postfix,
city="city_" + postfix,
street="street_" + postfix,
postcode=postfix,
room="room_" + postfix,
price=CONST_PRICE + randint(1, 10) * 5,
is_online=False,
online_link="link_" + postfix,
)

self.stdout.write(self.style.SUCCESS(f"dopisane {total} rekordów"))
39 changes: 39 additions & 0 deletions eventnj/events/management/commands/create_organizer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from django.core.management.base import BaseCommand
# from events.management.commands.create_db import create_organizer

from events.models import Organizer


class Command(BaseCommand):
help = "wypełnij organizer danymi -- python manage.py create_organizer 5"

def add_arguments(self, parser):
parser.add_argument('total', type=int, help='Indicates the number of organizers to be created')

def handle(self, *args, **options):
total = options['total']

len_organizers = len(Organizer.objects.all())

# sprawdzaj jaki postfix ma ostatni rekord
# ostatni = Organizer.objects.all()[len_organizers - 1:len_organizers].get().id
if len_organizers != 0:
ostatni = Organizer.objects.last().id
else:
ostatni = 0

# postfix kolejnej wartości
# https://docs.python.org/3.9/library/string.html
# postfix = "{:0>5}".format(str(ostatni + 1))

print("create_organizer")
for i in range(total):
postfix = str("{:0>5}".format(str(ostatni + 1 + i)))
# print(postfix)
Organizer.objects.create(
name="organizer_" + postfix,
description="description_" + postfix,
mail="o_" + postfix + "@o.pl"
)

self.stdout.write(self.style.SUCCESS(f"dopisane {total} rekordów"))
47 changes: 47 additions & 0 deletions eventnj/events/management/commands/create_participant.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from django.core.management.base import BaseCommand
from django.utils import timezone
from datetime import datetime
from events.models import Participant, Event


class Command(BaseCommand):
help = "wypełnij participant danymi 5 uczestników przypisz do eventu o pk=3 " \
"-- python manage.py create_participant 5 3"


def add_arguments(self, parser):
# parser.add_argument('total', type=int, help='Indicates the number of participants to be created')
parser.add_argument('total', action="extend", nargs=2, type=int, help="Indicates the number of participants to be created for id event")

def handle(self, *args, **options):
total = options['total']

len_participants = len(Participant.objects.all())
# print(len_participants)

# sprawdzaj jaki postfix ma ostatni rekord
if len_participants != 0:
ostatni = Participant.objects.last().id
else:
ostatni = 0

# postfix kolejnej wartości
# https://docs.python.org/3.9/library/string.html
# postfix = "{:0>5}".format(str(ostatni + 1))

formatedDate = datetime.now(tz=timezone.utc)

print("create_participant")

for i in range(total[0]):
postfix = str("{:0>5}".format(str(ostatni + 1 + i)))
# print(i + 1)
Participant.objects.create(
name="participant_" + postfix,
mail="p_" + postfix + "@p.pl",
date_change_status=formatedDate,
created=formatedDate,
event=Event.objects.get(pk=total[1])
)

self.stdout.write(self.style.SUCCESS(f"dopisane {total[0]} rekordów"))
46 changes: 46 additions & 0 deletions eventnj/events/management/commands/create_photo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from django.core.management.base import BaseCommand
# from events.management.commands.create_db import create_organizer

from events.models import Photo, Event


class Command(BaseCommand):
help = "wypełnij organizer danymi -- python manage.py create_photo n photos, id event"

def add_arguments(self, parser):

# parser.add_argument('total', type=int , help='Indicates the number of photos to be created')
parser.add_argument('total', action="extend", nargs=2, type=int, help="number of photos, event id")


def handle(self, *args, **options):
total = options['total']


len_photos = len(Photo.objects.all())

# sprawdzaj jaki postfix ma ostatni rekord

if len_photos != 0:
ostatni = Photo.objects.last().id
else:
ostatni = 0

# postfix kolejnej wartości
# https://docs.python.org/3.9/library/string.html
# postfix = "{:0>5}".format(str(ostatni + 1))
# print(f"total: {total}")

print("create_photo")

for i in range(total[0]):
postfix = str("{:0>5}".format(str(ostatni + 1 + i)))
# print(postfix)

Photo.objects.create(
name="name_" + postfix,
image="image_" + postfix,
event=Event.objects.get(pk=total[1])
)

self.stdout.write(self.style.SUCCESS(f"dopisane {total[0]} rekordy, event {total[1]}"))
Loading