Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into feature/submission-form
Browse files Browse the repository at this point in the history
  • Loading branch information
bitterteriyaki committed Nov 22, 2023
2 parents 4c5111d + 5a01521 commit fa358fe
Show file tree
Hide file tree
Showing 15 changed files with 115 additions and 9 deletions.
15 changes: 15 additions & 0 deletions apps/users/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,18 @@ def test_post_valid_data(self) -> None:
self.assertIsNotNone(user)
self.client.force_login(user)
self.assertTrue(self.client.session["_auth_user_id"])

def test_email(self) -> None:
user = User.objects.create_user(
username="testuser",
email="[email protected]",
password="testpassword",
)
self.client.force_login(user)

url = reverse("users:profile", args=[user.username])

response = self.client.get(url)

self.assertEqual(response.status_code, 200)
self.assertContains(response, user.email)
7 changes: 5 additions & 2 deletions apps/users/urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from django.urls import path

from apps.users.views import RegisterView
from apps.users.views import ProfileView, RegisterView

app_name = "users"

urlpatterns = [
path("", RegisterView.as_view(), name="register"),
path("register/", RegisterView.as_view(), name="register"),
path(
"profile/<str:user_username>/", ProfileView.as_view(), name="profile"
),
]
11 changes: 10 additions & 1 deletion apps/users/views.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from django.contrib.auth import login
from django.http import HttpRequest, HttpResponse
from django.shortcuts import redirect, render
from django.shortcuts import get_object_or_404, redirect, render
from django.views import View

from apps.users.forms import CreateUserForm
from apps.users.models import User


class RegisterView(View):
Expand All @@ -25,3 +26,11 @@ def post(self, request: HttpRequest) -> HttpResponse:
return redirect("home")

return render(request, self.template_name, {"form": form})


class ProfileView(View):
template_name = "users/profile.html"

def get(self, request: HttpRequest, user_username: str) -> HttpResponse:
user = get_object_or_404(User, username=user_username)
return render(request, self.template_name, {"user": user})
6 changes: 3 additions & 3 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ executará as migrações. Faça isso com o seguinte comando:

.. code-block:: bash
$ docker compose run --rm web python manage.py migrate
$ docker compose run --rm django python manage.py migrate
.. hint::

Expand Down Expand Up @@ -221,10 +221,10 @@ seguinte comando:

.. code-block:: bash
$ docker compose run --rm web python manage.py createsuperuser
$ docker compose run --rm django python manage.py createsuperuser
E para criar migrações do banco de dados, use o seguinte comando:

.. code-block:: bash
$ docker compose run --rm web python manage.py makemigrations
$ docker compose run --rm django python manage.py makemigrations
2 changes: 1 addition & 1 deletion docs/source/reunioes/atas/reuniao-04.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Reunião 04
==========

:bdg-info:`18/10/2023` :bdg-warning:`Sprint 2`
:bdg-info:`18/10/2023` :bdg-warning:`Sprint 2`

Resumo
------
Expand Down
10 changes: 10 additions & 0 deletions docs/source/reunioes/atas/reuniao-05.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Reunião 04
==========

:bdg-info:`25/10/2023` :bdg-warning:`Sprint 3`

Resumo
------

Esta reunião teve como objetivos nivelar o nivel de conhecimento dos integrantes e retirada
de duvidas.
10 changes: 10 additions & 0 deletions docs/source/reunioes/atas/reuniao-06.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Reunião 06
==========

:bdg-info:`13/11/2023` :bdg-warning:`Sprint 4`

Resumo
------

Esta reunião teve como objetivos discutir o progresso, anunciar a saida de um
integrante.
10 changes: 10 additions & 0 deletions docs/source/reunioes/atas/reuniao-07.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Reunião 07
==========

:bdg-info:`16/11/2023` :bdg-warning:`Sprint 4`

Resumo
------

