refactor: split models into modules, remove template-based views, and clean up code style
- Split monolithic models.py into models/ package (customers, products, sales, payments, admin) - Removed forms.py, all HTML templates, and associated template-based views - Added api/ package with CatalogSaleView placeholder - Updated all imports across project to use new model paths - Removed obsolete tests (form, export, purchase, summary tests) - Removed template-based URL patterns, kept only API endpoints - Standardized string quotes (single to double) and reformatted code
This commit is contained in:
@@ -4,39 +4,55 @@ from rest_framework.routers import DefaultRouter
|
||||
from . import views
|
||||
from . import api_views
|
||||
|
||||
app_name = 'don_confiao'
|
||||
app_name = "don_confiao"
|
||||
|
||||
router = DefaultRouter()
|
||||
router.register(r'sales', api_views.SaleView, basename='sale')
|
||||
router.register(r'customers', api_views.CustomerView, basename='customer')
|
||||
router.register(r'products', api_views.ProductView, basename='product')
|
||||
router.register(r'reconciliate_jar', api_views.ReconciliateJarModelView,
|
||||
basename='reconciliate_jar')
|
||||
router.register(r"sales", api_views.SaleView, basename="sale")
|
||||
router.register(r"customers", api_views.CustomerView, basename="customer")
|
||||
router.register(r"products", api_views.ProductView, basename="product")
|
||||
router.register(
|
||||
r"reconciliate_jar",
|
||||
api_views.ReconciliateJarModelView,
|
||||
basename="reconciliate_jar",
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.index, name="wellcome"),
|
||||
path("comprar", views.buy, name="buy"),
|
||||
path("compras", views.purchases, name="purchases"),
|
||||
path("productos", views.products, name="products"),
|
||||
path("lista_productos", views.ProductListView.as_view(), name='product_list'),
|
||||
path("importar_productos", views.import_products, name="import_products"),
|
||||
path('api/importar_productos_de_tryton',
|
||||
api_views.ProductsFromTrytonView.as_view(),
|
||||
name="products_from_tryton"),
|
||||
path("importar_terceros", views.import_customers, name="import_customers"),
|
||||
path('api/importar_clientes_de_tryton',
|
||||
api_views.CustomersFromTrytonView.as_view(),
|
||||
name="customers_from_tryton"),
|
||||
path("exportar_ventas_para_tryton",
|
||||
views.exportar_ventas_para_tryton,
|
||||
name="exportar_ventas_para_tryton"),
|
||||
path('api/enviar_ventas_a_tryton', api_views.SalesToTrytonView.as_view(), name="send_tryton"),
|
||||
path("resumen_compra/<int:id>", views.purchase_summary, name="purchase_summary"),
|
||||
path("resumen_compra_json/<int:id>", api_views.SaleSummary.as_view(), name="purchase_json_summary"),
|
||||
path("payment_methods/all/select_format", api_views.PaymentMethodView.as_view(), name="payment_methods_to_select"),
|
||||
path('purchases/for_reconciliation', api_views.SalesForReconciliationView.as_view(), name='sales_for_reconciliation'),
|
||||
path('reconciliate_jar', api_views.ReconciliateJarView.as_view()),
|
||||
path('api/admin_code/validate/<code>', api_views.AdminCodeValidateView.as_view()),
|
||||
path('api/sales/for_tryton', api_views.SalesForTrytonView.as_view()),
|
||||
path('api/', include(router.urls)),
|
||||
path(
|
||||
"resumen_compra_json/<int:id>",
|
||||
api_views.SaleSummary.as_view(),
|
||||
name="purchase_json_summary",
|
||||
),
|
||||
path("api/", include(router.urls)),
|
||||
path(
|
||||
"api/importar_productos_de_tryton",
|
||||
api_views.ProductsFromTrytonView.as_view(),
|
||||
name="products_from_tryton",
|
||||
),
|
||||
path(
|
||||
"api/importar_clientes_de_tryton",
|
||||
api_views.CustomersFromTrytonView.as_view(),
|
||||
name="customers_from_tryton",
|
||||
),
|
||||
path(
|
||||
"api/enviar_ventas_a_tryton",
|
||||
api_views.SalesToTrytonView.as_view(),
|
||||
name="send_tryton",
|
||||
),
|
||||
path(
|
||||
"payment_methods/all/select_format",
|
||||
api_views.PaymentMethodView.as_view(),
|
||||
name="payment_methods_to_select",
|
||||
),
|
||||
path(
|
||||
"purchases/for_reconciliation",
|
||||
api_views.SalesForReconciliationView.as_view(),
|
||||
name="sales_for_reconciliation",
|
||||
),
|
||||
path("reconciliate_jar", api_views.ReconciliateJarView.as_view()),
|
||||
path(
|
||||
"api/admin_code/validate/<code>",
|
||||
api_views.AdminCodeValidateView.as_view(),
|
||||
),
|
||||
path("api/sales/for_tryton", api_views.SalesForTrytonView.as_view()),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user