diff --git a/proyecto/__pycache__/__init__.cpython-314.pyc b/proyecto/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index 8250ca7..0000000 Binary files a/proyecto/__pycache__/__init__.cpython-314.pyc and /dev/null differ diff --git a/proyecto/__pycache__/settings.cpython-314.pyc b/proyecto/__pycache__/settings.cpython-314.pyc deleted file mode 100644 index 3cb5057..0000000 Binary files a/proyecto/__pycache__/settings.cpython-314.pyc and /dev/null differ diff --git a/proyecto/__pycache__/urls.cpython-314.pyc b/proyecto/__pycache__/urls.cpython-314.pyc deleted file mode 100644 index 658ce21..0000000 Binary files a/proyecto/__pycache__/urls.cpython-314.pyc and /dev/null differ diff --git a/proyecto/__pycache__/wsgi.cpython-314.pyc b/proyecto/__pycache__/wsgi.cpython-314.pyc deleted file mode 100644 index dd040cd..0000000 Binary files a/proyecto/__pycache__/wsgi.cpython-314.pyc and /dev/null differ diff --git a/tienda/__pycache__/__init__.cpython-314.pyc b/tienda/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index f69534a..0000000 Binary files a/tienda/__pycache__/__init__.cpython-314.pyc and /dev/null differ diff --git a/tienda/__pycache__/admin.cpython-314.pyc b/tienda/__pycache__/admin.cpython-314.pyc deleted file mode 100644 index bf9e0c8..0000000 Binary files a/tienda/__pycache__/admin.cpython-314.pyc and /dev/null differ diff --git a/tienda/__pycache__/apps.cpython-314.pyc b/tienda/__pycache__/apps.cpython-314.pyc deleted file mode 100644 index 9082874..0000000 Binary files a/tienda/__pycache__/apps.cpython-314.pyc and /dev/null differ diff --git a/tienda/__pycache__/context_processors.cpython-314.pyc b/tienda/__pycache__/context_processors.cpython-314.pyc deleted file mode 100644 index 0643b39..0000000 Binary files a/tienda/__pycache__/context_processors.cpython-314.pyc and /dev/null differ diff --git a/tienda/__pycache__/models.cpython-314.pyc b/tienda/__pycache__/models.cpython-314.pyc deleted file mode 100644 index 664bcdd..0000000 Binary files a/tienda/__pycache__/models.cpython-314.pyc and /dev/null differ diff --git a/tienda/__pycache__/urls.cpython-314.pyc b/tienda/__pycache__/urls.cpython-314.pyc deleted file mode 100644 index bcd2369..0000000 Binary files a/tienda/__pycache__/urls.cpython-314.pyc and /dev/null differ diff --git a/tienda/__pycache__/vars.cpython-314.pyc b/tienda/__pycache__/vars.cpython-314.pyc deleted file mode 100644 index 1507f0c..0000000 Binary files a/tienda/__pycache__/vars.cpython-314.pyc and /dev/null differ diff --git a/tienda/__pycache__/views.cpython-314.pyc b/tienda/__pycache__/views.cpython-314.pyc deleted file mode 100644 index 30f8c67..0000000 Binary files a/tienda/__pycache__/views.cpython-314.pyc and /dev/null differ diff --git a/tienda/migrations/0004_product_stock_stockreservation_stockreservationitem.py b/tienda/migrations/0004_product_stock_stockreservation_stockreservationitem.py new file mode 100644 index 0000000..1782119 --- /dev/null +++ b/tienda/migrations/0004_product_stock_stockreservation_stockreservationitem.py @@ -0,0 +1,45 @@ +# Generated by Django 6.0.1 on 2026-04-09 06:55 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('tienda', '0003_order_transaction_code'), + ] + + operations = [ + migrations.AddField( + model_name='product', + name='stock', + field=models.PositiveIntegerField(default=0), + ), + migrations.CreateModel( + name='StockReservation', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('session_key', models.CharField(blank=True, max_length=40, null=True)), + ('status', models.CharField(choices=[('active', 'Activa'), ('completed', 'Completada'), ('cancelled', 'Cancelada'), ('expired', 'Expirada')], default='active', max_length=20)), + ('payment_method', models.CharField(choices=[('stripe', 'Stripe'), ('paypal', 'PayPal')], max_length=20)), + ('expires_at', models.DateTimeField(db_index=True)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='stock_reservations', to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='StockReservationItem', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('quantity', models.PositiveIntegerField(default=1)), + ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='stock_reservation_items', to='tienda.product')), + ('reservation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='tienda.stockreservation')), + ], + options={ + 'unique_together': {('reservation', 'product')}, + }, + ), + ] diff --git a/tienda/migrations/__pycache__/0001_initial.cpython-314.pyc b/tienda/migrations/__pycache__/0001_initial.cpython-314.pyc deleted file mode 100644 index 4fa3f99..0000000 Binary files a/tienda/migrations/__pycache__/0001_initial.cpython-314.pyc and /dev/null differ diff --git a/tienda/migrations/__pycache__/0002_verificationcode_code_mode_and_more.cpython-314.pyc b/tienda/migrations/__pycache__/0002_verificationcode_code_mode_and_more.cpython-314.pyc deleted file mode 100644 index 6d2093c..0000000 Binary files a/tienda/migrations/__pycache__/0002_verificationcode_code_mode_and_more.cpython-314.pyc and /dev/null differ diff --git a/tienda/migrations/__pycache__/__init__.cpython-314.pyc b/tienda/migrations/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index ef4a82c..0000000 Binary files a/tienda/migrations/__pycache__/__init__.cpython-314.pyc and /dev/null differ diff --git a/tienda/templates/tienda/cart.html b/tienda/templates/tienda/cart.html index 0938f61..bcde235 100644 --- a/tienda/templates/tienda/cart.html +++ b/tienda/templates/tienda/cart.html @@ -12,6 +12,17 @@ {% if cart_items %}
| Producto | Precio (sin IVA) | Cantidad | +Stock | Subtotal (con IVA) | Acciones | @@ -39,10 +51,17 @@+ | + {% if item.product.stock > 0 %} + {{ item.product.stock }} + {% else %} + 0 + {% endif %} + | {{ item.get_subtotal_with_vat|format_price }} € |
|---|