diff --git a/routes.py b/routes.py index ef4373b..2ac87af 100644 --- a/routes.py +++ b/routes.py @@ -89,6 +89,16 @@ def verify_document(document_id): return redirect(url_for('dashboard')) return redirect(url_for('home')) +@app.route('/delete-listing/', methods=['POST', 'DELETE']) +@login_required +def delete_listing(listing_id): + if current_user.is_host: + listing = Listing.query.get_or_404(listing_id) + db.session.delete(listing) + db.session.commit() + return redirect(url_for('dashboard')) + return redirect(url_for('home')) + @app.route('/dashboard', methods=['GET', 'POST']) @login_required def dashboard(): diff --git a/templates/dashboard.html b/templates/dashboard.html index 8b5d25b..09042a0 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -2,6 +2,23 @@ {% block title %}Dashboard{% endblock %} {% block content %} + +

Host Dashboard

@@ -26,7 +43,7 @@ {{ listing.property_type }} Edit - Delete + {% endfor %}