django-transcribe 0.5.17__py3-none-any.whl → 0.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_transcribe-0.5.17.dist-info → django_transcribe-0.7.0.dist-info}/AUTHORS +6 -2
- django_transcribe-0.7.0.dist-info/METADATA +27 -0
- {django_transcribe-0.5.17.dist-info → django_transcribe-0.7.0.dist-info}/RECORD +34 -32
- {django_transcribe-0.5.17.dist-info → django_transcribe-0.7.0.dist-info}/WHEEL +1 -1
- transcribe/__init__.py +1 -1
- transcribe/admin.py +56 -11
- transcribe/apps.py +1 -2
- transcribe/filters.py +1 -2
- transcribe/forms.py +21 -4
- transcribe/migrations/0001_initial_squashed_0021_point_fks_to_transcribe_user.py +555 -0
- transcribe/migrations/0002_initial_data.py +3 -1
- transcribe/migrations/0007_reviewer_group_addition.py +2 -2
- transcribe/migrations/0018_point_fks_to_user.py +40 -0
- transcribe/migrations/0019_create_transcribeuser.py +43 -0
- transcribe/migrations/0020_populate_transcribe_users.py +18 -0
- transcribe/migrations/0021_point_fks_to_transcribe_user.py +57 -0
- transcribe/models.py +37 -21
- transcribe/signals.py +10 -1
- transcribe/templates/admin/base_site.html +1 -10
- transcribe/templates/transcribe/reports/list.html +1 -1
- transcribe/templates/transcribe/reports/projects.html +0 -19
- transcribe/templates/transcribe/reports/users.html +8 -8
- transcribe/templates/transcribe/web/dashboard.html +0 -5
- transcribe/templates/transcribe/web/project.html +1 -3
- transcribe/templates/transcribe/web/project_edit.html +0 -3
- transcribe/templates/transcribe/web/task_edit.html +22 -21
- transcribe/templates/transcribe/web/user.html +2 -57
- transcribe/templates/transcribe/web/users_list.html +11 -37
- transcribe/urls.py +27 -33
- transcribe/views/mixins.py +1 -1
- transcribe/views/reports.py +40 -28
- transcribe/views/web.py +15 -4
- django_transcribe-0.5.17.dist-info/METADATA +0 -24
- transcribe/templates/.DS_Store +0 -0
- transcribe/templates/admin/.DS_Store +0 -0
- transcribe/templates/transcribe/.DS_Store +0 -0
- {django_transcribe-0.5.17.dist-info → django_transcribe-0.7.0.dist-info}/LICENSE +0 -0
- {django_transcribe-0.5.17.dist-info → django_transcribe-0.7.0.dist-info}/top_level.txt +0 -0
transcribe/urls.py
CHANGED
|
@@ -1,74 +1,68 @@
|
|
|
1
1
|
from django.conf import settings as django_settings
|
|
2
|
-
from django.conf.urls import
|
|
2
|
+
from django.conf.urls.static import static
|
|
3
|
+
from django.urls import include, path
|
|
3
4
|
from transcribe.views import reports, web
|
|
4
5
|
|
|
5
6
|
handler404 = 'transcribe.views.web.display404'
|
|
6
7
|
handler500 = 'transcribe.views.web.display500'
|
|
7
8
|
|
|
8
9
|
project_views = [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
path('', web.landing_page, name='landing_page'),
|
|
11
|
+
path('help/', web.help, name='help'),
|
|
12
|
+
path('faq/', web.faq, name='faq'),
|
|
13
|
+
path('dashboard/', web.DashboardView.as_view(), name='dashboard'),
|
|
14
|
+
path(
|
|
15
|
+
'dashboard/all_tasks/',
|
|
15
16
|
web.DashboardView.as_view(),
|
|
16
17
|
name='dashboard_all_tasks',
|
|
18
|
+
kwargs={'all_tasks': 'all_tasks'},
|
|
17
19
|
),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
r'^project/(?P<pk>\d+)/$',
|
|
20
|
+
path('projects/', web.ProjectListView.as_view(), name='projects_list'),
|
|
21
|
+
path(
|
|
22
|
+
'project/<int:pk>/',
|
|
22
23
|
web.ProjectDetailView.as_view(),
|
|
23
24
|
name='project_detail',
|
|
24
25
|
),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
r'^project/(?P<pk>\d+)/download\.(?P<type>(xml|txt|html))$',
|
|
26
|
+
path(
|
|
27
|
+
'project/<int:pk>/download.<str:type>',
|
|
28
28
|
web.ProjectDownloadView.as_view(),
|
|
29
29
|
name='project_download',
|
|
30
30
|
),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
url(
|
|
34
|
-
r'^project/(?P<pk>\d+)/claim/(?P<type>(review|transcription|any))/$',
|
|
31
|
+
path(
|
|
32
|
+
'project/<int:pk>/claim/<str:type>/',
|
|
35
33
|
web.ProjectClaimTaskView.as_view(),
|
|
36
34
|
name='project_claim_task',
|
|
37
35
|
),
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
path(
|
|
37
|
+
'userpreferences/<int:pk>/update/',
|
|
40
38
|
web.UserPreferencesUpdateView.as_view(),
|
|
41
39
|
name='user_preferences_update',
|
|
42
40
|
),
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
path(
|
|
42
|
+
'userprojectpreferences/<int:pk>/update/',
|
|
45
43
|
web.UserProjectPreferencesUpdateView.as_view(),
|
|
46
44
|
name='user_project_preferences_update',
|
|
47
45
|
),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
web.UserTaskUpdateView.as_view(),
|
|
51
|
-
name='task_workon',
|
|
46
|
+
path(
|
|
47
|
+
'task/<int:pk>/', web.UserTaskUpdateView.as_view(), name='task_workon'
|
|
52
48
|
),
|
|
53
49
|
]
|
|
54
50
|
|
|
55
51
|
report_views = (
|
|
56
52
|
[
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
path('', reports.reports_list, name='list'),
|
|
54
|
+
path('projects/', reports.projects_report, name='projects_report'),
|
|
55
|
+
path('users/', reports.users_report, name='users_report'),
|
|
60
56
|
],
|
|
61
57
|
'reports',
|
|
62
58
|
)
|
|
63
59
|
|
|
64
60
|
urlpatterns = [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
url(r'^reports/', include(report_views)),
|
|
61
|
+
path('', include(project_views)),
|
|
62
|
+
path('reports/', include(report_views)),
|
|
68
63
|
]
|
|
69
64
|
|
|
70
65
|
if django_settings.DEBUG:
|
|
71
|
-
static = static.static
|
|
72
66
|
urlpatterns += static(
|
|
73
67
|
django_settings.STATIC_URL, document_root=django_settings.STATIC_ROOT
|
|
74
68
|
)
|
transcribe/views/mixins.py
CHANGED
transcribe/views/reports.py
CHANGED
|
@@ -262,25 +262,27 @@ def users_report(request):
|
|
|
262
262
|
datetime_end = make_aware(datetime_end)
|
|
263
263
|
|
|
264
264
|
# list of users
|
|
265
|
-
|
|
265
|
+
transcribe_users = TranscribeUser.objects.filter(
|
|
266
|
+
user__last_login__gte=datetime_start
|
|
267
|
+
)
|
|
266
268
|
# get stats for each user
|
|
267
|
-
for
|
|
268
|
-
|
|
269
|
+
for transcribe_user in transcribe_users:
|
|
270
|
+
transcribe_user._get_report_stats(datetime_start, datetime_end)
|
|
269
271
|
# remove users without any activity
|
|
270
272
|
active_users = []
|
|
271
|
-
for
|
|
273
|
+
for transcribe_user in transcribe_users:
|
|
272
274
|
if (
|
|
273
|
-
|
|
274
|
-
or
|
|
275
|
-
or
|
|
276
|
-
or
|
|
275
|
+
transcribe_user.num_finished_transcriptions > 0
|
|
276
|
+
or transcribe_user.num_finished_reviews > 0
|
|
277
|
+
or transcribe_user.num_skipped_transcriptions > 0
|
|
278
|
+
or transcribe_user.num_skipped_reviews > 0
|
|
277
279
|
):
|
|
278
|
-
active_users.append(
|
|
279
|
-
|
|
280
|
+
active_users.append(transcribe_user)
|
|
281
|
+
transcribe_users = []
|
|
280
282
|
data = {
|
|
281
283
|
'datetime_start': datetime_start,
|
|
282
284
|
'datetime_end': datetime_end,
|
|
283
|
-
'
|
|
285
|
+
'transcribe_users': active_users,
|
|
284
286
|
}
|
|
285
287
|
|
|
286
288
|
# download the report as a csv file
|
|
@@ -311,19 +313,23 @@ def users_report(request):
|
|
|
311
313
|
]
|
|
312
314
|
)
|
|
313
315
|
# stats for each user
|
|
314
|
-
for
|
|
316
|
+
for transcribe_user in active_users:
|
|
315
317
|
user_data = []
|
|
316
|
-
user_data.append(f'{user.last_name}, {user.first_name}')
|
|
317
|
-
user_data.append(f'{user}')
|
|
318
318
|
user_data.append(
|
|
319
|
-
f
|
|
319
|
+
f'{transcribe_user.user.last_name}, {transcribe_user.user.first_name}'
|
|
320
|
+
)
|
|
321
|
+
user_data.append(f'{transcribe_user}')
|
|
322
|
+
user_data.append(
|
|
323
|
+
f"{transcribe_user.user.last_login.strftime('%B %-d, %Y, %-I:%M %p')}"
|
|
324
|
+
)
|
|
325
|
+
user_data.append(f'{transcribe_user.num_finished_transcriptions}')
|
|
326
|
+
user_data.append(f'{transcribe_user.num_skipped_transcriptions}')
|
|
327
|
+
user_data.append(
|
|
328
|
+
f'{transcribe_user.num_in_progress_transcriptions}'
|
|
320
329
|
)
|
|
321
|
-
user_data.append(f'{
|
|
322
|
-
user_data.append(f'{
|
|
323
|
-
user_data.append(f'{
|
|
324
|
-
user_data.append(f'{user.num_finished_reviews}')
|
|
325
|
-
user_data.append(f'{user.num_skipped_reviews}')
|
|
326
|
-
user_data.append(f'{user.num_in_progress_reviews}')
|
|
330
|
+
user_data.append(f'{transcribe_user.num_finished_reviews}')
|
|
331
|
+
user_data.append(f'{transcribe_user.num_skipped_reviews}')
|
|
332
|
+
user_data.append(f'{transcribe_user.num_in_progress_reviews}')
|
|
327
333
|
writer.writerow(user_data)
|
|
328
334
|
# totals
|
|
329
335
|
writer.writerow(['', ''])
|
|
@@ -333,15 +339,21 @@ def users_report(request):
|
|
|
333
339
|
total_skipped_reviews = 0
|
|
334
340
|
total_in_progress_transcriptions = 0
|
|
335
341
|
total_in_progress_reviews = 0
|
|
336
|
-
for
|
|
337
|
-
total_finished_transcriptions +=
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
342
|
+
for transcribe_user in active_users:
|
|
343
|
+
total_finished_transcriptions += (
|
|
344
|
+
transcribe_user.num_finished_transcriptions
|
|
345
|
+
)
|
|
346
|
+
total_skipped_transcriptions += (
|
|
347
|
+
transcribe_user.num_skipped_transcriptions
|
|
348
|
+
)
|
|
349
|
+
total_finished_reviews += transcribe_user.num_finished_reviews
|
|
350
|
+
total_skipped_reviews += transcribe_user.num_skipped_reviews
|
|
341
351
|
total_in_progress_transcriptions += (
|
|
342
|
-
|
|
352
|
+
transcribe_user.num_in_progress_transcriptions
|
|
353
|
+
)
|
|
354
|
+
total_in_progress_reviews += (
|
|
355
|
+
transcribe_user.num_in_progress_reviews
|
|
343
356
|
)
|
|
344
|
-
total_in_progress_reviews += user.num_in_progress_reviews
|
|
345
357
|
writer.writerow(
|
|
346
358
|
[
|
|
347
359
|
'TOTALS',
|
transcribe/views/web.py
CHANGED
|
@@ -4,6 +4,7 @@ from django.contrib import messages
|
|
|
4
4
|
from django.contrib.auth.decorators import login_required
|
|
5
5
|
from django.db.models import Count, Q
|
|
6
6
|
from django.http import HttpResponse, JsonResponse
|
|
7
|
+
from django.http.response import Http404
|
|
7
8
|
from django.shortcuts import redirect, render
|
|
8
9
|
from django.views.generic import View
|
|
9
10
|
from django.views.generic.detail import DetailView
|
|
@@ -90,9 +91,11 @@ def display500(request):
|
|
|
90
91
|
class DashboardView(
|
|
91
92
|
mixins.ActiveUsersOnlyMixin, mixins.TranscribeUserContextMixin, View
|
|
92
93
|
):
|
|
93
|
-
def get(
|
|
94
|
+
def get( # noqa C901, TODO simplify this method
|
|
95
|
+
self, request, *args, **kwargs
|
|
96
|
+
):
|
|
97
|
+
all_tasks = kwargs.get('all_tasks', False)
|
|
94
98
|
context = super().get_context_data()
|
|
95
|
-
|
|
96
99
|
context['projects'] = []
|
|
97
100
|
user = context['transcribe_user']
|
|
98
101
|
|
|
@@ -105,7 +108,7 @@ class DashboardView(
|
|
|
105
108
|
# 'in progress' tasks for this user
|
|
106
109
|
user_tasks_in_progress = (
|
|
107
110
|
models.UserTask.objects.defer('transcription')
|
|
108
|
-
.filter(status='in progress',
|
|
111
|
+
.filter(status='in progress', user=user)
|
|
109
112
|
.select_related('task__project')
|
|
110
113
|
.all()
|
|
111
114
|
)
|
|
@@ -190,9 +193,12 @@ class ProjectClaimTaskView(mixins.ActiveUsersOnlyMixin, View):
|
|
|
190
193
|
Creates a UserTask for a given project and user, then redirects to the
|
|
191
194
|
UserTask page or the dashboard if something failed.
|
|
192
195
|
"""
|
|
196
|
+
if type not in {'transcription', 'review', 'any'}:
|
|
197
|
+
raise Http404
|
|
198
|
+
|
|
193
199
|
failed = False
|
|
194
200
|
user_task = None
|
|
195
|
-
user = models.TranscribeUser.objects.get(
|
|
201
|
+
user = models.TranscribeUser.objects.get(user=request.user)
|
|
196
202
|
|
|
197
203
|
try:
|
|
198
204
|
project = models.Project.objects.get(pk=pk)
|
|
@@ -264,6 +270,11 @@ class ProjectDownloadView(mixins.AdminUsersOnlyMixin, View):
|
|
|
264
270
|
elif type == 'html':
|
|
265
271
|
result = project.generate_html()
|
|
266
272
|
content_type = 'text/html'
|
|
273
|
+
else:
|
|
274
|
+
messages.add_message(
|
|
275
|
+
request, messages.ERROR, 'Invalid export type.'
|
|
276
|
+
)
|
|
277
|
+
return redirect('dashboard')
|
|
267
278
|
return HttpResponse(result, content_type=content_type)
|
|
268
279
|
|
|
269
280
|
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: django-transcribe
|
|
3
|
-
Version: 0.5.17
|
|
4
|
-
Summary: crowd source transcription
|
|
5
|
-
Home-page: https://gitlab.com/byuhbll/lib/python/django-transcribe
|
|
6
|
-
Author: BYU HBLL WebDev team
|
|
7
|
-
Author-email: support@lib.byu.edu
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Platform: UNKNOWN
|
|
10
|
-
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
12
|
-
Classifier: Operating System :: OS Independent
|
|
13
|
-
Classifier: Programming Language :: Python
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
15
|
-
License-File: LICENSE
|
|
16
|
-
License-File: AUTHORS
|
|
17
|
-
Requires-Dist: requests
|
|
18
|
-
Requires-Dist: django-model-utils
|
|
19
|
-
Requires-Dist: django-spurl
|
|
20
|
-
Requires-Dist: lxml (<=3.5.0)
|
|
21
|
-
Requires-Dist: Django (<2.3.0,>=2.2.0)
|
|
22
|
-
|
|
23
|
-
Crowd source the transcription of texts, audio, and video.
|
|
24
|
-
|
transcribe/templates/.DS_Store
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|