mirror of
https://github.com/ferdzo/serviceCRM.git
synced 2026-04-04 21:06:24 +00:00
Table view changed to separate class tables.py
This commit is contained in:
@@ -6,4 +6,8 @@ class InsertTable(tables.Table):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Insert
|
model = Insert
|
||||||
template_name = "serviceCRM/list.html"
|
template_name = "serviceCRM/list.html"
|
||||||
|
attrs = {'class':'table table-sm'}
|
||||||
fields = ['id', 'name', 'phone', 'description', 'date', 'done', 'edit']
|
fields = ['id', 'name', 'phone', 'description', 'date', 'done', 'edit']
|
||||||
|
edit = tables.TemplateColumn(template_name='serviceCRM/edit.html')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1
serviceCRM/templates/serviceCRM/edit.html
Normal file
1
serviceCRM/templates/serviceCRM/edit.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<a class="btn btn-info btn-sm" href="{% url 'training_update' record.id %}">Open</a>
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
from django.http import HttpResponse, HttpResponseRedirect
|
from django.http import HttpResponse, HttpResponseRedirect
|
||||||
from django.shortcuts import get_object_or_404, render
|
from django.shortcuts import get_object_or_404, render
|
||||||
from .models import Insert
|
|
||||||
from django.views import generic
|
from django.views import generic
|
||||||
from .forms import InputForm
|
from .forms import InputForm
|
||||||
|
from .tables import InsertTable
|
||||||
|
from .models import Insert
|
||||||
|
from django_tables2 import SingleTableView
|
||||||
|
|
||||||
# from django.template import loader
|
# from django.template import loader
|
||||||
|
|
||||||
@@ -30,7 +31,6 @@ class ReportById(generic.DetailView):
|
|||||||
class InsertNew(generic.View):
|
class InsertNew(generic.View):
|
||||||
model = Insert
|
model = Insert
|
||||||
template_name = "serviceCRM/form.html"
|
template_name = "serviceCRM/form.html"
|
||||||
|
|
||||||
def insert(request):
|
def insert(request):
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = InputForm(request.POST)
|
form = InputForm(request.POST)
|
||||||
@@ -44,9 +44,10 @@ class InsertNew(generic.View):
|
|||||||
return render(request, InsertNew.template_name, {'form': form})
|
return render(request, InsertNew.template_name, {'form': form})
|
||||||
|
|
||||||
|
|
||||||
class List(generic.ListView):
|
class List(SingleTableView):
|
||||||
model = Insert
|
model = Insert
|
||||||
template_name = "serviceCRM/list.html"
|
table_class = InsertTable
|
||||||
|
template_name = 'serviceCRM/list.html'
|
||||||
|
|
||||||
|
|
||||||
def done(request, question_id):
|
def done(request, question_id):
|
||||||
|
|||||||
Reference in New Issue
Block a user