from django import forms from gsxws import products from django.shortcuts import render from django.views.generic.list import ListView from django.views.generic.edit import FormView, CreateView, UpdateView from apps.core.views import DefaultEditView, DefaultListView from apps.issues.models import Issue, Question, Choice class CustomerForm(forms.Form): fname = forms.CharField() lname = forms.CharField() email = forms.EmailField() phone = forms.CharField() address = forms.CharField() city = forms.CharField() postal_code = forms.CharField() class IssueListView(DefaultListView): model = Issue class IssueCreateView(CreateView): model = Issue template_name = 'core/form.html' success_url = '/manage/issues/' class IssueEditView(DefaultEditView): model = Issue def welcome(request): return render(request, "issues/welcome.html", locals()) def list_issues(request, idx=None): questions = Question.objects.filter(issue__sp_id=1) question = questions[0] dump = {} return render(request, "issues/index.html", locals()) def choose_device(request, device=None): models = products.models() return render(request, "issues/device.html", locals()) def warranty(request): return render(request, "issues/warranty.html", locals()) def customer(request): form = CustomerForm() if request.method == "POST": form = CustomerForm(request.POST) return render(request, "issues/customer.html", locals())