Skip to content

Commit 9731c3f

Browse files
yammesickaOdeYecleddcodePureDreamerzohary89
authored
Merge develop into master (#107)
* New page for event editting * Add profile link to navbar. Minor changes * Added a form to edit the event details * Added navigation tabs as base for event features * Created eventedit endpoint to render the form page * Fixed static and templates path to be compatible with testing * Added fastapi mail usage. * Set evniroment setting * Changed the way user is being created. * Added hypothesis and Faker for making users. * Splited the functions of the database to database, user, event. * feat: add agenda page for display the user events * Update README.md * Profile UI/UX updates. Add update full name, email, profile picture, user description * Copy config.py.example to config.py * Add default database string for devolpment * fix: agenda page feat, changes according to flake8 * Clarify merge profile-agenda-events * fix: Remove bad imports, add MEDIA variable name. * Change CI to run on develop * Added event view template and endpoint * Minor CSS fixes in event edit * Added demo templates * Update requirements.txt * smtpd mock * Changed requested changes * Create .gitattributes Co-authored-by: Odelia Yechiel <[email protected]> Co-authored-by: leddest <[email protected]> Co-authored-by: PureDreamer <[email protected]> Co-authored-by: ZoharYamin <[email protected]>
1 parent c370572 commit 9731c3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1789
-46
lines changed

.gitattributes

+280
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
* text=auto
2+
3+
4+
*.pxd text diff=python
5+
*.py text diff=python
6+
*.py3 text diff=python
7+
*.pyw text diff=python
8+
*.pyx text diff=python
9+
*.pyz text diff=python
10+
*.pyi text diff=python
11+
12+
# Binary files
13+
# ============
14+
*.db binary
15+
*.p binary
16+
*.pkl binary
17+
*.pickle binary
18+
*.pyc binary
19+
*.pyd binary
20+
*.pyo binary
21+
22+
# Jupyter notebook
23+
*.ipynb text
24+
25+
# These files are text and should be normalized (Convert crlf => lf)
26+
.gitignore text
27+
28+
# Documents
29+
*.bibtex text diff=bibtex
30+
*.doc diff=astextplain
31+
*.DOC diff=astextplain
32+
*.docx diff=astextplain
33+
*.DOCX diff=astextplain
34+
*.dot diff=astextplain
35+
*.DOT diff=astextplain
36+
*.pdf diff=astextplain
37+
*.PDF diff=astextplain
38+
*.rtf diff=astextplain
39+
*.RTF diff=astextplain
40+
*.md text
41+
*.tex text diff=tex
42+
*.adoc text
43+
*.textile text
44+
*.mustache text
45+
*.csv text
46+
*.tab text
47+
*.tsv text
48+
*.txt text
49+
*.sql text
50+
51+
# Graphics
52+
*.png binary
53+
*.jpg binary
54+
*.jpeg binary
55+
*.gif binary
56+
*.tif binary
57+
*.tiff binary
58+
*.ico binary
59+
# SVG treated as an asset (binary) by default.
60+
*.svg text
61+
# If you want to treat it as binary,
62+
# use the following line instead.
63+
# *.svg binary
64+
*.eps binary
65+
66+
# Scripts
67+
*.bash text eol=lf
68+
*.fish text eol=lf
69+
*.sh text eol=lf
70+
# These are explicitly windows files and should use crlf
71+
*.bat text eol=crlf
72+
*.cmd text eol=crlf
73+
*.ps1 text eol=crlf
74+
75+
# Serialisation
76+
*.json text
77+
*.toml text
78+
*.xml text
79+
*.yaml text
80+
*.yml text
81+
82+
# Archives
83+
*.7z binary
84+
*.gz binary
85+
*.tar binary
86+
*.tgz binary
87+
*.zip binary
88+
89+
# Text files where line endings should be preserved
90+
*.patch -text
91+
92+
# Source code
93+
*.bash text eol=lf
94+
*.cmd text eol=crlf
95+
*.coffee text
96+
*.css text
97+
*.htm text diff=html
98+
*.html text diff=html
99+
*.inc text
100+
*.ini text
101+
*.js text
102+
*.json text
103+
*.jsx text
104+
*.less text
105+
*.ls text
106+
*.map text -diff
107+
*.od text
108+
*.onlydata text
109+
*.php text diff=php
110+
*.pl text
111+
*.ps1 text eol=crlf
112+
*.rb text diff=ruby
113+
*.sass text
114+
*.scm text
115+
*.scss text diff=css
116+
*.sh text eol=lf
117+
*.sql text
118+
*.styl text
119+
*.tag text
120+
*.ts text
121+
*.tsx text
122+
*.xml text
123+
*.xhtml text diff=html
124+
125+
# Docker
126+
Dockerfile text
127+
128+
# Documentation
129+
*.markdown text
130+
*.md text
131+
*.mdwn text
132+
*.mdown text
133+
*.mkd text
134+
*.mkdn text
135+
*.mdtxt text
136+
*.mdtext text
137+
*.txt text
138+
AUTHORS text
139+
CHANGELOG text
140+
CHANGES text
141+
CONTRIBUTING text
142+
COPYING text
143+
copyright text
144+
*COPYRIGHT* text
145+
INSTALL text
146+
license text
147+
LICENSE text
148+
NEWS text
149+
readme text
150+
*README* text
151+
TODO text
152+
153+
# Templates
154+
*.dot text
155+
*.ejs text
156+
*.haml text
157+
*.handlebars text
158+
*.hbs text
159+
*.hbt text
160+
*.jade text
161+
*.latte text
162+
*.mustache text
163+
*.njk text
164+
*.phtml text
165+
*.tmpl text
166+
*.tpl text
167+
*.twig text
168+
*.vue text
169+
170+
# Configs
171+
*.cnf text
172+
*.conf text
173+
*.config text
174+
.editorconfig text
175+
.env text
176+
.gitattributes text
177+
.gitconfig text
178+
.htaccess text
179+
*.lock text -diff
180+
package-lock.json text -diff
181+
*.toml text
182+
*.yaml text
183+
*.yml text
184+
browserslist text
185+
Makefile text
186+
makefile text
187+
188+
# Heroku
189+
Procfile text
190+
191+
# Graphics
192+
*.ai binary
193+
*.bmp binary
194+
*.eps binary
195+
*.gif binary
196+
*.gifv binary
197+
*.ico binary
198+
*.jng binary
199+
*.jp2 binary
200+
*.jpg binary
201+
*.jpeg binary
202+
*.jpx binary
203+
*.jxr binary
204+
*.pdf binary
205+
*.png binary
206+
*.psb binary
207+
*.psd binary
208+
# SVG treated as an asset (binary) by default.
209+
*.svg text
210+
# If you want to treat it as binary,
211+
# use the following line instead.
212+
# *.svg binary
213+
*.svgz binary
214+
*.tif binary
215+
*.tiff binary
216+
*.wbmp binary
217+
*.webp binary
218+
219+
# Audio
220+
*.kar binary
221+
*.m4a binary
222+
*.mid binary
223+
*.midi binary
224+
*.mp3 binary
225+
*.ogg binary
226+
*.ra binary
227+
228+
# Video
229+
*.3gpp binary
230+
*.3gp binary
231+
*.as binary
232+
*.asf binary
233+
*.asx binary
234+
*.fla binary
235+
*.flv binary
236+
*.m4v binary
237+
*.mng binary
238+
*.mov binary
239+
*.mp4 binary
240+
*.mpeg binary
241+
*.mpg binary
242+
*.ogv binary
243+
*.swc binary
244+
*.swf binary
245+
*.webm binary
246+
247+
# Archives
248+
*.7z binary
249+
*.gz binary
250+
*.jar binary
251+
*.rar binary
252+
*.tar binary
253+
*.zip binary
254+
255+
# Fonts
256+
*.ttf binary
257+
*.eot binary
258+
*.otf binary
259+
*.woff binary
260+
*.woff2 binary
261+
262+
# Executables
263+
*.exe binary
264+
*.pyc binary
265+
266+
# RC files (like .babelrc or .eslintrc)
267+
*.*rc text
268+
269+
# Ignore files (like .npmignore or .gitignore)
270+
*.*ignore text
271+
272+
tests/samples/* text=false
273+
274+
#
275+
# Exclude files from exporting
276+
#
277+
278+
.gitattributes export-ignore
279+
.gitignore export-ignore
280+
.gitkeep export-ignore

.github/workflows/python-app.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: Python application
55

66
on:
77
push:
8-
branches: [ main ]
8+
branches: [ main, develop ]
99
pull_request:
10-
branches: [ main ]
10+
branches: [ main, develop ]
1111

1212
jobs:
1313
build:
@@ -24,6 +24,7 @@ jobs:
2424
run: |
2525
python -m pip install --upgrade pip
2626
pip install flake8 pytest pytest-cov
27+
cp app/config.py.example app/config.py
2728
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
2829
- name: Lint with flake8
2930
run: |

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
dev.db
2+
test.db
3+
config.py
4+
15
# Byte-compiled / optimized / DLL files
26
__pycache__/
37
*.py[cod]

README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
Run on Windows:
1+
# PyLander
22

3+
## Open Source Calendar built with Python
4+
5+
### Run on Windows:
6+
7+
```shell
38
virtualenv env
49
.\env\Scripts\activate.bat
510
pip install -r requirements.txt
6-
cd app
7-
uvicorn main:app --reload
11+
uvicorn app.main:app --reload
12+
```

app/config.py

Whitespace-only changes.

app/config.py.example

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import os
2+
3+
from fastapi_mail import ConnectionConfig
4+
# flake8: noqa
5+
6+
7+
# DATABASE
8+
DEVELOPMENT_DATABASE_STRING = "sqlite:///./dev.db"
9+
10+
# MEDIA
11+
MEDIA_DIRECTORY = 'media'
12+
PICTURE_EXTENSION = '.png'
13+
AVATAR_SIZE = (120, 120)
14+
15+
email_conf = ConnectionConfig(
16+
MAIL_USERNAME=os.getenv("MAIL_USERNAME") or "user",
17+
MAIL_PASSWORD=os.getenv("MAIL_PASSWORD") or "password",
18+
MAIL_FROM=os.getenv("MAIL_FROM") or "[email protected]",
19+
MAIL_PORT=587,
20+
MAIL_SERVER="smtp.gmail.com",
21+
MAIL_TLS=True,
22+
MAIL_SSL=False,
23+
USE_CREDENTIALS=True,
24+
)

app/database/database.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,23 @@
44
from sqlalchemy.ext.declarative import declarative_base
55
from sqlalchemy.orm import sessionmaker
66

7+
from app import config
78

8-
SQLALCHEMY_DATABASE_URL = os.getenv("DATABASE_CONNECTION_STRING")
9+
10+
SQLALCHEMY_DATABASE_URL = os.getenv(
11+
"DATABASE_CONNECTION_STRING", config.DEVELOPMENT_DATABASE_STRING)
912

1013
engine = create_engine(
1114
SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
1215
)
1316
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
1417

1518
Base = declarative_base()
19+
20+
21+
def get_db():
22+
db = SessionLocal()
23+
try:
24+
yield db
25+
finally:
26+
db.close()

app/database/models.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ class User(Base):
1111
username = Column(String, unique=True)
1212
email = Column(String, unique=True)
1313
password = Column(String)
14+
full_name = Column(String)
15+
description = Column(String, default="Happy new user!")
16+
avatar = Column(String, default="profile.png")
17+
1418
is_active = Column(Boolean, default=True)
1519

1620
events = relationship(
@@ -23,7 +27,8 @@ class Event(Base):
2327
id = Column(Integer, primary_key=True, index=True)
2428
title = Column(String)
2529
content = Column(String)
26-
date = Column(DateTime)
30+
start = Column(DateTime, nullable=False)
31+
end = Column(DateTime, nullable=False)
2732
owner_id = Column(Integer, ForeignKey("users.id"))
2833

2934
owner = relationship("User", back_populates="events")

0 commit comments

Comments
 (0)