mirror of
				https://gitlab.crans.org/bde/nk20
				synced 2025-11-04 09:12:11 +01:00 
			
		
		
		
	add basic profile page
This commit is contained in:
		@@ -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>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								templates/member/profile_detail.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								templates/member/profile_detail.html
									
									
									
									
									
										Normal file
									
								
							@@ -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 %}
 | 
			
		||||
		Reference in New Issue
	
	Block a user