Add image upload support
Images can be uploaded, thumbnails are created, they're displayed within the threads themselves. Just like four chans! There is not an upload size limit set yet. Gotta get on that next. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
<h2>Create a new thread</h2>
|
||||
</div>
|
||||
<div class="row">
|
||||
<form method="post" action="{% url 'board:board_detail' url=board.url %}">
|
||||
<form method="post" action="{% url 'board:board_detail' url=board.url %}" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="row">
|
||||
<div class="column"> </div>
|
||||
<div class="column">
|
||||
<form method="post" action="{% url 'board:post_detail' url=board.url id=post.id %}">
|
||||
<form method="post" action="{% url 'board:post_detail' url=board.url id=post.id %}" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
|
||||
@@ -1,6 +1,23 @@
|
||||
{% load post_body %}
|
||||
<div id="p{{post.id}}">
|
||||
{# TODO images #}
|
||||
{# Image #}
|
||||
{% if post.thumbnail %}
|
||||
{# Image info #}
|
||||
<div class="post_image_info">
|
||||
File: <a href="{{post.image.url}}" target="_blank">{{post.original_image_name}}</a>
|
||||
({{post.image.size|measure_bytes}}, {{post.image_width}}x{{post.image_height}})
|
||||
</div>
|
||||
|
||||
{# Image thumbnail #}
|
||||
<div class="post_image_thumbnail">
|
||||
<a href="{{post.image.url}}" target="_blank">
|
||||
<img src="{{post.thumbnail.url}}">
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# Post ID, username, time #}
|
||||
<div class="post_content">
|
||||
<a href="#p{{post.id}}">#.</a>
|
||||
<span class="post_id">{{post.id}}</span>
|
||||
{% if post.subject %}
|
||||
@@ -11,11 +28,16 @@ at {{post.created}}
|
||||
{% if reply_link %}
|
||||
[<a href="{{post.get_absolute_url}}">Reply</a>]
|
||||
{% endif %}
|
||||
|
||||
{# "X replies elided" dialog for OPs on the board #}
|
||||
{% if replies_elided > 0 %}
|
||||
<br/>
|
||||
<span class="replies_elided">
|
||||
({{replies_elided}} replies elided, click reply to view)
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{# Post body #}
|
||||
<p class="post_body">{{post|post_body|safe}}</p>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user