Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit a9f7fc40 authored by Sylvain Coulange's avatar Sylvain Coulange
Browse files

ajout lastTrace dans Profile

parent 3003d1c6
# Generated by Django 3.0.5 on 2021-05-06 15:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('clavier', '0012_auto_20210324_2000'),
]
operations = [
migrations.RenameField(
model_name='serie',
old_name='images',
new_name='imageFin',
),
migrations.RenameField(
model_name='serie',
old_name='phono',
new_name='phonoFin',
),
migrations.RenameField(
model_name='serie',
old_name='synthvoc',
new_name='syntheseVocale',
),
migrations.RenameField(
model_name='serie',
old_name='videoMode',
new_name='videoDeb',
),
]
......@@ -57,6 +57,7 @@ urlpatterns = [
path('_playIpa/', csrf_exempt(clavier_views.playIpa)),
path('_getStats/', csrf_exempt(user_views.getTracesStats)),
path('_getSynthVocTraces/', csrf_exempt(user_views.getSynthVocTraces)),
path('users/', user_views.usersPage, name='users'),
path('users/<str:username>/', user_views.userInfo, name='userInfo'),
......
/* CSS ALeM-APP v3 */
/* https://alem.hypotheses.org/ */
/* Last update: 2021/03/18 */
/* Last update: 2021/04/26 */
:root {
--bicolor1: #ff0000;
......@@ -187,6 +187,7 @@
.phon_z_retr { fill: var(--phon_z_retr); color:var(--phon_z_retr); stop-color:var(--phon_z_retr); background:-webkit-linear-gradient(var(--phon_z_retr), var(--phon_z_retr));-webkit-background-clip: text;background-clip: text;-webkit-text-fill-color: transparent; } /*ʐ z`*/
.phon_nas { fill: var(--phon_nas); color:var(--phon_nas); stop-color:var(--phon_nas); background:-webkit-linear-gradient(var(--phon_nas), var(--phon_nas));-webkit-background-clip: text;background-clip: text;-webkit-text-fill-color: transparent; } /*̃ */
.phon_rho { fill: var(--phon_rho); color:var(--phon_rho); stop-color:var(--phon_rho); background:-webkit-linear-gradient(var(--phon_rho), var(--phon_rho));-webkit-background-clip: text;background-clip: text;-webkit-text-fill-color: transparent; } /* ˞ */
.phon_schwi { fill: var(--phon_schwi); color:var(--phon_schwi); stop-color:var(--phon_schwi); background:-webkit-linear-gradient(var(--phon_schwi), var(--phon_schwi));-webkit-background-clip: text;background-clip: text;-webkit-text-fill-color: transparent; } /* pour l'anglais i/ɪ*/
.phon_schwa { fill: var(--phon_schwa); color:var(--phon_schwa); stop-color:var(--phon_schwa); background:-webkit-linear-gradient(var(--phon_schwa), var(--phon_schwa));-webkit-background-clip: text;background-clip: text;-webkit-text-fill-color: transparent; } /* pour l'anglais ə */
......@@ -198,6 +199,9 @@
.bicolorWhite2 { fill: var(--bicolorWhite2); color: var(--bicolorWhite2); }
/* gradients 40% */
.phon_wo { background:-webkit-linear-gradient(var(--phon_w) 42%, var(--phon_o) 40%);-webkit-background-clip: text;background-clip: text;-webkit-text-fill-color: transparent;}
/* gradients 50% */
.phon_arho { background:-webkit-linear-gradient(var(--phon_a) 52%, var(--phon_rho) 50%);-webkit-background-clip: text;background-clip: text;-webkit-text-fill-color: transparent;}
.phon_7rho { background:-webkit-linear-gradient(var(--phon_7) 52%, var(--phon_rho) 50%);-webkit-background-clip: text;background-clip: text;-webkit-text-fill-color: transparent;}
......@@ -260,6 +264,15 @@
.phon_ju_majr { background: -webkit-linear-gradient(var(--phon_j) 58%, var(--phon_u_maj) 58%, var(--phon_r_slash) 60%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;}
.phon_ai_majarobase { background: -webkit-linear-gradient(var(--phon_a) 58%, var(--phon_i_maj) 58%, var(--phon_arobase) 60%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;}
/* gradients horizontaux (mandarin) */
.phon_ts-h { background: linear-gradient(to right, var(--phon_t) 52%, var(--phon_s) 50%)}
.phon_t_hs-h { background: linear-gradient(to right, var(--phon_t_h) 52%, var(--phon_s) 50%)}
.phon_ts_retr-h { background: linear-gradient(to right, var(--phon_t) 52%, var(--phon_s_retr) 50%)}
.phon_t_hs_retr-h { background: linear-gradient(to right, var(--phon_t_h) 52%, var(--phon_s_retr) 50%)}
.phon_ts_slash-h { background: linear-gradient(to right, var(--phon_t) 52%, var(--phon_s_slash) 50%)}
.phon_t_hs_slash-h { background: linear-gradient(to right, var(--phon_t_h) 52%, var(--phon_s_slash) 50%)}
/*STYLES DES TRANSCRIPTIONS GRAPHIQUES*/
.tran {
font-style:normal;
......
......@@ -13,7 +13,7 @@
<h1>Utilisateurs</h1>
<table class="table table-hover" id="usersTable" data-order='[[ 0, "desc"]]' data-page-length='50'>
<table class="table table-hover" id="usersTable" data-order='[[ 4, "desc"]]' data-page-length='50'>
<thead>
<tr>
<th scope="col">Id</th>
......@@ -31,7 +31,7 @@
<td>{{ user.username }}</td>
<td>{{ user.first_name }} {{ user.last_name }}</td>
<td><a href="mailto:{{ user.email }}">{{ user.email }}</a></td>
<td>{{ user.last_login | date:'Y/m/d H:m'}}</td>
<td>{{ user.profile.lastTrace | date:'Y/m/d H:i'}}</td>
<td>
{% for group in user.groups.all %}
{% if group.name == "admin" %}
......
# Generated by Django 3.0.5 on 2021-05-06 15:57
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0007_synthvocrecord'),
]
operations = [
migrations.AddField(
model_name='profile',
name='lastTrace',
field=models.DateTimeField(default=datetime.date(2021, 5, 6)),
),
]
# Generated by Django 3.0.5 on 2021-05-06 16:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0008_profile_lasttrace'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='lastTrace',
field=models.DateTimeField(auto_now_add=True),
),
]
from django.db import models
from django.contrib.auth.models import User
from PIL import Image
import datetime
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
image = models.ImageField(default='profile_pics/default.png', upload_to='profile_pics')
lastTrace = models.DateTimeField(auto_now_add=True, auto_now=False)
def __str__(self):
return f'Profil de {self.user.username}'
......
......@@ -300,6 +300,11 @@ def getTracesStats(request):
@allowed_users(allowed_roles=['admin'])
def usersPage(request):
users = User.objects.all()
for user in users:
lastTrace = Trace.objects.filter(user=user).last()
if lastTrace:
user.profile.lastTrace = lastTrace.date
print(user, user.profile.lastTrace)
return render(request, 'users/usersPage.html', {'users':users})
......@@ -368,4 +373,26 @@ def downloadTraces(request):
return response
# https://docs.djangoproject.com/en/3.1/ref/models/querysets/#range
\ No newline at end of file
# https://docs.djangoproject.com/en/3.1/ref/models/querysets/#range
@allowed_users(allowed_roles=['admin'])
def getSynthVocTraces(request):
print("Téléchargement csv synthVocTraces...")
synthVocTraces = SynthVocTrace.objects.all()
response = HttpResponse(content_type='text/csv')
writer = csv.writer(response, csv.excel)
response.write(u'\ufeff'.encode('utf8'))
writer.writerow(['id', 'user', 'date', 'appli', 'lenssml'])
for trace in synthVocTraces:
writer.writerow([
trace.id,
trace.user,
trace.date,
trace.appli,
trace.lenssml
])
return response
\ No newline at end of file
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