Compare commits

..

6 commits

Author SHA1 Message Date
Jannis Portmann
51f71ec540 Crop image for equal card height 2023-04-02 23:15:16 +02:00
Jannis Portmann
8083148725 Convert to title string 2023-04-02 23:03:50 +02:00
Jannis Portmann
6e11099343 Link to profile 2023-04-02 22:52:47 +02:00
Jannis Portmann
d796953e4d Update user detail link 2023-04-02 22:47:04 +02:00
Jannis Portmann
4ee52d2ba5 Add requirements 2023-04-02 22:28:49 +02:00
Jannis Portmann
2ae20d9b99 Ignore python stuff 2023-04-02 16:13:10 +02:00
7 changed files with 347 additions and 4 deletions

322
.gitignore vendored
View file

@ -38,3 +38,325 @@ Icon
Network Trash Folder Network Trash Folder
Temporary Items Temporary Items
.apdisk .apdisk
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

View file

@ -78,4 +78,11 @@ a {
.btn.active, .btn.active,
.dropdown-item.active { .dropdown-item.active {
background-color: var(--pfl-color) !important; background-color: var(--pfl-color) !important;
}
.offer-img {
object-fit: cover;
object-position: center;
width: 100%;
height: 25rem !important;
} }

View file

@ -94,7 +94,11 @@
<div class="d-flex flex-row"> <div class="d-flex flex-row">
{% if request.user %} {% if request.user %}
<li class="nav-item me-2 md-me-0"> <li class="nav-item me-2 md-me-0">
<div class="nav-link mr-auto">{{ request.user.username }}</div> <a href="{% url 'user_profile' %}">
<div class="nav-link mr-auto">
<i class="me-1 fa-solid fa-user"></i>{{ request.user.username }}
</div>
</a>
</li> </li>
{% endif %} {% endif %}
<li class="nav-item"> <li class="nav-item">

View file

@ -19,7 +19,7 @@
</div> </div>
</a> </a>
<div class="card-footer d-flex justify-content-between"> <div class="card-footer d-flex justify-content-between">
<a href="#"> <a href="{% url 'user_detail' offer.user.id %}">
<i class="fas fa-user mt-3"></i> {{ offer.user.username }} <i class="fas fa-user mt-3"></i> {{ offer.user.username }}
</a> </a>
<p class="zip"> <p class="zip">

View file

@ -13,8 +13,8 @@ urlpatterns = [
path("offer/<int:offer_id>/delete/", views.offer_delete, name="offer_delete"), path("offer/<int:offer_id>/delete/", views.offer_delete, name="offer_delete"),
path("offer/<int:offer_id>/edit/", views.offer_edit, name="offer_edit"), path("offer/<int:offer_id>/edit/", views.offer_edit, name="offer_edit"),
path("offer/<int:offer_id>/trade/", views.offer_trade, name="offer_trade"), path("offer/<int:offer_id>/trade/", views.offer_trade, name="offer_trade"),
path("user/<int:user_id>", views.user_detail, name="user_detail"), path("accounts/<int:user_id>", views.user_detail, name="user_detail"),
path('accounts/login/', auth_views.LoginView.as_view(template_name='registration/login.html')), path('accounts/login/', auth_views.LoginView.as_view(template_name='registration/login.html')),
path('accounts/profile/', auth_views.LoginView.as_view(template_name='user/detail.html')), path('accounts/profile/', auth_views.LoginView.as_view(template_name='user/detail.html'), name='user_profile'),
path('accounts/', include('django.contrib.auth.urls')), path('accounts/', include('django.contrib.auth.urls')),
] ]

View file

@ -28,6 +28,7 @@ def create_offer(request):
offer = form.save(commit=False) offer = form.save(commit=False)
offer.image.name = generate_unique_filename(form.cleaned_data['image'].name) offer.image.name = generate_unique_filename(form.cleaned_data['image'].name)
offer.user = request.user offer.user = request.user
offer.title = offer.title.title()
offer.save() offer.save()
messages.success(request, "Offer uploaded successfully!") messages.success(request, "Offer uploaded successfully!")
return redirect("offer_detail", offer.id) return redirect("offer_detail", offer.id)

9
requirements.txt Normal file
View file

@ -0,0 +1,9 @@
crispy-bootstrap5==0.7
Django==4.1.7
django-bootstrap5==22.2
django-crispy-forms==2.0
django-jquery==3.1.0
gunicorn==20.1.0
fontawesomefree==6.3.0
Pillow==9.4.0
psycopg2-binary==2.9.5