Ejemplo n.º 1
0
def search_wishlist(title):
    titles = []
    theme = Colors.query.filter_by(selected=True).first()
    titles.append(title.lower())
    comics = ComicData(wishlist=True)
    comics = comics.parse_data(wishlist=True)

    advanced_form = AdvancedForm1()
    search_form = SearchForm()
    if request.method == 'POST':
        if search_form.submit1.data and search_form.validate_on_submit:
            return redirect(
                url_for('search_wishlist', title=search_form.search_text.data))

        elif advanced_form.submit2.data and advanced_form.validate_on_submit:
            return redirect(
                url_for('advanced_search_wishlist',
                        title=advanced_form.search_text.data,
                        start_date=advanced_form.beginning_time.data,
                        end_date=advanced_form.ending_time.data))

    return render_template('home.html',
                           theme=theme,
                           search_form=search_form,
                           advanced_form=advanced_form,
                           comics=comics,
                           titles=titles,
                           year_options=generate_date_options(
                               retrieve_oldest_comic_date(comics)))
Ejemplo n.º 2
0
def find_collection():
    theme = Colors.query.filter_by(selected=True).first()
    comics = ComicData(wishlist=False)
    comics = comics.parse_data(wishlist=False)
    advanced_form = AdvancedForm2()
    search_form = SearchForm()
    if request.method == 'POST':
        if search_form.submit1.data and search_form.validate_on_submit:
            return redirect(
                url_for('search_collection',
                        title=search_form.search_text.data))

        elif advanced_form.submit3.data and advanced_form.validate_on_submit:
            return redirect(
                url_for('advanced_search_collection',
                        title=advanced_form.search_text.data,
                        start_date=advanced_form.beginning_time.data,
                        end_date=advanced_form.ending_time.data,
                        graded=advanced_form.graded.data))
    return render_template('collection.html',
                           theme=theme,
                           search_form=search_form,
                           advanced_form=advanced_form,
                           comics=comics,
                           year_options=generate_date_options(
                               retrieve_oldest_comic_date(comics)))
Ejemplo n.º 3
0
def advanced_search_collection(title, start_date, end_date, graded):
    theme = Colors.query.filter_by(selected=True).first()

    query = f'''
            select p.PublisherName, c.title, c.covertitleid, c.description, i.issuenumber, i.issueid,
             i.coverdate, i.covervariantdescription, u.cgccolor, u.cgcscore, u.cgccomments from Issue i
            join UserIssue u on u.issueid = i.issueid
            Join CoverTitle c on i.covertitleid = c.covertitleid
            join Publisher p on p.publisherid = c.publisherid
            where coverdate between '{start_date}-01-01' and '{end_date}-12-31'
            and title like '%{title}%'
            Order by PublisherName, title, issuenumber'''

    term = [title.lower()]
    results = ComicData(wishlist=False, query=query)
    results = results.parse_data(wishlist=False)

    comics = ComicData(wishlist=False, query=None)
    comics = comics.parse_data(wishlist=False)

    advanced_form = AdvancedForm2()
    search_form = SearchForm()
    if request.method == 'POST':
        if search_form.submit1.data and search_form.validate_on_submit:
            return redirect(
                url_for('search_collection',
                        title=search_form.search_text.data))

        elif advanced_form.submit3.data and advanced_form.validate_on_submit:
            return redirect(
                url_for('advanced_search_collection',
                        title=advanced_form.search_text.data,
                        start_date=advanced_form.beginning_time.data,
                        end_date=advanced_form.ending_time.data,
                        graded=advanced_form.graded.data))
    return render_template('collection.html',
                           theme=theme,
                           search_form=search_form,
                           advanced_form=advanced_form,
                           comics=comics,
                           start_date=start_date,
                           end_date=end_date,
                           graded=graded,
                           results=results,
                           term=term,
                           year_options=generate_date_options(
                               retrieve_oldest_comic_date(comics)))
Ejemplo n.º 4
0
def find_one_collection(publisher):
    theme = Colors.query.filter_by(selected=True).first()
    publisher = publisher.replace('%20', ' ')
    query = f'''
               select p.PublisherName, c.title, c.covertitleid, c.description, i.issuenumber, i.issueid,
                i.coverdate, i.covervariantdescription, u.cgccolor, u.cgcscore, u.cgccomments from Issue i
               join UserIssue u on u.issueid = i.issueid
               Join CoverTitle c on i.covertitleid = c.covertitleid
               join Publisher p on p.publisherid = c.publisherid
               where publishername is '{publisher}'
               Order by PublisherName, title, issuenumber'''

    comics = ComicData(wishlist=False, query=query)
    comics = comics.parse_data(wishlist=False)
    advanced_form = AdvancedForm2()
    search_form = SearchForm()
    if request.method == 'POST':
        if search_form.submit1.data and search_form.validate_on_submit:
            return redirect(
                url_for('search_collection',
                        title=search_form.search_text.data))

        elif advanced_form.submit3.data and advanced_form.validate_on_submit:
            return redirect(
                url_for('advanced_search_collection',
                        title=advanced_form.search_text.data,
                        start_date=advanced_form.beginning_time.data,
                        end_date=advanced_form.ending_time.data,
                        graded=advanced_form.graded.data))
    return render_template('find_one_collection.html',
                           publisher=publisher,
                           theme=theme,
                           search_form=search_form,
                           advanced_form=advanced_form,
                           comics=comics,
                           year_options=generate_date_options(
                               retrieve_oldest_comic_date(comics)))