{% extends 'base.html' %}


 {% block content %}
 <div class="dummy"></div>
 <!-- Modal -->
<div class="modal fade" id="exampleModalLong" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLongTitle">Share your knowledge</h5>
        <button type="button" class="close btn" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <form action="{% url 'inputpost' %}" method="POST">
        	{% csrf_token %}
    <div class="labelinput">Add tag</div>    	
      <select name="tags">
        {% for t in tags %}
  <option value="{{t.pk}}">{{t.tagname}}</option>
  {% endfor %}
</select>      
<div class="labelinput">Add title</div>    	

<input type="text" name="title" placeholder=" Title"> 
   <div class="labelinput">Add content</div>    	

<input type="text" name="body" placeholder=" Share content">
        <input type="submit" name="submitpost" class='button' value="submit">

      </div>
      </form>
    </div>
  </div>
</div>
<!-- ******************************************** -->
{% if user.is_authenticated %}
<div class="each_block">
	<div class="head" data-toggle="modal" data-target="#exampleModalLong">Click to share something with us . .
  </div>
</div>
{% endif %}

{% for p in post %}
<div class='each_block'>
<div class='tag'>{{p.tagname}}</div>
<div class='heading'><a href ="{% url 'detail' p.pk  %}">{{p.title}}</a></div>
<span class='name'>This article is shared by&nbsp;{{p.author}}</span>
<div class='body'>{{p.body}}
</div>
<hr>
</div>
{% endfor %}
{% endblock %}
