Commit a0c32890 authored by Pierre-antoine Comby's avatar Pierre-antoine Comby

add basic profile page

parent 3cce5769
Pipeline #1431 passed with stage
in 2 minutes and 51 seconds
......@@ -48,6 +48,8 @@ class Profile(models.Model):
verbose_name = _('user profile')
verbose_name_plural = _('user profile')
def get_absolute_url(self):
return reverse('user_detail',args=(self.pk,))
class Club(models.Model):
"""
......
......@@ -10,8 +10,9 @@ from . import views
app_name = 'member'
urlpatterns = [
path('signup/',views.SignUp.as_view(),name="signup"),
path('signup/',views.UserCreateView.as_view(),name="signup"),
path('club/',views.ClubListView.as_view(),name="club_list"),
path('club/<int:pk>/',views.ClubDetailView.as_view(),name="club_detail"),
path('club/create/',views.ClubCreateView.as_view(),name="club_create")
path('club/create/',views.ClubCreateView.as_view(),name="club_create"),
path('user/<int:pk>',views.UserDetailView.as_view(),name="user_detail")
]
......@@ -13,7 +13,7 @@ from django.urls import reverse_lazy
from .models import Profile, Club
from .forms import ProfileForm, ClubForm
class SignUp(CreateView):
class UserCreateView(CreateView):
"""
Une vue pour inscrire un utilisateur et lui créer un profile
......@@ -39,6 +39,11 @@ class SignUp(CreateView):
return super().form_valid(form)
class UserDetailView(LoginRequiredMixin,DetailView):
model = Profile
class ClubCreateView(LoginRequiredMixin,CreateView):
"""
Create Club
......@@ -55,6 +60,7 @@ class ClubListView(LoginRequiredMixin,ListView):
"""
model = Club
form_class = ClubForm
class ClubDetailView(LoginRequiredMixin,DetailView):
"""
"""
......
......@@ -48,7 +48,7 @@
<i class="fa fa-user-circle"> {{ user.username }}</i>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="#"> <i class="fa fa-user"></i> Mon compte </a>
<a class="dropdown-item" href="{% url 'member:user_detail' pk=user.profile.pk %}"> <i class="fa fa-user"></i> Mon compte </a>
<a class="dropdown-item" href="{% url 'logout' %}">
<i class="fa fa-sign-out"></i>
Se déconnecter</a>
......
{% extends "base.html" %}
{% load static %}
{% block content %}
<h5>Compte n° {{object.pk}}</h5>
<table>
<tr>
<td> <img src="{{ object.note.display_image.url }}" alt="" /> </td>
</tr>
<tr><th> Nom</th><td>{{ object.user.name }}</td></tr>
<tr><th>Prénom </th><td>{{object.user.first_name}}</td></tr>
<tr><th>Pseudo</th><td> {{object.user.username}}</td></tr>
<tr><th> Aliases</th><td>{{object.user.note.aliases_set.all }}</td></tr>
<tr><th>Pseudo</th><td> {{object.user.username}}</td></tr>
<tr><th>Section</th><td> {{object.section}}</td></tr>
<tr><th>Adresse</th><td> {{object.address}}</td></tr>
<tr><th>Solde</th><td> {{object.user.note.balance}}</td></tr>
</table>
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment