diff --git a/counter/urls.py b/counter/urls.py index a2732925..ee478743 100644 --- a/counter/urls.py +++ b/counter/urls.py @@ -15,28 +15,16 @@ from django.urls import path -from counter.views import ( +from counter.views.admin import ( ActiveProductListView, ArchivedProductListView, - CashSummaryEditView, - CashSummaryListView, - CounterActivityView, - CounterCashSummaryView, - CounterClick, CounterCreateView, CounterDeleteView, CounterEditPropView, CounterEditView, - CounterLastOperationsView, CounterListView, - CounterMain, CounterRefillingListView, CounterStatView, - EticketCreateView, - EticketEditView, - EticketListView, - EticketPDFView, - InvoiceCallView, ProductCreateView, ProductEditView, ProductTypeCreateView, @@ -44,6 +32,24 @@ from counter.views import ( ProductTypeListView, RefillingDeleteView, SellingDeleteView, +) +from counter.views.cash import ( + CashSummaryEditView, + CashSummaryListView, + CounterCashSummaryView, +) +from counter.views.click import CounterClick +from counter.views.eticket import ( + EticketCreateView, + EticketEditView, + EticketListView, + EticketPDFView, +) +from counter.views.invoice import InvoiceCallView +from counter.views.main import ( + CounterActivityView, + CounterLastOperationsView, + CounterMain, StudentCardDeleteView, StudentCardFormView, counter_login, diff --git a/counter/views/admin.py b/counter/views/admin.py index 414e66ae..fbf466b3 100644 --- a/counter/views/admin.py +++ b/counter/views/admin.py @@ -32,6 +32,7 @@ from core.views import CanEditMixin, CanViewMixin from counter.forms import CounterEditForm, ProductEditForm from counter.models import Counter, Product, ProductType, Refilling, Selling from counter.utils import is_logged_in_counter +from counter.views.mixins import CounterAdminMixin, CounterAdminTabsMixin class CounterListView(CounterAdminTabsMixin, CanViewMixin, ListView): diff --git a/counter/views/cash.py b/counter/views/cash.py index f117a151..d4a03af1 100644 --- a/counter/views/cash.py +++ b/counter/views/cash.py @@ -32,6 +32,11 @@ from counter.models import ( Refilling, ) from counter.utils import is_logged_in_counter +from counter.views.mixins import ( + CounterAdminMixin, + CounterAdminTabsMixin, + CounterTabsMixin, +) class CashRegisterSummaryForm(forms.Form): diff --git a/counter/views/click.py b/counter/views/click.py index fe948c91..88875fe4 100644 --- a/counter/views/click.py +++ b/counter/views/click.py @@ -29,6 +29,7 @@ from django.views.generic import DetailView from core.views import CanViewMixin from counter.forms import NFCCardForm, RefillForm from counter.models import Counter, Customer, Product, Selling, StudentCard +from counter.views.mixins import CounterTabsMixin if TYPE_CHECKING: from core.models import User diff --git a/counter/views/eticket.py b/counter/views/eticket.py index 56757fc2..a05020d6 100644 --- a/counter/views/eticket.py +++ b/counter/views/eticket.py @@ -21,6 +21,7 @@ from django.views.generic.edit import CreateView, UpdateView from core.views import CanViewMixin from counter.forms import EticketForm from counter.models import Eticket, Selling +from counter.views.mixins import CounterAdminMixin, CounterAdminTabsMixin class EticketListView(CounterAdminTabsMixin, CounterAdminMixin, ListView): diff --git a/counter/views/invoice.py b/counter/views/invoice.py index 19c94c8b..dbd6e7cb 100644 --- a/counter/views/invoice.py +++ b/counter/views/invoice.py @@ -21,6 +21,7 @@ from django.views.generic import TemplateView from accounting.models import CurrencyField from counter.models import Refilling, Selling +from counter.views.mixins import CounterAdminMixin, CounterAdminTabsMixin class InvoiceCallView(CounterAdminTabsMixin, CounterAdminMixin, TemplateView): diff --git a/counter/views/main.py b/counter/views/main.py index 0f58eeda..e04f8944 100644 --- a/counter/views/main.py +++ b/counter/views/main.py @@ -12,76 +12,26 @@ # OR WITHIN THE LOCAL FILE "LICENSE" # # -import itertools -import re -from datetime import datetime, timedelta -from datetime import timezone as tz -from http import HTTPStatus -from operator import itemgetter -from typing import TYPE_CHECKING -from urllib.parse import parse_qs +from datetime import timedelta -from django import forms from django.conf import settings from django.core.exceptions import PermissionDenied -from django.db import DataError, transaction from django.db.models import F -from django.forms import CheckboxSelectMultiple -from django.forms.models import modelform_factory -from django.http import ( - Http404, - HttpRequest, - HttpResponse, - HttpResponseRedirect, - JsonResponse, -) +from django.http import HttpRequest, HttpResponseRedirect from django.shortcuts import get_object_or_404, redirect from django.urls import reverse, reverse_lazy from django.utils import timezone from django.utils.translation import gettext_lazy as _ from django.views.decorators.http import require_POST -from django.views.generic import DetailView, ListView, TemplateView -from django.views.generic.base import View -from django.views.generic.edit import ( - CreateView, - DeleteView, - FormMixin, - FormView, - ProcessFormView, - UpdateView, -) +from django.views.generic import DetailView +from django.views.generic.edit import DeleteView, FormMixin, FormView, ProcessFormView -from accounting.models import CurrencyField -from core.utils import get_semester_code, get_start_of_semester -from core.views import CanEditMixin, CanViewMixin, TabedViewMixin +from core.views import CanEditMixin, CanViewMixin from core.views.forms import LoginForm -from counter.forms import ( - CashSummaryFormBase, - CounterEditForm, - EticketForm, - GetUserForm, - NFCCardForm, - ProductEditForm, - RefillForm, - StudentCardForm, -) -from counter.models import ( - CashRegisterSummary, - CashRegisterSummaryItem, - Counter, - Customer, - Eticket, - Permanency, - Product, - ProductType, - Refilling, - Selling, - StudentCard, -) +from counter.forms import GetUserForm, StudentCardForm +from counter.models import Counter, Customer, Permanency, StudentCard from counter.utils import is_logged_in_counter - -if TYPE_CHECKING: - from core.models import User +from counter.views.mixins import CounterTabsMixin class StudentCardDeleteView(DeleteView, CanEditMixin):