python - how to get user's informations by clic on the user_object in a user_list view -
i'm beginner in django, i'm trying is:
i want build view staff_user. inside view staff member can select user (from list of users) , clic lets him informations(specifically check files uploaded selected user)
some of code :
models.py
from django.db import models django.contrib.auth.models import user django.db.models.signals import post_save django.dispatch import receiver class profile(models.model): user = models.onetoonefield(user, on_delete=models.cascade) birth_date = models.datefield(('date de naissance'), null=true, blank=true) phone_number = models.integerfield(('n° de téléphone'), null=true, blank=true) profile_completed = models.booleanfield(('profile completé'), default=false) #documents upload id_card = models.filefield(('carte nationale d\'identité'), upload_to='documents/cni') drive_licence = models.filefield(('permis de conduire'), upload_to='documents/permis_conduire') police_record = models.filefield(('casier judiciaire'), upload_to='documents/casier_judiciaire') carte_vitale = models.filefield(('carte vitale'), upload_to='documents/carte_vitale') medical_visit = models.filefield(('visite médicale'), upload_to='documents/medical_visit') rib = models.filefield(('relevé d\'identité bancaire (rib)'), upload_to='documents/rib') uploaded_at = models.datetimefield(('ajouté le'), auto_now_add=true) docs_are_checked = models.booleanfield(('documents verifés'), default=false) def __str__(self): return self.user.username @receiver(post_save, sender=user) def update_user_profile(sender, instance, created, **kwargs): if created: profile.objects.create(user=instance) instance.profile.save()
app/urls.py
from django.conf.urls import url, include django.contrib.auth import views auth_views . import views core_views urlpatterns = [ url(r'^accounts/login/$', auth_views.login, {'template_name': 'login.html'}, name='login'), url(r'^accounts/logout/$', auth_views.logout, {'next_page': 'login'}, name='logout'), url(r'^accounts/signup/$', core_views.signup, name='signup'), url(r'^account_activation_sent/$', core_views.account_activation_sent, name='account_activation_sent'), url(r'^accounts/activate/(?p<uidb64>[0-9a-za-z_\-]+)/(?p<token>[0-9a-za- z]{1,13}-[0-9a-za-z]{1,20})/$', core_views.activate, name='activate'), url(r'^accounts/email_confirmation_done/$', core_views.email_confirmation_done, name='email_confirmation_done'), url(r'^accounts/complete_profile/$', core_views.complete_profile, name='complete_profile'), url(r'^accounts/upload_files/$', core_views.upload_files, name='upload_files'), url(r'^profile/$', core_views.view_profile, name='view_profile'),
Comments
Post a Comment