mirror of https://gitlab.crans.org/bde/nk20
add basic profile page
This commit is contained in:
parent
3cce57695d
commit
a0c32890a9
|
@ -48,6 +48,8 @@ class Profile(models.Model):
|
||||||
verbose_name = _('user profile')
|
verbose_name = _('user profile')
|
||||||
verbose_name_plural = _('user profile')
|
verbose_name_plural = _('user profile')
|
||||||
|
|
||||||
|
def get_absolute_url(self):
|
||||||
|
return reverse('user_detail',args=(self.pk,))
|
||||||
|
|
||||||
class Club(models.Model):
|
class Club(models.Model):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -10,8 +10,9 @@ from . import views
|
||||||
|
|
||||||
app_name = 'member'
|
app_name = 'member'
|
||||||
urlpatterns = [
|
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/',views.ClubListView.as_view(),name="club_list"),
|
||||||
path('club/<int:pk>/',views.ClubDetailView.as_view(),name="club_detail"),
|
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 .models import Profile, Club
|
||||||
from .forms import ProfileForm, ClubForm
|
from .forms import ProfileForm, ClubForm
|
||||||
|
|
||||||
class SignUp(CreateView):
|
class UserCreateView(CreateView):
|
||||||
"""
|
"""
|
||||||
Une vue pour inscrire un utilisateur et lui créer un profile
|
Une vue pour inscrire un utilisateur et lui créer un profile
|
||||||
|
|
||||||
|
@ -39,6 +39,11 @@ class SignUp(CreateView):
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class UserDetailView(LoginRequiredMixin,DetailView):
|
||||||
|
model = Profile
|
||||||
|
|
||||||
|
|
||||||
class ClubCreateView(LoginRequiredMixin,CreateView):
|
class ClubCreateView(LoginRequiredMixin,CreateView):
|
||||||
"""
|
"""
|
||||||
Create Club
|
Create Club
|
||||||
|
@ -55,6 +60,7 @@ class ClubListView(LoginRequiredMixin,ListView):
|
||||||
"""
|
"""
|
||||||
model = Club
|
model = Club
|
||||||
form_class = ClubForm
|
form_class = ClubForm
|
||||||
|
|
||||||
class ClubDetailView(LoginRequiredMixin,DetailView):
|
class ClubDetailView(LoginRequiredMixin,DetailView):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
<i class="fa fa-user-circle"> {{ user.username }}</i>
|
<i class="fa fa-user-circle"> {{ user.username }}</i>
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink">
|
<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' %}">
|
<a class="dropdown-item" href="{% url 'logout' %}">
|
||||||
<i class="fa fa-sign-out"></i>
|
<i class="fa fa-sign-out"></i>
|
||||||
Se déconnecter</a>
|
Se déconnecter</a>
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
{% 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 %}
|
Loading…
Reference in New Issue