Fix/implement image uploads
This commit is contained in:
parent
f0e53b56a5
commit
c691a7cff2
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ __pycache__
|
||||
|
||||
settings.py
|
||||
migrations
|
||||
promo_uploads
|
||||
|
@ -18,6 +18,7 @@ import markdown
|
||||
|
||||
from django.contrib.staticfiles.storage import staticfiles_storage
|
||||
|
||||
from django.conf import settings
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
|
||||
@ -32,6 +33,7 @@ def environment(**options):
|
||||
'localtime': lambda dt: timezone.localtime(dt).strftime('%Y-%m-%d %H:%M'),
|
||||
'static': staticfiles_storage.url,
|
||||
'url': reverse,
|
||||
'MEDIA_URL': settings.MEDIA_URL,
|
||||
})
|
||||
env.filters.update({
|
||||
'markdown': lambda x: Markup(markdown.markdown(x))
|
||||
|
@ -14,6 +14,8 @@
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
|
||||
@ -23,4 +25,4 @@ urlpatterns = [
|
||||
path('treasury/', include('sstreasury.urls')),
|
||||
path('promotions/', include('sspromotions.urls')),
|
||||
path('', include('ssmain.urls')),
|
||||
]
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
@ -23,7 +23,7 @@
|
||||
{% block maincontent %}
|
||||
<h1>{% if request.resolver_match.url_name == 'bulletin_new' %}New{% else %}Edit{% endif %} bulletin item</h1>
|
||||
|
||||
<form class="ui form" method="POST">
|
||||
<form class="ui form" method="POST" enctype="multipart/form-data">
|
||||
<div class="ui disabled inline grid field">
|
||||
<label class="three wide column">ID</label>
|
||||
<input class="eleven wide column" type="text" name="id" value="{{ item.id if item.id != None else '' }}">
|
||||
|
@ -59,7 +59,7 @@
|
||||
<table>
|
||||
<tr>
|
||||
<th>
|
||||
<a href="#"><img src="{{ item.image }}" alt="{{ item.title }}"></a>
|
||||
{% if item.link %}<a href="{{ item.link }}">{% endif %}<img src="{{ MEDIA_URL }}{{ item.image }}" alt="{{ item.title }}">{% if item.link %}</a>{% endif %}
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
@ -71,7 +71,7 @@
|
||||
<th>
|
||||
<b><h5>{{ item.title }}</h5></b>
|
||||
<p>{{ item.content | markdown }}</p>
|
||||
{% if item.link %}<p><a href="{{ item.link }}">Click Here ›</a></p>{% endif %}
|
||||
{% if item.link %}<p><a href="{{ item.link }}">Read more ›</a></p>{% endif %}
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
@ -99,10 +99,10 @@
|
||||
<table>
|
||||
<tr>
|
||||
<th>
|
||||
{% if item.image %}{% if item.link %}<a href="{{ item.link }}">{% endif %}<img src="{{ item.image }}" alt="{{ item.title }}">{% if item.link %}</a>{% endif %}<br>{% endif %}
|
||||
{% if item.image %}{% if item.link %}<a href="{{ item.link }}">{% endif %}<img src="{{ MEDIA_URL }}{{ item.image }}" alt="{{ item.title }}">{% if item.link %}</a>{% endif %}<br>{% endif %}
|
||||
<b><h5>{{ item.title }}</h5></b>
|
||||
<p>{{ item.content }}</p>
|
||||
{% if item.link %}<p><a href="{{ item.link }}">Click Here ›</a></p>{% endif %}
|
||||
{% if item.link %}<p><a href="{{ item.link }}">Read more ›</a></p>{% endif %}
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
|
Loading…
Reference in New Issue
Block a user