mirror of
https://github.com/ferdzo/serviceCRM.git
synced 2026-04-04 21:06:24 +00:00
a
This commit is contained in:
20
serviceCRM/templates/serviceCRM/Insert_list.html
Normal file
20
serviceCRM/templates/serviceCRM/Insert_list.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
|
||||
<!-- Load dependencies -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.min.js"
|
||||
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
|
||||
crossorigin="anonymous"></script>
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
|
||||
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
|
||||
|
||||
<!-- Load js for initializing tables via their server-side options -->
|
||||
<script type="text/javascript" charset="utf8" src="{% static 'js/datatableview.js' %}"></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
datatableview.initialize($('.datatable'));
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Render the table skeleton, includes the .datatable class for the on-ready initializer. -->
|
||||
{{ datatable }}
|
||||
@@ -26,5 +26,6 @@ urlpatterns = [
|
||||
path("nalog/<int:id>/", view.Nalog, name="nalog"),
|
||||
path("delete/<int:id>/", view.Delete.Delete, name="delete"),
|
||||
path("done/", view.Done.as_view(), name="done"),
|
||||
path("done/<int:id>/", view.Done.done_by_id, name="done")
|
||||
path("done/<int:id>/", view.Done.done_by_id, name="done"),
|
||||
path("datatable/", view.DatatableView.as_view(), name="datatable"),
|
||||
]
|
||||
|
||||
@@ -6,7 +6,7 @@ from .forms import InputForm
|
||||
from .models import Insert
|
||||
from .tables import DoneInsertTable, InsertTable
|
||||
from django_tables2 import SingleTableView
|
||||
|
||||
from datatableview.views import DatatableView
|
||||
|
||||
class InsertListView(SingleTableView):
|
||||
model = Insert
|
||||
@@ -21,7 +21,7 @@ class InsertNew(generic.View):
|
||||
if request.method == 'POST':
|
||||
form = InputForm(request.POST)
|
||||
if form.is_valid():
|
||||
ticket=form.save()
|
||||
ticket = form.save()
|
||||
print("Raboti")
|
||||
return HttpResponseRedirect(f"/nalog/{ticket.id}/")
|
||||
else:
|
||||
@@ -61,4 +61,9 @@ class Delete():
|
||||
def Delete(request, id):
|
||||
req = get_object_or_404(Insert, id=id)
|
||||
req.delete()
|
||||
return HttpResponseRedirect("/")
|
||||
return HttpResponseRedirect("/")
|
||||
|
||||
class DatatableView(DatatableView):
|
||||
model = Insert
|
||||
template_name = 'serviceCRM/Insert_list.html'
|
||||
|
||||
Reference in New Issue
Block a user