add stream & restreamconfig changeviews
This commit is contained in:
parent
730889b9a1
commit
8ec9c2807c
|
@ -2,8 +2,25 @@
|
|||
{% load i18n %}
|
||||
{% load bootstrap4 %}
|
||||
{% load font_awesome %}
|
||||
{% load guardian_tags %}
|
||||
|
||||
{% get_obj_perms user for object as "obj_perms" %}
|
||||
|
||||
{% block 'content' %}
|
||||
<h6>{% trans "restreamconfig_configuration_details_header" %}</h6>
|
||||
<div class="row justify-content-between">
|
||||
<div class="col">
|
||||
<h6>{% trans "restreamconfig_configuration_details_header" %}</h6>
|
||||
</div>
|
||||
{% get_obj_perms user for object as "obj_perms" %}
|
||||
<div class="col-auto">
|
||||
{% if "change_restreamconfig" in obj_perms %}
|
||||
<a href="{% url 'restream:restreamconfig_change' pk=object.pk %}" type="button" class="btn btn-primary">{% fa 'pencil' %} {% trans 'change' %}</a>
|
||||
{% endif %}
|
||||
{% if "delete_restreamconfig" in obj_perms %}
|
||||
<a href="{% url 'restream:restreamconfig_delete' pk=object.pk %}" type="button" class="btn btn-danger">{% fa 'trash' %} {% trans 'delete' %}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<hr class="my-4">
|
||||
<div class="row">
|
||||
<div class="col-sm border-right">
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% load bootstrap4 %}
|
||||
{% block 'content' %}
|
||||
<h6>{% trans "update_restreamconfig_configuration_header" %}</h6>
|
||||
<hr class="my-4">
|
||||
<div class="row">
|
||||
<div class="col-sm border-right">
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
{% buttons %}
|
||||
<button type="submit" class="btn btn-primary" value="login">
|
||||
{% trans "submit" %}
|
||||
</button>
|
||||
{% endbuttons %}
|
||||
<input type="hidden" name="next" value="{{ next }}">
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
{% trans "update_restreamconfig_configuration_text_html" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -6,6 +6,7 @@ app_name = 'restream'
|
|||
urlpatterns = [
|
||||
path('restreamconfig/', views.RestreamConfigList.as_view(), name='restreamconfig_list'),
|
||||
path('restreamconfig/<int:pk>/', views.RestreamConfigDetail.as_view(), name='restreamconfig_detail'),
|
||||
path('restreamconfig/<int:pk>/change', views.RestreamConfigChange.as_view(), name='restreamconfig_change'),
|
||||
path('restreamconfig/<int:pk>/delete', views.RestreamConfigDelete.as_view(), name='restreamconfig_delete'),
|
||||
path('restreamconfig/create', views.RestreamConfigCreate.as_view(), name='restreamconfig_create'),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.urls import reverse_lazy
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views.generic import ListView, DetailView, CreateView, DeleteView
|
||||
from django.views.generic import ListView, DetailView, CreateView, DeleteView, UpdateView
|
||||
from guardian.decorators import permission_required_or_403
|
||||
from guardian.shortcuts import assign_perm
|
||||
|
||||
|
@ -24,6 +24,21 @@ class RestreamConfigDetail(DetailView):
|
|||
model = models.RestreamConfig
|
||||
|
||||
|
||||
@method_decorator(login_required, name='dispatch')
|
||||
@method_decorator(permission_required_or_403('restream.change_restreamconfig',
|
||||
(models.RestreamConfig, 'pk', 'pk')),
|
||||
name='dispatch')
|
||||
class RestreamConfigChange(UpdateView):
|
||||
model = models.RestreamConfig
|
||||
form_class = forms.RestreamConfigFilteredStreamForm
|
||||
template_name_suffix = '_update_form'
|
||||
|
||||
def get_form_kwargs(self):
|
||||
kwargs = super().get_form_kwargs()
|
||||
kwargs['user'] = self.request.user
|
||||
return kwargs
|
||||
|
||||
|
||||
@method_decorator(login_required, name='dispatch')
|
||||
@method_decorator(permission_required_or_403('restream.add_restreamconfig'),
|
||||
name='dispatch')
|
||||
|
|
|
@ -2,8 +2,25 @@
|
|||
{% load i18n %}
|
||||
{% load bootstrap4 %}
|
||||
{% load font_awesome %}
|
||||
{% load guardian_tags %}
|
||||
|
||||
{% get_obj_perms user for object as "obj_perms" %}
|
||||
|
||||
{% block 'content' %}
|
||||
<h6>{% trans "stream_configuration_details_header" %}</h6>
|
||||
<div class="row justify-content-between">
|
||||
<div class="col">
|
||||
<h6>{% trans "stream_configuration_details_header" %}</h6>
|
||||
</div>
|
||||
{% get_obj_perms user for object as "obj_perms" %}
|
||||
<div class="col-auto">
|
||||
{% if "change_stream" in obj_perms %}
|
||||
<a href="{% url 'rtmp:stream_change' pk=object.pk %}" type="button" class="btn btn-primary">{% fa 'pencil' %} {% trans 'change' %}</a>
|
||||
{% endif %}
|
||||
{% if "delete_stream" in obj_perms %}
|
||||
<a href="{% url 'rtmp:stream_delete' pk=object.pk %}" type="button" class="btn btn-danger">{% fa 'trash' %} {% trans 'delete' %}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<hr class="my-4">
|
||||
<div class="row">
|
||||
<div class="col-sm border-right">
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% load bootstrap4 %}
|
||||
{% block 'content' %}
|
||||
<h6>{% trans "update_stream_configuration_header" %}</h6>
|
||||
<hr class="my-4">
|
||||
<div class="row">
|
||||
<div class="col-sm border-right">
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
{% buttons %}
|
||||
<button type="submit" class="btn btn-primary" value="login">
|
||||
{% trans "submit" %}
|
||||
</button>
|
||||
{% endbuttons %}
|
||||
<input type="hidden" name="next" value="{{ next }}">
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
{% trans "update_stream_configuration_text_html" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -7,6 +7,7 @@ urlpatterns = [
|
|||
path('callback/srs', views.callback_srs, name='callback_srs'),
|
||||
path('streams/', views.StreamList.as_view(), name='stream_list'),
|
||||
path('streams/<int:pk>/', views.StreamDetail.as_view(), name='stream_detail'),
|
||||
path('streams/<int:pk>/change', views.StreamChange.as_view(), name='stream_change'),
|
||||
path('streams/<int:pk>/delete', views.StreamDelete.as_view(), name='stream_delete'),
|
||||
path('streams/create', views.StreamCreate.as_view(), name='stream_create'),
|
||||
]
|
||||
|
|
|
@ -8,7 +8,7 @@ from django.contrib.auth.decorators import login_required
|
|||
from django.contrib.admin.utils import NestedObjects
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.views.generic import ListView, DetailView, CreateView, DeleteView
|
||||
from django.views.generic import ListView, DetailView, CreateView, DeleteView, UpdateView
|
||||
from guardian.decorators import permission_required_or_403
|
||||
from guardian.shortcuts import assign_perm
|
||||
|
||||
|
@ -64,6 +64,17 @@ class StreamDetail(DetailView):
|
|||
model = models.Stream
|
||||
|
||||
|
||||
@method_decorator(login_required, name='dispatch')
|
||||
@method_decorator(permission_required_or_403('rtmp.change_stream',
|
||||
(models.Stream, 'pk', 'pk')),
|
||||
name='dispatch')
|
||||
class StreamChange(UpdateView):
|
||||
model = models.Stream
|
||||
fields = ['application', 'name']
|
||||
template_name_suffix = '_update_form'
|
||||
|
||||
|
||||
|
||||
@method_decorator(login_required, name='dispatch')
|
||||
@method_decorator(permission_required_or_403('rtmp.add_stream'),
|
||||
name='dispatch')
|
||||
|
|
Loading…
Reference in New Issue