From f681c4f5213801f73ad91853f302cdbfd975a519 Mon Sep 17 00:00:00 2001 From: Tayeeb Islam <islamt4@cardiff.ac.uk> Date: Wed, 12 May 2021 21:50:21 +0100 Subject: [PATCH] Commit 4 --- shop/__init__.py | 3 - shop/__pycache__/__init__.cpython-36.pyc | Bin 868 -> 868 bytes shop/__pycache__/forms.cpython-36.pyc | Bin 2975 -> 2880 bytes shop/__pycache__/models.cpython-36.pyc | Bin 2373 -> 2375 bytes shop/__pycache__/routes.cpython-36.pyc | Bin 5960 -> 5970 bytes shop/__pycache__/views.cpython-36.pyc | Bin 673 -> 688 bytes shop/forms.py | 27 ++++----- shop/models.py | 3 +- shop/routes.py | 68 +++++++++++------------ shop/static/style.css | 4 +- shop/templates/about.html | 2 +- shop/templates/cart.html | 38 ------------- shop/templates/home.html | 34 +++++++++++- shop/templates/item.html | 6 +- shop/templates/layout.html | 14 ++--- shop/templates/login.html | 2 +- shop/templates/thankyou.html | 2 +- shop/views.py | 2 +- 18 files changed, 95 insertions(+), 110 deletions(-) delete mode 100644 shop/templates/cart.html diff --git a/shop/__init__.py b/shop/__init__.py index a589609..8a7e0ce 100644 --- a/shop/__init__.py +++ b/shop/__init__.py @@ -6,9 +6,6 @@ from flask_login import LoginManager app = Flask(__name__) app.config['SECRET_KEY'] = 'edd9229339e5754427a7792fc79b51318395e93569165fa4' -# Note: type 'app.config[..]' as one line, it is split into -# multiple lines in this document to fit on the page -# {USERNAME} and {YOUR_DATABASE} are your Cardiff username app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://c2003538:Newport123@csmysql.cs.cf.ac.uk:3306/c2003538_Online_Shop' db = SQLAlchemy(app) login_manager = LoginManager() diff --git a/shop/__pycache__/__init__.cpython-36.pyc b/shop/__pycache__/__init__.cpython-36.pyc index 7ac21e429f8d4ff6a5fbc6f32999dfad242e3cc5..b5e484a9e9eaf26247ba2fccb0bffdd504c6ed1d 100644 GIT binary patch delta 175 zcmaFD_Jobgn3tDJ&TB@(A*PL7c8rX-CVMj8V7xV1iOG)f*5pJc`TAQNnR%Hd@reZm zw^)iZ@(YUC7#J9$xYKeHi?ibsQ*tx&ir7ISTp&rkvdq--;vx=^05@15H$Npcr?`ld zfq|ij3na`6))U2%n356?QhkfPIJLMqGe2)7Ly-tb6^Qs{<7^cZTAW%`Jo!IU03+k% H0A>*Y1J*Vq delta 175 zcmaFD_Jobgn3tDpvGU}ELgtNJc8rWslRX)4Fh)&QVzOh5nw-caUmwMhnU`4-pIA_E zi={Xtzo3Yffq@~4J1r-%I6FQuB{ws#hz%sd1(MV&%S<gVE@B4>aDxSM^HWlDii<cH z7#NB;LBgzHJy9HqDJk(F)luxlsl~;a`FSfDiuggQK*TQ_XRDad;?$zz$^V%G7+EF< HFpB^H&(JfW diff --git a/shop/__pycache__/forms.cpython-36.pyc b/shop/__pycache__/forms.cpython-36.pyc index f528a15e149e1029f9899d252b1531fbc35bbb5b..1e65f1827fd0bc722984333f05e736f8d51d84a2 100644 GIT binary patch delta 476 zcmbO)en5=Nn3tEU&}&A*8P1Jd_RNefn**6c85tcmuVcwznw-bTS#Q9=z>vxi#hAhn z#gxL8!kxmC!kfaE!k^9-#hl8L!j{UM!rsdi#hS{N!qLna#h$_$%%CZ7iz_%au_!si zEx#!D7IQ#q-YvF()V$=(oLg)`rAbMtMYotkgPm@1IVa{Mm*ymv<QG-(Ky)Z%mZaud zX)@koPtM5COrCs}-9kf;fq|h2L})S<f!qToG&zb?LE>s4LLEdHP7dU7<P>1!VJy;S zU|^V>$S5{>BgZQBDlWIoqT&(-zr@_sDw%+s)WqUch19%~)FOq-{L&%?sO;oAPKA&v zPM<`WQfW-3aLFik$CQ+!)Z*eQNlaBxsax#MiA5>#ev`j(8ZbMDIZxK)^0we~%PcM` z0XZd#17sSQ#pVb$tB3{U4Kom70U}r#7#O11f=iQfGfO6aU=@`%Wnf?cd9|2_fq{X8 cQHD{5Q3y;HnNGgN)x&5y`7NvX<T`Fe09EORE&u=k delta 535 zcmX>gHeZ~}n3tEUmuF%^2-ij~du9%A{|tq^d_{%LUd*A49PTjQ0+tM>dM*YA1_uTP zhGH`Y28L9ID8>|qD5ey?6#f)}6u}gs6yX$+6wws1bj~Q|RF)L3ROS@!UZyD4RJIhJ zX2vM?6y9J4P4Qb?!KsNw$r*0>MY*?Fg7S+~Z?X7f=2YHdbxF)DuDrz=T$-1blV6@% zbc@qDu_!OGBr`wn7Q0(fs$ObwX5uY&uf*cq%)HcFtO2R{d6l;~9di?lDsyr&i>vq` zCM!U+Pi|v(@-bjwU?>6+noLE8AU255WGXTOu|b3;Q;{)<4I(s|icCOk5TVIYqzYoI zfe3XFVLJH(yCbI<BM)PdHUk60<U~fX$pIXz*rGVx@{3X@%Q8u@rsWr<=1o@QREUUT z4=ydrOUzBJk_^a6O)O4TNX;urEmEk=FD+6ihDb%RJEo)*r4|=gDPpQg%FM~h%u82D zgebYio}5^e5}!ADDyIQ+a#`}^6P(`a9ANtrb5o<(p+??fhpI1P0Xf+UMA%F|$fhJ~ q$-uw>@<uTq0|NsGqYR@ABMT!Rm@cxMT+P+PXgT>ltN3JjZbbkHkdyZS diff --git a/shop/__pycache__/models.cpython-36.pyc b/shop/__pycache__/models.cpython-36.pyc index 4dbdbba77a5dc13fec52702b0780c3e813ce53fb..4150373573d57f39b6e8e230f096525334e6822c 100644 GIT binary patch delta 108 zcmX>qbX<tbn3tF9{j#YEyV*8!RWmX&Z*F7MWn|==yoG5CJEIt*7;_QF<c;i-n>(1( z7#Srezh{}nC^NZ>wTe+;GAmm)qw?fJw&je1lO@@^8Pz5)WzS(_b4o1EPMs{uQNgG+ OxsPKLE4PR!9}579_#H+7 delta 106 zcmX>ubX17Tn3tD}L3wh55c@{1YDPx(&25ajjEww~w=ivCXA)x+V=m&DypdgUa|d%8 zBcs&h_bjs*WhZyBRxv70W@XD}RGD1JwwzIDvLt&qqx$5f>^Uqf&WS~n#W^Y%wI@&D M*u=^sBFe`C0D~ABXaE2J diff --git a/shop/__pycache__/routes.cpython-36.pyc b/shop/__pycache__/routes.cpython-36.pyc index 4247e39a88d7ca520d3d5e2aec2a0f63464ddec1..9de1141d2e720f51a4efea0aba1e63abc1b57ecd 100644 GIT binary patch delta 459 zcmX@1cS(=an3tF9m)DGh@Qs{>ER39!t6924#26SDikTP~7#Ns})EO8Us#x?LC(E&R zNH9AVCrcwqYJntK^<5^PV4cRs;*wgNEI&DuZ4IOHW-<2JjEowSH*u7)u_YxIXQxiq z;Vj@c1L@@g8_dSY!MJ%fXDAcDjDBKDN_<IvJXl@H<a##o$>;fbC%+RgWiPS>*`PH! zmq(c&BCS}(t`BBSp3P&Z$BUvh6k$9EBL^cNBL`!V1IPfFmTx?dToghwQj1a*GK&@R z@=G!@^U@VE^AsxcON$i1#+K++aYGpyCAm38j0_A6noPI&QZkDRauO>cj+`vUH;qjZ ztZecIK3NfwNRa;EjQoNEkbw}1`+O7F_#n(;{#A@7ljQ_-1;G3g#SoY;HirwCF{A5u z0tMLS`NGSY7;jB>7ki+{EWjkgEyOCsBE%xZD#a(oAtfNhF2o@vCB-YmAtf%w1ppGZ BeLnyI delta 408 zcmcblcS4WTn3tDJY{8_2_Klo{EQ}nJt691vMHv_vikTP~7#Ns})EO8UsyOxYi&9dH z5+_Ttb|`T`*u}|GNXoQ8%D5oPQYP<YoyN@xR+f@loGdpvlx+>8(q<<1*^G?pljm`i zv9Kg37EPAoEZ{c<nZX6Nij9$jY4c3ZP$nKJ{lt`%_>%m1kgAIUQS3#QAmcSA$MPt1 zCnpw_C|0rRgXH>o47s_H)Sl&$Vui@O<9Wm=H~Av3qzXvAUKJ;p$|%XrDPm+`V9;c` z#gmd*T#%Dk3ARLpZyJj{$ixkNvO+?U`K3h)!5R4l1(|v23eJf|lOOU;VBrDDm-DY; zG@ATfL`Ae1CJ!=MF$ChG&G7<e%vcQAyi#~M6JylmK(PmkOae?Y+(N8EEJ7?otWtbZ VoKgZp>_Qw;Qc}D^98%&^TmVEnaN+;} diff --git a/shop/__pycache__/views.cpython-36.pyc b/shop/__pycache__/views.cpython-36.pyc index 6c01cf3bc463ecb04415b1534c1b5e0e67c8e14d..b11e42be9cc2b4a56977d3e218f9ce0d3fc65e59 100644 GIT binary patch delta 222 zcmZ3;x`9>Mn3tD}%X>yb79#`0V+JI^!oa}bz`(#zY%x(;(KeSYij9%MogsxKg|&qt zg*BD2nK_C*g(;XplkFu)mnP#aPT%~L)SR%))N(&frduqb#i>QNSUgKob0?NRVdS42 z!?;jikb!}rh#!>@0C8Cv7#Kh{7Bew0FmNyyf%uvnlXaMM8QCUBF-aSO1hDD6#bJ}1 XpHiBWYR3q2EE@v@0}mqyqW~iS2o@%l delta 207 zcmdnMx{y`bn3tE!o_k_K3L^u<V+JI^!oa}bz`(#zY%)<<QHYVjogsxKg|&qtg*BD2 znK_DWVw4m+<1LoZ;?$yvjZYZ)CZ{nj)E8i2U?}24CHO&HkZB-X%*4RJz`<AqVr#Nb zHe=HDU}a!nxW!$Zkzb&fo1c=JQ(VLh(}B&XTO2mI`6;D2sdkJY*Re4$Fz_&PF!C@0 E0AuPRh5!Hn diff --git a/shop/forms.py b/shop/forms.py index 4c6be5f..f7b5545 100644 --- a/shop/forms.py +++ b/shop/forms.py @@ -16,13 +16,13 @@ class RegistrationForm(FlaskForm): def validate_username(self, username): user = User.query.filter_by(username=username.data).first() if user: - raise ValidationError('Oh no! This username has already been taken. Please choose a different one.') + raise ValidationError('This username has already been taken. Please choose a different one.') def validate_email(self, email): user = User.query.filter_by(email=email.data).first() - + if user: - raise ValidationError('Oh no! This email is already registered. Please choose a different one.') + raise ValidationError('This email is already registered. Please choose a different one.') class LoginForm(FlaskForm): @@ -32,19 +32,14 @@ class LoginForm(FlaskForm): class SearchForm(FlaskForm): - choices = [('Rose', 'Rose'), ('Lily', 'Lily'), ('Daisy', 'Daisy'), ('Sunflower', 'Sunflower'), ('Carnation', 'Carnation'), ('Freesia', 'Freesia'), ('Jasmine', 'Jasmine'), ('Peony', 'Peony'), ('Amaryllis', 'Amaryllis')] - select = SelectField('Search flower:', choices=choices) + choices = [('Pen', 'Pen'), ('Pencil', 'Pencil'), ('Rubber', 'Rubber'), ('USB', 'USB'), ('Rubber', 'Rubber'), ('Calculator', 'Calculator')] + select = SelectField('Search item:', choices=choices) search = StringField('') class CheckoutForm(FlaskForm): - forename = StringField('Forename', validators=[DataRequired('Please enter your forename'), Length(min=3, max=15)]) - surname = StringField('Surname', validators=[DataRequired('Please enter your surname'), Length(min=3, max=15)]) - address = StringField('Address', - validators=[DataRequired('Please enter your billing address')]) - card_no = PasswordField('card_no', validators=[DataRequired('Please enter your 16-digit card number'), Length(min=16, max=16)]) - cvc = PasswordField('cvc', validators=[DataRequired('Please enter your 3-digit CVC'), Length(min=3, max=3)]) - submit = SubmitField('Checkout') - - - - + FisrtName = StringField('First Name', validators=[DataRequired('Please enter your First Name'), Length(min=3, max=15)]) + LastName = StringField('Last Name', validators=[DataRequired('Please enter your Last Name'), Length(min=3, max=15)]) + Adress = StringField('Address', validators=[DataRequired('Please enter your Address')]) + Card_No = PasswordField('Card_No', validators=[DataRequired('Please enter your 16-digit card number'), Length(min=16, max=16)]) + CVC = PasswordField('CVC', validators=[DataRequired('Please enter your 3-digit CVC'), Length(min=3, max=3)]) + Submit = SubmitField('Checkout') diff --git a/shop/models.py b/shop/models.py index b3d1f83..3422bd4 100644 --- a/shop/models.py +++ b/shop/models.py @@ -7,7 +7,6 @@ class Item(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(50),nullable=False) description = db.Column(db.String(300), nullable=False) - #publication_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) price = db.Column(db.Numeric(10,2), nullable=False) image_file = db.Column(db.String(50), nullable=False, default='default.jpg') @@ -40,7 +39,7 @@ class User(UserMixin, db.Model): def load_user(user_id): return User.query.get(int(user_id)) -class Cart(db.Model): +class Basket(db.Model): id = db.Column(db.Integer, primary_key=True) quantity = db.Column(db.Integer) item_id = db.Column(db.Integer, db.ForeignKey('item.id'), nullable=False) diff --git a/shop/routes.py b/shop/routes.py index c253476..63c8402 100644 --- a/shop/routes.py +++ b/shop/routes.py @@ -5,6 +5,7 @@ from shop.models import Item, User from shop.forms import RegistrationForm, LoginForm, SearchForm, CheckoutForm from flask_login import login_user, current_user, logout_user, login_required + @app.route("/", methods= ['GET', 'POST']) @app.route("/home", methods= ['GET', 'POST']) @@ -23,18 +24,18 @@ def about(): return render_template('about.html', title='About') -@app.route("/orderasc") -def orderasc(): +@app.route("/Asc") +def Asc(): return render_template('home.html', items = Item.query.order_by("price"), title='Home') -@app.route("/orderdesc") -def orderdesc(): +@app.route("/Desc") +def Desc(): return render_template('home.html', items = Item.query.order_by("price")[::-1], title='Home') @app.route("/item/<int:item_id>") def item(item_id): item = Item.query.get_or_404(item_id) - return render_template('item.html', item=item) #title=book.title + return render_template('item.html', item=item) @app.route("/register", methods=['GET', 'POST']) def register(): @@ -54,8 +55,7 @@ def register(): def checkout(): form = CheckoutForm() if form.validate_on_submit(): - #user = User(forename=form.forename.data,surname=form.surname.data) - session["cart"] = [] + session["basket"] = [] return redirect(url_for('thankyou')) return render_template('checkout.html', title='Checkout', form=form) @@ -82,22 +82,22 @@ def logout(): logout_user() return redirect(url_for('home')) -@app.route("/add_to_cart/<int:item_id>") -def add_to_cart(item_id): - if "cart" not in session: - session["cart"] = [] - session["cart"].append(item_id) - flash("The item is added to your shopping cart!") - return redirect("/cart") - -@app.route("/cart", methods=['GET', 'POST']) -def cart_display(): - if "cart" not in session: - flash('There is nothing in your cart.') - return render_template("cart.html", display_cart = {}, total = 0) +@app.route("/add_to_basket/<int:item_id>") +def add_to_basket(item_id): + if "basket" not in session: + session["basket"] = [] + session["basket"].append(item_id) + flash("The item is added to your shopping basket!") + return redirect("/basket") + +@app.route("/basket", methods=['GET', 'POST']) +def basket_display(): + if "basket" not in session: + flash('There is nothing in your basket.') + return render_template("basket.html", display_basket = {}, total = 0) else: - items = session["cart"] - cart = {} + items = session["basket"] + basket = {} total_price = 0 total_quantity = 0 @@ -105,29 +105,29 @@ def cart_display(): item = Item.query.get_or_404(item) total_price += item.price - if item.id in cart: - cart[item.id]["quantity"] += 1 + if item.id in basket: + basket[item.id]["quantity"] += 1 else: - cart[item.id] = {"quantity":1, "title": item.title, "price":item.price} - total_quantity = sum(item['quantity'] for item in cart.values()) + basket[item.id] = {"quantity":1, "title": item.title, "price":item.price} + total_quantity = sum(item['quantity'] for item in basket.values()) - return render_template("cart.html", title='Your Shopping Cart', display_cart = cart, total = total_price, total_quantity = total_quantity) + return render_template("basket.html", title='Your Shopping basket', display_basket = basket, total = total_price, total_quantity = total_quantity) - return render_template('cart.html') + return render_template('basket.html') @app.route("/delete_item/<int:item_id>", methods=['GET', 'POST']) def delete_item(item_id): - if "cart" not in session: - session["cart"] = [] + if "basket" not in session: + session["basket"] = [] - session["cart"].remove(item_id) + session["basket"].remove(item_id) - flash("The item has been removed from your shopping cart!") + flash("The item has been removed from your shopping basket!") session.modified = True - return redirect("/cart") + return redirect("/basket") @app.route("/add_to_wishlist/<int:item_id>") def add_to_wishlist(item_id): @@ -158,7 +158,7 @@ def wishlist_display(): wishlist[item.id] = {"quantity":1, "title": item.title, "price":item.price} total_quantity_wishlist = sum(item_id['quantity'] for item_id in wishlist.values()) - return render_template("wishlist.html", title= "Your Shopping Cart", display_wishlist = wishlist, total = total_price, total_quantity_wishlist = total_quantity_wishlist) + return render_template("wishlist.html", title= "Your Shopping Basket", display_wishlist = wishlist, total = total_price, total_quantity_wishlist = total_quantity_wishlist) @app.route("/delete_item_wishlist/<int:item_id>", methods=['GET', 'POST']) def delete_item_wishlist(item_id): diff --git a/shop/static/style.css b/shop/static/style.css index f067900..65c0c1a 100644 --- a/shop/static/style.css +++ b/shop/static/style.css @@ -1,11 +1,11 @@ body { - font-family:helvetica, sans-serif; + font-family:Arial, sans-serif; background-color: white; } h1 { padding-left: 20px; - font-family:sans-serif; + font-family:san-serif; color:black; } diff --git a/shop/templates/about.html b/shop/templates/about.html index b822f8d..1e1c436 100644 --- a/shop/templates/about.html +++ b/shop/templates/about.html @@ -1,5 +1,5 @@ {% extends "layout.html" %} {% block content %} <h1>This is the About Us Page</h1> -<p>Needs some new staionary? this place sells all of it </p> +<p>Needs some new staionary? StationaryFix sells all of it </p> {% endblock content %} diff --git a/shop/templates/cart.html b/shop/templates/cart.html deleted file mode 100644 index 026dbca..0000000 --- a/shop/templates/cart.html +++ /dev/null @@ -1,38 +0,0 @@ -{% extends "layout.html" %} -{% block content %} -<h1>{{ title }}</h1> - -<table class=""> - <tr><th>Product</th><th>Quantity</th><th>Price</th><th>Total</th></tr> - - {% for key, value in display_cart.items() %} - <tr> - <!-- <td>{{ key }}</td> --> - <td>{{ value["title"] }}</td> - <td>{{ value["quantity"] }}</td> - <td>£{{ value["price"] }}</td> - <td>£{{ (value["quantity"] * value["price"]) }}</td> - - <td> - <form action="{{ url_for('delete_item', item_id=key|int) }}" method="POST"> - <input class="" type="submit" value="Delete"> - </form> - </td> - </tr> - {% endfor %} - -</table> -<h3>Total: £{{ total }} </h3> -<h3>Number of items: {{ total_quantity }} </h3> - -{% if current_user.is_authenticated %} - -<a href = "{{ url_for('checkout') }}">Checkout</a>  - -{% else %} - -<a href = "{{ url_for('register') }}">Create an account to checkout</a> - -{% endif %} - -{% endblock content %} diff --git a/shop/templates/home.html b/shop/templates/home.html index 5c6335b..5c8a7d2 100644 --- a/shop/templates/home.html +++ b/shop/templates/home.html @@ -1,4 +1,36 @@ {% extends "layout.html" %} {% block content %} -<h1>This is About Us page</h1> +<h1> StationaryFix </h1> +<div class="search-container"> + <form method="POST"> + <input type="text" placeholder="Search..." name="home"> + <button type="submit">Search</button> + </form> +</div> + +<div class="dropdown"> + <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Sort By + </button> + <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> + <a class="dropdown-item" href="Asc">Low-High</a> | + <a class="dropdown-item" href="Desc">High-Low</a> | +</div> + + {% for item in items %} +<div style="float:left; margin:40px; width: 295px; padding: 40px;"> + <a href="{{ url_for('item', item_id=item.id) }}"> + <img src = "{{ url_for('static', filename='img/' + item.image_file) }}" width="300" height="300"></a> + <!--<a href="{{ url_for('item', item_id=item.id) }}">--> + <p>"{{ item.title }}"</p></a> + <p>Price (£): {{ item.price }}</p> + <p>Description: {{item.description}}</p> + <a class="" href="/add_to_basket/{{item.id}}">Add to Basket</a> <br/> + + <a class="" href="/add_to_wishlist/{{item.id}}">Add to Wishlist</a>  + +</div> + + {% endfor %} +</div> {% endblock content %} diff --git a/shop/templates/item.html b/shop/templates/item.html index 924f491..ebd68b7 100644 --- a/shop/templates/item.html +++ b/shop/templates/item.html @@ -3,10 +3,10 @@ <img src = "{{ url_for('static', filename='img/' + item.image_file) }}" width="300" height="300"> - <p>"{{ item.title }}" </p> + <p>{{ item.title }} </p> <p>Price: {{ item.price }}</p> <p>Description: {{item.description}}</p> - <a class="" href="/add_to_cart/{{item.id}}">Add to Cart</a> | - <a class="" href="/add_to_wishlist/{{item.id}}">Add to Wishlist</a> | + <a class="" href="/add_to_basket/{{item.id}}">Add to Basket</a>  + <a class="" href="/add_to_wishlist/{{item.id}}">Add to Wishlist</a>  {% endblock content %} diff --git a/shop/templates/layout.html b/shop/templates/layout.html index dd013bb..979e6a5 100644 --- a/shop/templates/layout.html +++ b/shop/templates/layout.html @@ -14,17 +14,17 @@ <body> <div id="header"> - <a href="{{ url_for('home') }}" class="header">Home</a> | - <a href="{{ url_for('about') }}" class="header">About Us</a> | + <a href="{{ url_for('home') }}" class="header">Home</a>  + <a href="{{ url_for('about') }}" class="header">About Us</a>  {% if current_user.is_authenticated %} Hello, {{ current_user.username }}! - <a class="nav-item nav-link" href="{{ url_for('logout') }}">Logout</a> | + <a class="nav-item nav-link" href="{{ url_for('logout') }}">Logout</a>  {% else %} - Hello, Guest!  | <a href="{{ url_for('login') }}">Login </a> - or <a href="{{ url_for('register') }}">Register</a> | + Hello, Guest!   <a href="{{ url_for('login') }}">Login </a> + or <a href="{{ url_for('register') }}">Register</a>  {% endif %} - <a href="{{ url_for('cart_display') }}" class="header">Cart ({{total_quantity}} items) </a> | - <a href="{{ url_for('wishlist_display') }}" class="header">My Wishlist ({{total_quantity_wishlist}} items)</a> | + <a href="{{ url_for('basket_display') }}" class="header">Basket ({{total_quantity}}) </a>  + <a href="{{ url_for('wishlist_display') }}" class="header">My Wishlist ({{total_quantity_wishlist}})</a>  </div> diff --git a/shop/templates/login.html b/shop/templates/login.html index 0eab630..74bec0c 100644 --- a/shop/templates/login.html +++ b/shop/templates/login.html @@ -22,4 +22,4 @@ </form> -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/shop/templates/thankyou.html b/shop/templates/thankyou.html index aefda09..ffbe448 100644 --- a/shop/templates/thankyou.html +++ b/shop/templates/thankyou.html @@ -1,5 +1,5 @@ {% extends "layout.html" %} {% block content %} - <h1>Thank You for shopping with us We look forward to seeing you again!</h1> + <h1>Thank You for shopping with StationaryFix We look forward to seeing you again!</h1> <a class="" href="/home">Home</a> {% endblock content %} diff --git a/shop/views.py b/shop/views.py index ae3fac0..609435f 100644 --- a/shop/views.py +++ b/shop/views.py @@ -1,6 +1,6 @@ from flask_admin.contrib.sqla import ModelView import flask_login as login -from shop.models import User +from shop.models import User, Item class AdminView(ModelView): def is_accessible(self): if login.current_user.is_authenticated: -- GitLab