Fixed profile page

This commit is contained in:
Pünkösd Marcell 2020-11-28 22:56:25 +01:00
parent 35a130f1a1
commit d73b63d85d
2 changed files with 31 additions and 33 deletions

View File

@ -3,25 +3,25 @@
{% block content %}
{% if current_user.is_authenticated %}
<div>
<h1>Welcome {{ current_user.username }}</h1>
<a href="{{ url_for('UploadView:index') }}" class="btn btn-primary">Upload</a>
<h1>Welcome {{ current_user.name }}</h1>
<a href="{{ url_for('UploadView:index') }}" class="btn btn-secondary">Upload</a>
</div>
<br>
{% if images %}
{% if current_user.uploads %}
<div class="row mx-2">
{% for image in images %}
{% for item in current_user.uploads %}
<div class="col-12 col-sm-6 col-md-4 px-2 mb-3">
<div class="card">
<a href="{{ url_for('ItemView:index', id=image.id) }}">
<img src="{{image.preview}}" class="img-fluid" style="padding: 30px" alt="{{image.name}}">
</a>
<div class="card-body">
<h5 class="card-title">{{image.creator}}</h5>
<a href="{{ url_for('ItemView:get', id_=item.id) }}"><img
src="{{ url_for('ContentView:preview', id_=item.id) }}"
class="img-fluid" alt="{{ item.name }}"
/></a>
<p class="card-text">
{{image.caption}}
{{ item.name }}
</p>
<a href="{{ url_for('ItemView:download', id=image.id) }}" class="btn btn-primary" target="_blank">Download</a>
<a href="{{ url_for('ItemView:delete', id=image.id) }}" class="btn btn-primary" target="_blank">Delete</a>
<a href="{{ url_for('ContentView:caff', id_=item.id) }}"
class="btn btn-primary" target="_blank">Download</a>
</div>
</div>
</div>

View File

@ -21,7 +21,5 @@ class ProfileView(FlaskView):
@login_required
def index(self):
useritems = Item.query.filter_by(uploader_id=current_user.id)
return render_template('profile.html', images=useritems)