All checks were successful
Build and Push Docker Image / build (push) Successful in 51s
- Implemented `Favorite` model with unique user-item constraint and timestamped records - Added `favorites:index` and `favorites:toggle` views with AJAX support for toggling favorites - Built templates and front-end assets for the favorites page and integration with item grids - Extended header with favorites link and dynamic counter - Added tests covering models, views, and templates for the favorites functionality - Updated admin to enable management of favorites via Django admin interface
34 lines
1.4 KiB
Python
34 lines
1.4 KiB
Python
# Generated by Django 6.0.4 on 2026-05-10 17:49
|
|
|
|
import django.db.models.deletion
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
('items', '0003_subcategory_item_subcategory_and_more'),
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='Favorite',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Дата добавления')),
|
|
('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='favorite_entries', to='items.item', verbose_name='Товар')),
|
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='favorite_entries', to=settings.AUTH_USER_MODEL, verbose_name='Пользователь')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Избранный товар',
|
|
'verbose_name_plural': 'Избранные товары',
|
|
'ordering': ('-created_at', '-id'),
|
|
'constraints': [models.UniqueConstraint(fields=('user', 'item'), name='unique_favorite_user_item')],
|
|
},
|
|
),
|
|
]
|