django-transcribe 0.7.0__py3-none-any.whl → 0.7.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-transcribe
3
- Version: 0.7.0
3
+ Version: 0.7.1
4
4
  Summary: crowd source transcription
5
5
  Home-page: https://gitlab.com/byuhbll/lib/python/django-transcribe
6
6
  Author: BYU Library Software Engineering
@@ -1,4 +1,4 @@
1
- transcribe/__init__.py,sha256=bEBoHMQqYV-w9gc5bwGNT0UXJvGeZxeijjOPyN1p-QI,78
1
+ transcribe/__init__.py,sha256=WYosA-Pf6uytFfAdwJzG8DXM_qOmYzj1ORX25HtLENM,78
2
2
  transcribe/admin.py,sha256=HwrJafMjSoIKgb_En0zNvZ3nk5rCZWtJ5n0DdGU9nfI,6512
3
3
  transcribe/api.py,sha256=2m_y44ilQh87CWksHHqiE4A14javR8omlXEXm65lmC4,74
4
4
  transcribe/apps.py,sha256=XUdPQkCjpqWAKDCIaE6Mh8Q4xN5upKv95MG1u2_5pig,246
@@ -6,7 +6,7 @@ transcribe/diff_match_patch.py,sha256=HZC5DNab5OVwbB4Zc7G17l1OHbBlH2g9-xOtT1zkQ1
6
6
  transcribe/filters.py,sha256=_ANh6XGDXgmD_wxQo5IPReQsv3_MDqThOwB06LKfbac,1264
7
7
  transcribe/forms.py,sha256=6j-MtheDtDeBo9B_hlKhkWkWkKVJsLrJIlSsZAlB7ic,5612
8
8
  transcribe/middleware.py,sha256=3SvvNmJMlVohD_4Liv1yT3hc_nudpvt2giAE7Wt9rx4,485
9
- transcribe/models.py,sha256=g0_rtkLKbrkwxbWQbfZ3q5rnug235aEzFCI5DAUrcI4,38965
9
+ transcribe/models.py,sha256=mcAs_mwX2ROgB5OjlY2ceu_yL34nr4K5wiRrPz3XCf8,38870
10
10
  transcribe/settings.py,sha256=TNRFJstZF9X3l5qZSzv3xcrEuPMmOQbB-59mqADn9Dk,569
11
11
  transcribe/signals.py,sha256=pvRSWobg__Jw5ZvlFBZZAw3rDk1dvVyiq8Ka2lBGeSY,1105
12
12
  transcribe/urls.py,sha256=xgTkOdeC1cWmQAMzAp-VRwvmwyEAfEabncGgHyZiAL0,2040
@@ -142,10 +142,10 @@ transcribe/templates/transcribe/xsl/tei-html.xsl,sha256=oOVnAZhDVDVzrQR5UEbNV-97
142
142
  transcribe/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
143
143
  transcribe/views/mixins.py,sha256=QmFDhWb5VCEaGatLdbsTK72jiBG2OKrlncnz79FUmto,2727
144
144
  transcribe/views/reports.py,sha256=7YD5E6CPsIfWP8hG8IFTek29cM2T29NHuowAdlTAyBs,13408
145
- transcribe/views/web.py,sha256=sU5FNh0jl1yKSRZFo5CvdD5CVV9sb9vtUNdLRZuzAQg,15213
146
- django_transcribe-0.7.0.dist-info/AUTHORS,sha256=rNmFConshTlNpyhcu4CKZSeQQMwuyVYXbeqXgRko-Yc,640
147
- django_transcribe-0.7.0.dist-info/LICENSE,sha256=I9xp13yeayqZikrv7rQrzsDWviTwy1R0phFlKtM1meg,1472
148
- django_transcribe-0.7.0.dist-info/METADATA,sha256=85LOoJ3YJ-ewMWcOcv8M3qR5cWI2pzw22kJf8EdHio0,1021
149
- django_transcribe-0.7.0.dist-info/WHEEL,sha256=uCRv0ZEik_232NlR4YDw4Pv3Ajt5bKvMH13NUU7hFuI,91
150
- django_transcribe-0.7.0.dist-info/top_level.txt,sha256=NljSay7zO6czcjqjVmivw6VW58aXlYHVZQvnwmpy08g,11
151
- django_transcribe-0.7.0.dist-info/RECORD,,
145
+ transcribe/views/web.py,sha256=WoVs-iwYc2hesuBxCmwfo-wza15C1fiMRY6S0TAdxQs,15213
146
+ django_transcribe-0.7.1.dist-info/AUTHORS,sha256=rNmFConshTlNpyhcu4CKZSeQQMwuyVYXbeqXgRko-Yc,640
147
+ django_transcribe-0.7.1.dist-info/LICENSE,sha256=I9xp13yeayqZikrv7rQrzsDWviTwy1R0phFlKtM1meg,1472
148
+ django_transcribe-0.7.1.dist-info/METADATA,sha256=kJaWnePuAJ0UvPfFaqmjN0-jjv5RVVW36tcjWHTd2WM,1021
149
+ django_transcribe-0.7.1.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
150
+ django_transcribe-0.7.1.dist-info/top_level.txt,sha256=NljSay7zO6czcjqjVmivw6VW58aXlYHVZQvnwmpy08g,11
151
+ django_transcribe-0.7.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.1)
2
+ Generator: setuptools (74.1.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
transcribe/__init__.py CHANGED
@@ -1,2 +1,2 @@
1
1
  default_app_config = 'transcribe.apps.transcribeConfig'
2
- __version__ = '0.7.0'
2
+ __version__ = '0.7.1'
transcribe/models.py CHANGED
@@ -1,17 +1,19 @@
1
1
  """Models for transcribe."""
2
2
  import logging
3
3
  import re
4
- from datetime import datetime, timedelta
4
+ from datetime import timedelta
5
5
  from os import path
6
6
 
7
7
  from django.contrib.auth import get_user_model
8
8
  from django.db import models
9
9
  from django.db.models import Count, Q
10
10
  from django.urls import reverse
11
+ from django.utils import timezone
11
12
  from django.utils.functional import cached_property
12
13
  from django.utils.html import format_html, strip_tags
13
14
  from model_utils import Choices
14
15
  from model_utils.models import TimeStampedModel
16
+
15
17
  from transcribe import settings
16
18
  from transcribe.diff_match_patch import diff_match_patch
17
19
  from transcribe.utils import html_diffs, remove_markup
@@ -408,8 +410,7 @@ class Project(TimeStampedModel):
408
410
 
409
411
  @cached_property
410
412
  def percent_done(self):
411
- """Returns an integer indicating the percent complete for the project.
412
- """
413
+ """Returns an integer indicating the percent complete for the project."""
413
414
  counts = Task.objects.filter(project_id=self.pk).aggregate(
414
415
  total_tasks=Count('id'),
415
416
  finished_review_tasks=Count('id', filter=Q(finished_review=1)),
@@ -487,9 +488,7 @@ class Project(TimeStampedModel):
487
488
  # exclude tasks that:
488
489
  # - have enough user tasks in progress AND
489
490
  # - those user tasks are not too old (expired)
490
- expired_dt = (
491
- datetime.today() - timedelta(days=settings.TASK_EXPIRE_DAYS)
492
- ).strftime('%Y-%m-%d %H:%M:%S')
491
+ expired_dt = timezone.now() - timedelta(days=settings.TASK_EXPIRE_DAYS)
493
492
  task_ids_to_exclude.update(
494
493
  self.tasks.defer('transcription')
495
494
  .filter(
@@ -557,9 +556,7 @@ class Project(TimeStampedModel):
557
556
  ).values_list('id', flat=True)
558
557
 
559
558
  # in progress tasks that are recent
560
- expired_dt = (
561
- datetime.today() - timedelta(days=settings.TASK_EXPIRE_DAYS)
562
- ).strftime('%Y-%m-%d %H:%M:%S')
559
+ expired_dt = timezone.now() - timedelta(days=settings.TASK_EXPIRE_DAYS)
563
560
  task_ids_already_being_reviewed = self.tasks.filter(
564
561
  usertasks__status='in progress',
565
562
  usertasks__task_type='review',
@@ -698,9 +695,10 @@ class Project(TimeStampedModel):
698
695
 
699
696
  def generate_html(self):
700
697
  """Generates and returns an HTML representation of the project."""
701
- from lxml import etree
702
698
  import tempfile
703
699
 
700
+ from lxml import etree
701
+
704
702
  xml = self.generate_xml()
705
703
  html = ''
706
704
  temp = tempfile.NamedTemporaryFile(mode='w+t', delete=False)
transcribe/views/web.py CHANGED
@@ -10,6 +10,7 @@ from django.views.generic import View
10
10
  from django.views.generic.detail import DetailView
11
11
  from django.views.generic.edit import UpdateView
12
12
  from django.views.generic.list import ListView
13
+
13
14
  from transcribe import models, settings
14
15
  from transcribe.views import mixins
15
16
 
@@ -19,7 +20,7 @@ log = logging.getLogger(__name__)
19
20
  def get_project_with_tasks(project, user):
20
21
  """Return project with transcription and review tasks attached."""
21
22
  if not isinstance(user, models.TranscribeUser):
22
- user = models.TranscribeUser.objects.get(pk=user.pk)
23
+ user = models.TranscribeUser.objects.get(user=user)
23
24
  project.pending_trans_task = project.pending_transcription_task(user)
24
25
  project.avail_trans_task = False
25
26
  if not project.pending_trans_task: