X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/3e569a771ed8cb9ab7156425ff870dc9d33ef023..63519710f7ae064e26d3ee068d59201e8bc02cf3:/apps/catalogue/views.py?ds=sidebyside diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index ef8d83a5..8a96dc68 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -58,10 +58,12 @@ def user(request, username): @active_tab('my') @never_cache def my(request): + last_books = sorted(request.session.get("wiki_last_books", {}).items(), + key=lambda x: x[1]['time'], reverse=True) + for k, v in last_books: + v['time'] = datetime.fromtimestamp(v['time']) return render(request, 'catalogue/my_page.html', { - 'last_books': sorted(request.session.get("wiki_last_books", {}).items(), - key=lambda x: x[1]['time'], reverse=True), - + 'last_books': last_books, "logout_to": '/', }) @@ -142,7 +144,7 @@ def upload(request): if request.method == "POST": form = forms.DocumentsUploadForm(request.POST, request.FILES) if form.is_valid(): - from fnpdjango.utils.text.slughifi import slughifi + from slugify import slugify if request.user.is_authenticated(): creator = request.user @@ -159,7 +161,7 @@ def upload(request): if filename[-1] == '/': continue title = os.path.basename(filename)[:-4] - slug = slughifi(title) + slug = slugify(title) if not (slug and filename.endswith('.xml')): skipped_list.append(filename) elif slug in slugs: