made cleaner migrations for loans
This commit is contained in:
parent
474083dd38
commit
67c64c0d1c
5 changed files with 33 additions and 36 deletions
|
@ -1,5 +1,6 @@
|
||||||
# Generated by Django 4.2.8 on 2024-04-30 15:24
|
# Generated by Django 4.2.8 on 2024-05-02 09:30
|
||||||
|
|
||||||
|
import autoslug.fields
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
@ -7,7 +8,6 @@ import django.db.models.deletion
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('loans', '0002_abstractloan_delete_loan'),
|
|
||||||
('inventory', '0002_duration_range'),
|
('inventory', '0002_duration_range'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -15,9 +15,18 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='GameLoan',
|
name='GameLoan',
|
||||||
fields=[
|
fields=[
|
||||||
('abstractloan_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='loans.abstractloan')),
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='lent_object', unique=True)),
|
||||||
|
('borrow_date', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('return_date', models.DateTimeField(null=True)),
|
||||||
|
('mail', models.EmailField(max_length=254)),
|
||||||
('lent_object', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventory.game', verbose_name='jeu emprunté')),
|
('lent_object', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventory.game', verbose_name='jeu emprunté')),
|
||||||
],
|
],
|
||||||
bases=('loans.abstractloan',),
|
options={
|
||||||
|
'verbose_name': 'emprunt',
|
||||||
|
'verbose_name_plural': 'emprunts',
|
||||||
|
'ordering': ['borrow_date'],
|
||||||
|
'abstract': False,
|
||||||
|
},
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -159,3 +159,6 @@ class GameLoan(AbstractLoan):
|
||||||
Game, on_delete=models.CASCADE,
|
Game, on_delete=models.CASCADE,
|
||||||
verbose_name="jeu emprunté"
|
verbose_name="jeu emprunté"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class Meta(AbstractLoan.Meta):
|
||||||
|
abstract = False
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
# Generated by Django 4.2.8 on 2024-04-30 15:24
|
|
||||||
|
|
||||||
import autoslug.fields
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('loans', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='AbstractLoan',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='game', unique=True)),
|
|
||||||
('borrow_date', models.DateTimeField(auto_now_add=True)),
|
|
||||||
('return_date', models.DateTimeField(null=True)),
|
|
||||||
('mail', models.EmailField(max_length=254)),
|
|
||||||
],
|
|
||||||
options={
|
|
||||||
'verbose_name': 'emprunt',
|
|
||||||
'verbose_name_plural': 'emprunts',
|
|
||||||
'ordering': ['borrow_date'],
|
|
||||||
},
|
|
||||||
),
|
|
||||||
migrations.DeleteModel(
|
|
||||||
name='Loan',
|
|
||||||
),
|
|
||||||
]
|
|
16
loans/migrations/0002_delete_loan.py
Normal file
16
loans/migrations/0002_delete_loan.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Generated by Django 4.2.8 on 2024-05-02 09:30
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('loans', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='Loan',
|
||||||
|
),
|
||||||
|
]
|
|
@ -12,6 +12,7 @@ class AbstractLoan(models.Model):
|
||||||
lent_object_slug_field = "slug"
|
lent_object_slug_field = "slug"
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
abstract = True
|
||||||
ordering=["borrow_date"]
|
ordering=["borrow_date"]
|
||||||
verbose_name = "emprunt"
|
verbose_name = "emprunt"
|
||||||
verbose_name_plural = "emprunts"
|
verbose_name_plural = "emprunts"
|
||||||
|
|
Loading…
Reference in a new issue