From 4d2221eca288b56783b090d169834b749608d3d9 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Mon, 10 Apr 2017 12:12:27 +0200 Subject: [PATCH] Add default date for payments and refunds --- .../migrations/0003_auto_20170410_1208.py | 61 +++++++++++++++++++ .../migrations/0004_auto_20170410_1209.py | 21 +++++++ refunding/models.py | 6 +- 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 refunding/migrations/0003_auto_20170410_1208.py create mode 100644 refunding/migrations/0004_auto_20170410_1209.py diff --git a/refunding/migrations/0003_auto_20170410_1208.py b/refunding/migrations/0003_auto_20170410_1208.py new file mode 100644 index 0000000..29f8bfc --- /dev/null +++ b/refunding/migrations/0003_auto_20170410_1208.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2017-04-10 10:08 +from __future__ import unicode_literals + +import datetime +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('refunding', '0002_auto_20160604_0140'), + ] + + operations = [ + migrations.AlterModelOptions( + name='payment', + options={'verbose_name': 'paiement', 'verbose_name_plural': 'paiements'}, + ), + migrations.AlterModelOptions( + name='refund', + options={'verbose_name': 'remboursement', 'verbose_name_plural': 'remboursements'}, + ), + migrations.AlterField( + model_name='payment', + name='date', + field=models.DateField(default=datetime.date.today), + ), + migrations.AlterField( + model_name='payment', + name='refund', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='refunding.Refund', verbose_name='remboursement'), + ), + migrations.AlterField( + model_name='payment', + name='title', + field=models.CharField(max_length=100, verbose_name='titre'), + ), + migrations.AlterField( + model_name='payment', + name='user', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, verbose_name='utilisateur'), + ), + migrations.AlterField( + model_name='payment', + name='value', + field=models.IntegerField(verbose_name='valeur'), + ), + migrations.AlterField( + model_name='refund', + name='title', + field=models.CharField(max_length=100, verbose_name='titre'), + ), + migrations.AlterField( + model_name='refund', + name='user', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, verbose_name='utilisateur'), + ), + ] diff --git a/refunding/migrations/0004_auto_20170410_1209.py b/refunding/migrations/0004_auto_20170410_1209.py new file mode 100644 index 0000000..52849a3 --- /dev/null +++ b/refunding/migrations/0004_auto_20170410_1209.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2017-04-10 10:09 +from __future__ import unicode_literals + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('refunding', '0003_auto_20170410_1208'), + ] + + operations = [ + migrations.AlterField( + model_name='refund', + name='date', + field=models.DateField(default=datetime.date.today), + ), + ] diff --git a/refunding/models.py b/refunding/models.py index 7385f2f..e7313ae 100644 --- a/refunding/models.py +++ b/refunding/models.py @@ -1,3 +1,5 @@ +import datetime + from django.db import models from django.conf import settings from django.db.models import Sum @@ -14,7 +16,7 @@ class Refund(models.Model): verbose_name_plural = 'remboursements' title = models.CharField(max_length=100, verbose_name='titre') - date = models.DateField() + date = models.DateField(default=datetime.date.today) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) user = models.ForeignKey( @@ -41,7 +43,7 @@ class Payment(models.Model): verbose_name_plural = 'paiements' title = models.CharField(max_length=100, verbose_name='titre') - date = models.DateField() + date = models.DateField(default=datetime.date.today) value = models.IntegerField(verbose_name='valeur') created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True)