html - Flask {% extend "base.html" %}, but don't want the button in nav to display on form page
问题描述
When I click on the button to go to the post job page I want the navigation to show by extending base.html, but I don't want the post job button to show on the page anymore beings I'm on the post job page. How would I do this?
I don't really want to use javascript window.onload to remove it.
any other ideas or how would I do this in flask?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}{% endblock %}JustRemote</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
</head>
<body>
<header class="header">
<nav class="nav">
<a class="logo" href="{{ url_for('index') }}"ß"><span class="logo-char">J</span>ust<span class="logo-char">R</span>emote</a>
<ul class="nav-list">
<li class="nav-item">
<a class="nav-link" href="{{ url_for('index')}}">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('index')}}">Tech</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('index')}}">Design</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('index')}}">Customer Service</a>
</li>
</ul>
</nav>
{% block button %}
<form class="post-job-form" action="{{ url_for('post_job') }}">
<button class="post-job" type="submit">Post Job :)</button>
</form>
{% endblock %}
</header>
{% block content %}
{% endblock %}
</body>
</html>
解决方案
If I understand you correctly, doing this on the Post Jobs page should work.
{% extend "base.html" %}
{% block button %}{% endblock %}
{% block content %} Hi! {% endblock %}