Loading sopds_web_backend/__pycache__/views.cpython-35.pyc +92 B (7.02 KiB) File changed.No diff preview for this file type. View original file View changed file sopds_web_backend/templates/sopds_footer.html +11 −11 Original line number Diff line number Diff line <div class="row expanded callout secondary" style="margin:0"> <div class="large-4 columns"> <div class="row expanded callout secondary" style="margin:0; padding-top:0"> <div class="large-4 columns" style="margin-top:1rem;"> <h5><a href="{% url "web:searchbooks" %}?searchtype=u">BOOKSHELF</a></h5> <div class="row small-up-4"> {% for b in bookshelf %} Loading @@ -12,7 +12,7 @@ {% endfor %} </div> </div> <div class="large-4 columns"> <div class="large-4 columns" style="margin-top:1rem;"> <h5>NEWS</h5> <span class="secondary label">Space</span> <span class="secondary label">Galaxies</span> Loading @@ -23,11 +23,11 @@ <span class="secondary label">Republic</span> <span class="secondary label">R2D2</span> </div> <div class="large-4 columns"> <div class="large-12 columns extended"> <div class="large-4 columns" style="padding:0; margin-top:1rem;"> <div class="large-12 columns"> <h5>RANDOM BOOK</h5> </div> <div class="large-12 columns extended clearfix"> <div class="large-12 columns clearfix"> <img class="float-left" src="{% url 'opds_catalog:cover' random_book.id %}" type="image/jpeg" width="80px" style="padding:0.3rem;"> <p style="font-size:80%;line-height:1rem;margin-bottom:0.25rem; margin-top:0.25rem;"><b> <a href="{% url "web:searchbooks" %}?searchtype=i&searchterms={{random_book.id}}">{{ random_book.title }}</a> </b></p> <div style="font-size:70%;text-align:justify;"> {{ random_book.annotation | truncatechars:400}} </div> Loading @@ -35,16 +35,16 @@ </div> </div> <div class="row sopdsmenu" style="margin:0"> <div class="large-12 columns sopdsmenu" style="margin:0;padding:0;"> <div class="medium-6 columns"> <ul class="menu"> <li class="menu-text"><a href="https://github.com/mitshel/sopds"><i class="fi-social-github"></i>GitHub</a></li> <li class="menu-text"><a href="#" onclick="window.print()"><i class="fi-social-facebook"></i>Facebook</a></li> <ul class="menu show-for-medium"> <li class="menu-text" style="padding:0"><a href="https://github.com/mitshel/sopds"><i class="fi-social-github"></i>GitHub</a></li> <li class="menu-text" style="padding:0"><a href="#" onclick="window.print()"><i class="fi-social-facebook"></i>Facebook</a></li> </ul> </div> <div class="medium-6 columns"> <ul class="menu align-right"> <li class="menu-text"><a href="http://www.sopds.ru/">SOPDS.RU v.{{ sopds_version }}</a></li> <li class="menu-text" style="padding:0"><a href="http://www.sopds.ru/">SOPDS.RU v.{{ sopds_version }}</a></li> </ul> </div> </div> sopds_web_backend/templates/sopds_logo.html +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ <div class="row"> <fieldset class="large-12 columns"> <legend>Choose Search Type:</legend> <input type="radio" name="searchtype" value="m" id="title" onClick="SetSearch()" {% if searchobject == "title" %}checked{%endif%}> <label for="title">Title</label> <input type="radio" name="searchtype" value="m" id="title" onClick="SetSearch()" {% if searchobject == "title" or not searchobject %}checked{%endif%}> <label for="title">Title</label> <input type="radio" name="searchtype" value="m" id="author" onClick="SetSearch()" {% if searchobject == "author" %}checked{%endif%}><label for="author">Author</label> <input type="radio" name="searchtype" value="m" id="series" onClick="SetSearch()" {% if searchobject == "series" %}checked{%endif%}><label for="series">Series</label> </fieldset> Loading sopds_web_backend/views.py +11 −9 Original line number Diff line number Diff line Loading @@ -16,11 +16,10 @@ def sopds_processor(request): user=request.user if user.is_authenticated(): result=[] for i,row in enumerate(bookshelf.objects.filter(user=user).order_by('-readtime')): for i,row in enumerate(bookshelf.objects.filter(user=user).order_by('-readtime')[:8]): book = Book.objects.get(id=row.book_id) p = {'id':row.id, 'readtime': row.readtime, 'book_id': row.book_id, 'title': book.title, 'authors':book.authors.values()} result.append(p) if (i>=7): break; args['bookshelf']=result random_book = Book.objects.all().order_by('?')[:1].get() Loading @@ -45,32 +44,35 @@ def SearchBooksView(request): return render_to_response('sopds_error.html', args) if searchtype == 'm': books = Book.objects.extra(where=["upper(title) like %s"], params=["%%%s%%"%searchterms.upper()]) books = Book.objects.extra(where=["upper(title) like %s"], params=["%%%s%%"%searchterms.upper()]).order_by('title','authors','-docdate') elif searchtype == 'a': try: author_id = int(searchterms) except: author_id = 0 books = Book.objects.filter(authors=author_id) books = Book.objects.filter(authors=author_id).order_by('title','authors','-docdate') # Поиск книг по серии elif searchtype == 's': try: ser_id = int(searchterms) except: ser_id = 0 books = Book.objects.filter(series=ser_id) books = Book.objects.filter(series=ser_id).order_by('title','authors','-docdate') # Поиск книг на книжной полке elif searchtype == 'u': if AUTH: books = Book.objects.filter(bookshelf__user=request.user) books = Book.objects.filter(bookshelf__user=request.user).order_by('-bookshelf__readtime') #books = bookshelf.objects.filter(user=request.user).select_related('book') else: books={} print(books.query) # Поиск дубликатов для книги elif searchtype == 'd': #try: book_id = int(searchterms) mbook = Book.objects.get(id=book_id) books = Book.objects.filter(title__iexact=mbook.title, authors__in=mbook.authors.all()).exclude(id=book_id) books = Book.objects.filter(title__iexact=mbook.title, authors__in=mbook.authors.all()).exclude(id=book_id).order_by('-docdate') elif searchtype == 'i': try: book_id = int(searchterms) Loading @@ -79,7 +81,7 @@ def SearchBooksView(request): books = Book.objects.filter(id=book_id) if len(books)>0: books = books.prefetch_related('authors','genres','series').order_by('title','authors','-docdate') books = books.prefetch_related('authors','genres','series') # Фильтруем дубликаты result = [] Loading Loading
sopds_web_backend/__pycache__/views.cpython-35.pyc +92 B (7.02 KiB) File changed.No diff preview for this file type. View original file View changed file
sopds_web_backend/templates/sopds_footer.html +11 −11 Original line number Diff line number Diff line <div class="row expanded callout secondary" style="margin:0"> <div class="large-4 columns"> <div class="row expanded callout secondary" style="margin:0; padding-top:0"> <div class="large-4 columns" style="margin-top:1rem;"> <h5><a href="{% url "web:searchbooks" %}?searchtype=u">BOOKSHELF</a></h5> <div class="row small-up-4"> {% for b in bookshelf %} Loading @@ -12,7 +12,7 @@ {% endfor %} </div> </div> <div class="large-4 columns"> <div class="large-4 columns" style="margin-top:1rem;"> <h5>NEWS</h5> <span class="secondary label">Space</span> <span class="secondary label">Galaxies</span> Loading @@ -23,11 +23,11 @@ <span class="secondary label">Republic</span> <span class="secondary label">R2D2</span> </div> <div class="large-4 columns"> <div class="large-12 columns extended"> <div class="large-4 columns" style="padding:0; margin-top:1rem;"> <div class="large-12 columns"> <h5>RANDOM BOOK</h5> </div> <div class="large-12 columns extended clearfix"> <div class="large-12 columns clearfix"> <img class="float-left" src="{% url 'opds_catalog:cover' random_book.id %}" type="image/jpeg" width="80px" style="padding:0.3rem;"> <p style="font-size:80%;line-height:1rem;margin-bottom:0.25rem; margin-top:0.25rem;"><b> <a href="{% url "web:searchbooks" %}?searchtype=i&searchterms={{random_book.id}}">{{ random_book.title }}</a> </b></p> <div style="font-size:70%;text-align:justify;"> {{ random_book.annotation | truncatechars:400}} </div> Loading @@ -35,16 +35,16 @@ </div> </div> <div class="row sopdsmenu" style="margin:0"> <div class="large-12 columns sopdsmenu" style="margin:0;padding:0;"> <div class="medium-6 columns"> <ul class="menu"> <li class="menu-text"><a href="https://github.com/mitshel/sopds"><i class="fi-social-github"></i>GitHub</a></li> <li class="menu-text"><a href="#" onclick="window.print()"><i class="fi-social-facebook"></i>Facebook</a></li> <ul class="menu show-for-medium"> <li class="menu-text" style="padding:0"><a href="https://github.com/mitshel/sopds"><i class="fi-social-github"></i>GitHub</a></li> <li class="menu-text" style="padding:0"><a href="#" onclick="window.print()"><i class="fi-social-facebook"></i>Facebook</a></li> </ul> </div> <div class="medium-6 columns"> <ul class="menu align-right"> <li class="menu-text"><a href="http://www.sopds.ru/">SOPDS.RU v.{{ sopds_version }}</a></li> <li class="menu-text" style="padding:0"><a href="http://www.sopds.ru/">SOPDS.RU v.{{ sopds_version }}</a></li> </ul> </div> </div>
sopds_web_backend/templates/sopds_logo.html +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ <div class="row"> <fieldset class="large-12 columns"> <legend>Choose Search Type:</legend> <input type="radio" name="searchtype" value="m" id="title" onClick="SetSearch()" {% if searchobject == "title" %}checked{%endif%}> <label for="title">Title</label> <input type="radio" name="searchtype" value="m" id="title" onClick="SetSearch()" {% if searchobject == "title" or not searchobject %}checked{%endif%}> <label for="title">Title</label> <input type="radio" name="searchtype" value="m" id="author" onClick="SetSearch()" {% if searchobject == "author" %}checked{%endif%}><label for="author">Author</label> <input type="radio" name="searchtype" value="m" id="series" onClick="SetSearch()" {% if searchobject == "series" %}checked{%endif%}><label for="series">Series</label> </fieldset> Loading
sopds_web_backend/views.py +11 −9 Original line number Diff line number Diff line Loading @@ -16,11 +16,10 @@ def sopds_processor(request): user=request.user if user.is_authenticated(): result=[] for i,row in enumerate(bookshelf.objects.filter(user=user).order_by('-readtime')): for i,row in enumerate(bookshelf.objects.filter(user=user).order_by('-readtime')[:8]): book = Book.objects.get(id=row.book_id) p = {'id':row.id, 'readtime': row.readtime, 'book_id': row.book_id, 'title': book.title, 'authors':book.authors.values()} result.append(p) if (i>=7): break; args['bookshelf']=result random_book = Book.objects.all().order_by('?')[:1].get() Loading @@ -45,32 +44,35 @@ def SearchBooksView(request): return render_to_response('sopds_error.html', args) if searchtype == 'm': books = Book.objects.extra(where=["upper(title) like %s"], params=["%%%s%%"%searchterms.upper()]) books = Book.objects.extra(where=["upper(title) like %s"], params=["%%%s%%"%searchterms.upper()]).order_by('title','authors','-docdate') elif searchtype == 'a': try: author_id = int(searchterms) except: author_id = 0 books = Book.objects.filter(authors=author_id) books = Book.objects.filter(authors=author_id).order_by('title','authors','-docdate') # Поиск книг по серии elif searchtype == 's': try: ser_id = int(searchterms) except: ser_id = 0 books = Book.objects.filter(series=ser_id) books = Book.objects.filter(series=ser_id).order_by('title','authors','-docdate') # Поиск книг на книжной полке elif searchtype == 'u': if AUTH: books = Book.objects.filter(bookshelf__user=request.user) books = Book.objects.filter(bookshelf__user=request.user).order_by('-bookshelf__readtime') #books = bookshelf.objects.filter(user=request.user).select_related('book') else: books={} print(books.query) # Поиск дубликатов для книги elif searchtype == 'd': #try: book_id = int(searchterms) mbook = Book.objects.get(id=book_id) books = Book.objects.filter(title__iexact=mbook.title, authors__in=mbook.authors.all()).exclude(id=book_id) books = Book.objects.filter(title__iexact=mbook.title, authors__in=mbook.authors.all()).exclude(id=book_id).order_by('-docdate') elif searchtype == 'i': try: book_id = int(searchterms) Loading @@ -79,7 +81,7 @@ def SearchBooksView(request): books = Book.objects.filter(id=book_id) if len(books)>0: books = books.prefetch_related('authors','genres','series').order_by('title','authors','-docdate') books = books.prefetch_related('authors','genres','series') # Фильтруем дубликаты result = [] Loading