+
+
+# =========
+# = Admin =
+# =========
+@login_required
+@staff_required
+def import_book(request):
+ """docstring for import_book"""
+ book_import_form = forms.BookImportForm(request.POST, request.FILES)
+ if book_import_form.is_valid():
+ try:
+ book_import_form.save()
+ except:
+ info = sys.exc_info()
+ exception = pprint.pformat(info[1])
+ tb = '\n'.join(traceback.format_tb(info[2]))
+ return HttpResponse(_("An error occurred: %s\n\n%s") % (exception, tb), mimetype='text/plain')
+ return HttpResponse(_("Book imported successfully"))
+ else:
+ return HttpResponse(_("Error importing file: %r") % book_import_form.errors)
+
+
+
+def clock(request):
+ """ Provides server time for jquery.countdown,
+ in a format suitable for Date.parse()
+ """
+ from datetime import datetime
+ return HttpResponse(datetime.now().strftime('%Y/%m/%d %H:%M:%S'))
\ No newline at end of file