Add default date for payments and refunds

This commit is contained in:
Gabriel Augendre 2017-04-10 12:12:27 +02:00
parent 316f615484
commit 4d2221eca2
No known key found for this signature in database
GPG key ID: F360212F958357D4
3 changed files with 86 additions and 2 deletions

View file

@ -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'),
),
]

View file

@ -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),
),
]

View file

@ -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)