diff --git a/db.sqlite3 b/db.sqlite3 index b29fe98..df7b118 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/tienda/__pycache__/models.cpython-314.pyc b/tienda/__pycache__/models.cpython-314.pyc index 873d098..d30e9f6 100644 Binary files a/tienda/__pycache__/models.cpython-314.pyc and b/tienda/__pycache__/models.cpython-314.pyc differ diff --git a/tienda/__pycache__/views.cpython-314.pyc b/tienda/__pycache__/views.cpython-314.pyc index e574ad6..af53977 100644 Binary files a/tienda/__pycache__/views.cpython-314.pyc and b/tienda/__pycache__/views.cpython-314.pyc differ diff --git a/tienda/migrations/0012_image_alt_shippingaddress.py b/tienda/migrations/0012_image_alt_shippingaddress.py new file mode 100644 index 0000000..d6e0f4e --- /dev/null +++ b/tienda/migrations/0012_image_alt_shippingaddress.py @@ -0,0 +1,43 @@ +# Generated by Django 6.0.1 on 2026-02-16 11:57 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('tienda', '0011_ordermessage'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.AddField( + model_name='image', + name='alt', + field=models.CharField(blank=True, default='', max_length=255, verbose_name='Texto alternativo'), + ), + migrations.CreateModel( + name='ShippingAddress', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('full_name', models.CharField(max_length=200, verbose_name='Nombre completo')), + ('address_line_1', models.CharField(max_length=250, verbose_name='Dirección')), + ('address_line_2', models.CharField(blank=True, max_length=250, verbose_name='Dirección (línea 2)')), + ('city', models.CharField(max_length=100, verbose_name='Ciudad')), + ('postal_code', models.CharField(max_length=20, verbose_name='Código postal')), + ('country', models.CharField(default='España', max_length=100, verbose_name='País')), + ('phone', models.CharField(max_length=20, verbose_name='Teléfono')), + ('is_default', models.BooleanField(default=False, verbose_name='Dirección predeterminada')), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='shipping_addresses', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'verbose_name': 'Dirección de envío', + 'verbose_name_plural': 'Direcciones de envío', + 'ordering': ['-is_default', '-created_at'], + }, + ), + ] diff --git a/tienda/migrations/__pycache__/0012_image_alt_shippingaddress.cpython-314.pyc b/tienda/migrations/__pycache__/0012_image_alt_shippingaddress.cpython-314.pyc new file mode 100644 index 0000000..31f3562 Binary files /dev/null and b/tienda/migrations/__pycache__/0012_image_alt_shippingaddress.cpython-314.pyc differ diff --git a/tienda/models.py b/tienda/models.py index e46bc19..7eddd51 100644 --- a/tienda/models.py +++ b/tienda/models.py @@ -12,6 +12,7 @@ class Category(models.Model): class Image(models.Model): name = models.CharField(max_length=200, default="") image = models.ImageField(upload_to='images/') + alt = models.CharField(max_length=255, default="", blank=True, verbose_name="Texto alternativo") def __str__(self): return self.name diff --git a/tienda/templates/tienda/base.html b/tienda/templates/tienda/base.html index 729283e..e6a162d 100644 --- a/tienda/templates/tienda/base.html +++ b/tienda/templates/tienda/base.html @@ -1,7 +1,7 @@ {% load static %} {% load compress %} - + @@ -102,7 +102,7 @@ {% if user.is_authenticated %} Panel Vendedor - {{ user.first_name|default:user.username }} + {{ user.first_name|default:user.username }} Cerrar Sesión {% else %} Iniciar Sesión diff --git a/tienda/templates/tienda/cart.html b/tienda/templates/tienda/cart.html index 7d36ea1..0938f61 100644 --- a/tienda/templates/tienda/cart.html +++ b/tienda/templates/tienda/cart.html @@ -30,7 +30,7 @@
{% if item.product.primary_image %} - {{ item.product.name }} + {{ item.product.primary_image.alt|default:item.product.name }} {% endif %} {{ item.product.name }}
diff --git a/tienda/templates/tienda/home.html b/tienda/templates/tienda/home.html index 7086467..427250d 100644 --- a/tienda/templates/tienda/home.html +++ b/tienda/templates/tienda/home.html @@ -156,7 +156,7 @@
{% if product.primary_image %} - {{ product.name }} + {{ product.primary_image.alt|default:product.name }} {% else %}
Sin imagen @@ -164,7 +164,7 @@ {% endif %}
-
{{ product.name }}
+

{{ product.name }}

{% if product.briefdesc %}

{{ product.briefdesc|truncatewords:10 }}

diff --git a/tienda/templates/tienda/index.html b/tienda/templates/tienda/index.html index fd5d4d3..8aecd0e 100644 --- a/tienda/templates/tienda/index.html +++ b/tienda/templates/tienda/index.html @@ -18,9 +18,9 @@ {% if products %} {% for producto in products %}
- {{ producto.name }} + {{ producto.primary_image.alt|default:producto.name }}
-
{{ producto.name }}
+

{{ producto.name }}

Sin IVA: €{{ producto.price|format_price }}

IVA incl: €{{ producto.get_price_with_vat|format_price }}

diff --git a/tienda/templates/tienda/mis_productos.html b/tienda/templates/tienda/mis_productos.html index 9a740e8..ba8bbb5 100644 --- a/tienda/templates/tienda/mis_productos.html +++ b/tienda/templates/tienda/mis_productos.html @@ -39,7 +39,7 @@ {% if producto.primary_image %} - {{ producto.name }} + {{ producto.primary_image.alt|default:producto.name }} {% else %}
Sin diff --git a/tienda/templates/tienda/producto.html b/tienda/templates/tienda/producto.html index 75428a4..47b136c 100644 --- a/tienda/templates/tienda/producto.html +++ b/tienda/templates/tienda/producto.html @@ -7,11 +7,11 @@