#89: Delete custom slides.
This commit is contained in:
parent
90787b2597
commit
f2a93c4505
@ -36,6 +36,11 @@ class ProjectorSlide(models.Model, SlideMixin):
|
|||||||
'template': 'projector/ProjectorSlide.html',
|
'template': 'projector/ProjectorSlide.html',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@models.permalink
|
||||||
|
def get_absolute_url(self, link='delete'):
|
||||||
|
if link == 'delete':
|
||||||
|
return ('customslide_delete', [str(self.id)])
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.title
|
return self.title
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ from django.conf.urls.defaults import *
|
|||||||
|
|
||||||
from utils.views import CreateView
|
from utils.views import CreateView
|
||||||
|
|
||||||
from views import ControlView, ActivateView, CustomSlideCreateView, CustomSlideUpdateView
|
from views import ControlView, ActivateView, CustomSlideCreateView, CustomSlideUpdateView, CustomSlideDeleteView
|
||||||
from agenda.views import ItemUpdate
|
from agenda.views import ItemUpdate
|
||||||
from models import ProjectorSlide
|
from models import ProjectorSlide
|
||||||
|
|
||||||
@ -50,11 +50,17 @@ urlpatterns = patterns('projector.views',
|
|||||||
CustomSlideCreateView.as_view(),
|
CustomSlideCreateView.as_view(),
|
||||||
name='customslide_new',
|
name='customslide_new',
|
||||||
),
|
),
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/edit/$',
|
url(r'^(?P<pk>\d+)/edit/$',
|
||||||
CustomSlideUpdateView.as_view(),
|
CustomSlideUpdateView.as_view(),
|
||||||
name='customslide_edit',
|
name='customslide_edit',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
url(r'^(?P<pk>\d+)/del/$',
|
||||||
|
CustomSlideDeleteView.as_view(),
|
||||||
|
name='customslide_delete',
|
||||||
|
),
|
||||||
|
|
||||||
url(r'^bigger/$', 'projector_edit', {'direction': 'bigger'},
|
url(r'^bigger/$', 'projector_edit', {'direction': 'bigger'},
|
||||||
name='projector_bigger'),
|
name='projector_bigger'),
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ from django.template.loader import render_to_string
|
|||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
|
|
||||||
from utils.views import TemplateView, RedirectView, CreateView, UpdateView
|
from utils.views import TemplateView, RedirectView, CreateView, UpdateView, DeleteView
|
||||||
from utils.utils import template, permission_required, \
|
from utils.utils import template, permission_required, \
|
||||||
del_confirm_form, ajax_request
|
del_confirm_form, ajax_request
|
||||||
from utils.template import render_block_to_string
|
from utils.template import render_block_to_string
|
||||||
@ -115,6 +115,7 @@ class ActivateView(RedirectView):
|
|||||||
config['bigger'] = 100
|
config['bigger'] = 100
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
class CustomSlideCreateView(CreateView):
|
class CustomSlideCreateView(CreateView):
|
||||||
permission_required = 'agenda.can_manage_agenda'
|
permission_required = 'agenda.can_manage_agenda'
|
||||||
template_name = 'projector/new.html'
|
template_name = 'projector/new.html'
|
||||||
@ -129,6 +130,7 @@ class CustomSlideCreateView(CreateView):
|
|||||||
return reverse(self.get_apply_url(), args=[self.object.id])
|
return reverse(self.get_apply_url(), args=[self.object.id])
|
||||||
return reverse(super(CreateView, self).get_success_url())
|
return reverse(super(CreateView, self).get_success_url())
|
||||||
|
|
||||||
|
|
||||||
class CustomSlideUpdateView(UpdateView):
|
class CustomSlideUpdateView(UpdateView):
|
||||||
permission_required = 'projector.can_manage_projector'
|
permission_required = 'projector.can_manage_projector'
|
||||||
template_name = 'projector/new.html'
|
template_name = 'projector/new.html'
|
||||||
@ -143,6 +145,18 @@ class CustomSlideUpdateView(UpdateView):
|
|||||||
return ''
|
return ''
|
||||||
return reverse(super(UpdateView, self).get_success_url())
|
return reverse(super(UpdateView, self).get_success_url())
|
||||||
|
|
||||||
|
|
||||||
|
class CustomSlideDeleteView(DeleteView):
|
||||||
|
permission_required = 'projector.can_manage_projector'
|
||||||
|
model = ProjectorSlide
|
||||||
|
url = 'projector_control'
|
||||||
|
|
||||||
|
def pre_post_redirect(self, request, *args, **kwargs):
|
||||||
|
self.object = self.get_object()
|
||||||
|
self.object.delete()
|
||||||
|
messages.success(request, _("Custom slide <b>%s</b> was successfully deleted.") % self.object)
|
||||||
|
|
||||||
|
|
||||||
@permission_required('projector.can_see_projector')
|
@permission_required('projector.can_see_projector')
|
||||||
def active_slide(request, sid=None):
|
def active_slide(request, sid=None):
|
||||||
"""
|
"""
|
||||||
|
@ -581,6 +581,9 @@ ul.results {
|
|||||||
.preview {
|
.preview {
|
||||||
background:url("../images/icons/preview.png") no-repeat 0px 0px;
|
background:url("../images/icons/preview.png") no-repeat 0px 0px;
|
||||||
}
|
}
|
||||||
|
.delete {
|
||||||
|
background:url("../images/icons/delete.png") no-repeat 0px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user