Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
135 changes: 135 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# flyctl launch added from .gitignore
# 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
**/pip-wheel-metadata
**/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

# 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
**/target

# Jupyter Notebook
**/.ipynb_checkpoints

# IPython
**/profile_default
**/ipython_config.py

# pyenv
**/.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

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
**/__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
**/.idea

**/.postgres_data
**/.app
fly.toml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,4 @@ dmypy.json

.postgres_data/
.app/
fly.toml
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
FROM python:3.10
FROM python:3.10-slim-buster

ENV PYTHONUNBUFFERED 1

WORKDIR /app

RUN apt-get update \
&& apt-get -y install libpq-dev gcc

COPY poetry.lock /app/poetry.lock
COPY pyproject.toml /app/pyproject.toml

RUN pip install poetry && \
poetry config virtualenvs.create false && \
poetry install --no-dev

COPY /project /app/project
COPY /project /app

CMD ["cd", "project"]
CMD ["gunicorn", "--bind", ":8000", "--workers", "2", "config.wsgi", "access-logfile", "-"]
29 changes: 0 additions & 29 deletions docker-compose.yaml

This file was deleted.

37 changes: 26 additions & 11 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div class="form-floating">
{{ form.description }}
<label for="{{ form.description.label }}">{{ form.description.label }}</label>
{% for error in field.errors %}
{% for error in form.description.errors %}
<p class="mt-3 text-danger">{{ error }}</p>
{% endfor %}
</div>
Expand All @@ -37,7 +37,7 @@
<div class="col-4">
<div class="mb-3">
{{ form.file }}
{% for error in field.errors %}
{% for error in form.file.errors %}
<p class="mt-3 text-danger">{{ error }}</p>
{% endfor %}
</div>
Expand Down
11 changes: 9 additions & 2 deletions project/apps/notes/migrations/0002_alter_note_options.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
# Generated by Django 4.1.6 on 2023-02-13 12:57


from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('notes', '0001_initial'),

]

operations = [
migrations.AlterModelOptions(
name='note',
options={'ordering': ['-created_at'], 'verbose_name': 'Note', 'verbose_name_plural': 'Notes'},
name="note",
options={
"ordering": ["-created_at"],
"verbose_name": "Note",
"verbose_name_plural": "Notes",
},

),
]
8 changes: 7 additions & 1 deletion project/apps/notes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from django.shortcuts import render, redirect, get_object_or_404
from django.db.utils import IntegrityError


from utils.pagination import get_paginator
from .forms import TagForm, NoteForm
from .models import Tag, Note
from .services import get_user_tag, get_user_notes, get_user_choice_tags, get_user_notes_filter, set_done_user_note, \
Expand All @@ -16,15 +18,18 @@ def main(request):
choice_done = request.POST.getlist('done_or_not')
notes = get_user_notes_filter(user=request.user, choice_tags=choice_tags,
choice_done=choice_done) if request.user.is_authenticated else []
notes, pages = get_paginator(request, notes, 10)
if request.method == 'POST':
return render(request, 'notes/notes_list.html',
context={'notes': notes,
'pages': pages,
'tags': tags,
'choice_tags': request.POST.getlist('tags'),
'choice_done': choice_done})
else:
return render(request, 'notes/notes_list.html',
context={'notes': notes,
'pages': pages,
'tags': tags,
'choice_tags': [],
'choice_done': []})
Expand All @@ -49,7 +54,8 @@ def add_tag(request):
else:
return render(request, 'notes/tag.html', context={'form': form, 'tags': tags})

return render(request, 'notes/tag.html', context={'form': TagForm(), 'tags': tags, 'tags_for_remove': tags_for_remove})
return render(request, 'notes/tag.html',
context={'form': TagForm(), 'tags': tags, 'tags_for_remove': tags_for_remove})


@login_required
Expand Down
Loading