mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
Small improvement in file prop view
This commit is contained in:
parent
9f35f74082
commit
94e740fb04
@ -1,5 +1,4 @@
|
|||||||
{% extends "core/base.jinja" %}
|
{% extends "core/base.jinja" %}
|
||||||
{% from "core/macros.jinja" import user_link_with_pict, delete_godfather %}
|
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% trans user_name=profile.get_display_name() %}{{ user_name }}'s pictures{% endtrans %}
|
{% trans user_name=profile.get_display_name() %}{{ user_name }}'s pictures{% endtrans %}
|
||||||
@ -23,7 +22,7 @@
|
|||||||
{%- endif %}
|
{%- endif %}
|
||||||
<div class="picture">
|
<div class="picture">
|
||||||
<a href="{{ url("sas:picture", picture_id=r.picture.id) }}#pict">
|
<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>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
@ -16,6 +16,8 @@ from django import forms
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from ajax_select import make_ajax_form, make_ajax_field
|
||||||
|
|
||||||
from core.models import SithFile, RealGroup, Notification
|
from core.models import SithFile, RealGroup, Notification
|
||||||
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, CanCreateMixin, can_view, not_found
|
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, CanCreateMixin, can_view, not_found
|
||||||
from counter.models import Counter
|
from counter.models import Counter
|
||||||
@ -111,12 +113,21 @@ class FileEditView(CanEditMixin, UpdateView):
|
|||||||
kwargs['popup'] = 'popup'
|
kwargs['popup'] = 'popup'
|
||||||
return kwargs
|
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):
|
class FileEditPropView(CanEditPropMixin, UpdateView):
|
||||||
model = SithFile
|
model = SithFile
|
||||||
pk_url_kwarg = "file_id"
|
pk_url_kwarg = "file_id"
|
||||||
template_name = 'core/file_edit.jinja'
|
template_name = 'core/file_edit.jinja'
|
||||||
context_object_name = "file"
|
context_object_name = "file"
|
||||||
fields = ['parent', 'owner', 'edit_groups', 'view_groups']
|
form_class = FileEditPropForm
|
||||||
|
|
||||||
def get_form(self, form_class=None):
|
def get_form(self, form_class=None):
|
||||||
form = super(FileEditPropView, self).get_form(form_class)
|
form = super(FileEditPropView, self).get_form(form_class)
|
||||||
|
Loading…
Reference in New Issue
Block a user