I try to dynamically generate my url_for like this and it is not working...:
search.html
<a href="{{ url_for('{{ country }}') }}"
This is where I query my data for my link from my database.
routes.py
from app import app, db
from app.models import
@app.route('/search')
def search():
country = Country.query.get(3)
return render_template('search.html', country=country.country)
#this is one of the final page where the link in the search results lead
#I will have /portugal, /france, etc...
@app.route('/germany')
def germany():
return render_template('germany.html')
and this is a clip of the information in my database:
models.py
from app import db
class Country(db.Model):
id = db.Column(db.Integer, primary_key=True)
country = db.Column(db.String(120), index=True, unique=True)
html_page = db.Column(db.String(255), index=True, unique=True)
def __repr__(self):
return '<Country {}>'.format(self.country)
Do I even need to store the URL since it is the same as the country name aka @germany