Small improvement in file prop view

This commit is contained in:
Skia 2016-12-18 17:59:08 +01:00
parent 9f35f74082
commit 94e740fb04
2 changed files with 13 additions and 3 deletions

View File

@ -1,5 +1,4 @@
{% extends "core/base.jinja" %}
{% from "core/macros.jinja" import user_link_with_pict, delete_godfather %}
{% block title %}
{% trans user_name=profile.get_display_name() %}{{ user_name }}'s pictures{% endtrans %}
@ -23,7 +22,7 @@
{%- endif %}
<div class="picture">
<a href="{{ url("sas:picture", picture_id=r.picture.id) }}#pict">
<img src="{{ r.picture.as_picture.get_download_thumb_url() }}" alt="{{ r.picture.get_display_name() }}" style="max-width: 100%"/>
<img src="{{ r.picture.get_download_thumb_url() }}" alt="{{ r.picture.get_display_name() }}" style="max-width: 100%"/>
</a>
</div>
{%- endfor %}

View File

@ -16,6 +16,8 @@ from django import forms
import os
from ajax_select import make_ajax_form, make_ajax_field
from core.models import SithFile, RealGroup, Notification
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, CanCreateMixin, can_view, not_found
from counter.models import Counter
@ -111,12 +113,21 @@ class FileEditView(CanEditMixin, UpdateView):
kwargs['popup'] = 'popup'
return kwargs
class FileEditPropForm(forms.ModelForm):
class Meta:
model = SithFile
fields = ['parent', 'owner', 'edit_groups', 'view_groups']
parent = make_ajax_field(SithFile, 'parent', 'files', help_text="")
edit_groups = make_ajax_field(SithFile, 'edit_groups', 'groups', help_text="")
view_groups = make_ajax_field(SithFile, 'view_groups', 'groups', help_text="")
class FileEditPropView(CanEditPropMixin, UpdateView):
model = SithFile
pk_url_kwarg = "file_id"
template_name = 'core/file_edit.jinja'
context_object_name = "file"
fields = ['parent', 'owner', 'edit_groups', 'view_groups']
form_class = FileEditPropForm
def get_form(self, form_class=None):
form = super(FileEditPropView, self).get_form(form_class)