mirror of
https://github.com/ferdzo/serviceCRM.git
synced 2026-04-05 05:06:25 +00:00
Fix
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
from .models import Insert
|
from .models import Insert
|
||||||
|
|
||||||
|
|
||||||
class DateInput(forms.DateInput):
|
class DateInput(forms.DateInput):
|
||||||
input_type = 'date'
|
input_type = 'date'
|
||||||
|
|
||||||
@@ -8,15 +9,16 @@ class DateInput(forms.DateInput):
|
|||||||
class InputForm(forms.ModelForm):
|
class InputForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Insert
|
model = Insert
|
||||||
fields = {"name", "phone", "description", "date","done"}
|
fields = {"name", "phone", "description", "date", "done"}
|
||||||
labels = {'name': "Name", 'phone': "Phone", 'date': "Date", 'description': "Description",'done':"Done"}
|
labels = {'name': "Name", 'phone': "Phone", 'date': "Date", 'description': "Description", 'done': "Done"}
|
||||||
widgets = {
|
widgets = {
|
||||||
'name': forms.TextInput(attrs={'class':'form-control'}),
|
'name': forms.TextInput(attrs={'class': 'form-control'}),
|
||||||
'phone': forms.TextInput(attrs={'class': 'form-control'}),
|
'phone': forms.TextInput(attrs={'class': 'form-control'}),
|
||||||
'date': DateInput(),
|
'date': DateInput(),
|
||||||
'description':forms.Textarea(attrs={'class': 'form-control'})
|
'description': forms.Textarea(attrs={'class': 'form-control'})
|
||||||
}
|
}
|
||||||
field_order =["name", "phone", "date","description","done"]
|
|
||||||
|
field_order = ["name", "phone", "date", "description", "done"]
|
||||||
|
|
||||||
# name = forms.CharField(label="Name", max_length=30)
|
# name = forms.CharField(label="Name", max_length=30)
|
||||||
# phone = forms.CharField(label="Phone", max_length=30)
|
# phone = forms.CharField(label="Phone", max_length=30)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.auth.models import UserManager
|
from django.contrib.auth.models import UserManager
|
||||||
|
|
||||||
|
|
||||||
class Insert(models.Model):
|
class Insert(models.Model):
|
||||||
name = models.CharField(max_length=50)
|
name = models.CharField(max_length=50)
|
||||||
phone = models.CharField(max_length=20)
|
phone = models.CharField(max_length=20)
|
||||||
@@ -9,9 +10,7 @@ class Insert(models.Model):
|
|||||||
done = models.BooleanField()
|
done = models.BooleanField()
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Ime: "+self.name + " Telefonski broj: "+self.phone+ "\nDefekt: "+self.description + "\nDatum: \n"
|
return "Ime: " + self.name + " Telefonski broj: " + self.phone + "\nDefekt: " + self.description + "\nDatum: \n"
|
||||||
|
|
||||||
def isDone(self):
|
def isDone(self):
|
||||||
return self.done
|
return self.done
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from .models import Insert
|
from .models import Insert
|
||||||
|
|
||||||
|
|
||||||
class InsertTable(tables.Table):
|
class InsertTable(tables.Table):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Insert
|
model = Insert
|
||||||
template_name="serviceCRM/list.html"
|
template_name = "serviceCRM/list.html"
|
||||||
|
fields = ['id', 'name', 'phone', 'description', 'date', 'done', 'edit']
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Including another URLconf
|
|||||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import include, path
|
from django.urls import path
|
||||||
import serviceCRM.views as view
|
import serviceCRM.views as view
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ 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(generic.ListView):
|
||||||
model = Insert
|
model = Insert
|
||||||
template_name = "serviceCRM/list.html"
|
template_name = "serviceCRM/list.html"
|
||||||
@@ -53,5 +54,3 @@ def done(request, question_id):
|
|||||||
if req.isDone():
|
if req.isDone():
|
||||||
return HttpResponse("Done")
|
return HttpResponse("Done")
|
||||||
return HttpResponse("Not Done")
|
return HttpResponse("Not Done")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user