Esta reunião teve como objetivos redistribuir as partes de cada integrante e a
redução do prazo para entrega das issues.
3 changes: 3 additions & 0 deletions docs/source/reunioes/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ Atas
atas/reuniao-02
atas/reuniao-03
atas/reuniao-04
atas/reuniao-05
atas/reuniao-06
atas/reuniao-07
1 change: 1 addition & 0 deletions docs/source/scrum/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ Sprints
sprints/sprint-1
sprints/sprint-2
sprints/sprint-3
sprints/sprint-4
32 changes: 32 additions & 0 deletions docs/source/scrum/sprints/sprint-4.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Sprint 4
========

:bdg-info:`19/11/2023`

Resumo
------

Nesta sprint, a equipe de desenvolvimento começou a trabalhar na segunda release. As
principais atividades foram o início do desenvolvimento da parte de submissões e a
estilização da página de login para melhor acessibilidade do usuário.


Changelog
----------

- `Criar app de submissões (#66) <https://github.com/unb-mds/2023-2-Squad06/issues/66>`_
- `App inicial de submissões (PR) (#77) <https://github.com/unb-mds/2023-2-Squad06/pull/77>`_
- `Adicionar validadores em todas as páginas de admin (PR) (#76) <https://github.com/unb-mds/2023-2-Squad06/pull/76>`_
- `Estilizar página de login (#63) <https://github.com/unb-mds/2023-2-Squad06/issues/63>`_
- `Estilizar página de login (PR) (#75) <https://github.com/unb-mds/2023-2-Squad06/issues/75>`_
- `Adicionar documentação da Sprint 03 (#62) <https://github.com/unb-mds/2023-2-Squad06/issues/62>`_
- `Adicionar Documentação da Sprint 03 (PR) (#73) <https://github.com/unb-mds/2023-2-Squad06/issues/73>`_
- `Retirar nome de ex-integrante do grupo (#72) <https://github.com/unb-mds/2023-2-Squad06/issues/72>`_
- `Remover Nome de ex-Integrante (PR) (#74) <https://github.com/unb-mds/2023-2-Squad06/issues/74>`_
- `Adicionar Documentação da Sprint 02 (#67) <https://github.com/unb-mds/2023-2-Squad06/issues/67>`_
- `Adicionar documentação da Sprint 02 (PR) (#70) <https://github.com/unb-mds/2023-2-Squad06/issues/70>`_
- `Renomear o app apps.problems para apps.tasks (#31) <https://github.com/unb-mds/2023-2-Squad06/issues/31>`_
- `Rename apps.problems to apps.tasks (PR) (#61) <https://github.com/unb-mds/2023-2-Squad06/issues/61>`_
- `Initial problems form development (PR) (#65) <https://github.com/unb-mds/2023-2-Squad06/issues/65>`_
- `Add integrations with CI services (PR) (#59) <https://github.com/unb-mds/2023-2-Squad06/issues/59>`_
- `Bump django from 4.2.5 to 4.2.7 (PR) (#58) <https://github.com/unb-mds/2023-2-Squad06/issues/58>`_
1 change: 1 addition & 0 deletions server/settings/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"0.0.0.0",
"127.0.0.1",
".herokuapp.com",
"develop.squad06.com",
]

# In development, we don't need a secure password hasher. We can use
Expand Down
2 changes: 1 addition & 1 deletion server/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
path("", IndexView.as_view(), name="home"),
path("contests/", include("apps.contests.urls"), name="contests"),
path("tasks/", include("apps.tasks.urls")),
path("register/", include("apps.users.urls")),
path("", include("apps.users.urls")),
]
2 changes: 1 addition & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
</a>
</li>
{% endif %}
<li><a href="#" class="dropdown-item">Your profile</a></li>
<li><a href="{% url 'users:profile' user.username %}" class="dropdown-item">Your profile</a></li>
<li><hr class="dropdown-divider"></li>
<li>
<a href="{% url 'logout' %}" class="dropdown-item">
Expand Down
12 changes: 12 additions & 0 deletions templates/users/profile.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends "base.html" %}

{% block title %}User{% endblock title %}

{% block content %}
<div class="user-profile">
<h2>{{user.username}}</h2>
<p>Email: {{ user.email }}</p>
<p>Score: </p>
<p>Contests: </p>
</div>
{% endblock content %}

0 comments on commit fa358fe

Please sign in to comment.