-
Notifications
You must be signed in to change notification settings - Fork 661
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add django-simple-history to keep track of Reimbursement changes
Fix #174 Tks @leportella
- Loading branch information
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.1 on 2017-05-28 21:55 | ||
from __future__ import unicode_literals | ||
|
||
from django.conf import settings | ||
import django.contrib.postgres.fields.jsonb | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('core', '0024_add_available_in_latest_dataset_field_to_reimbursement'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='HistoricalReimbursement', | ||
fields=[ | ||
('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')), | ||
('document_id', models.IntegerField(db_index=True, verbose_name='Document ID')), | ||
('last_update', models.DateTimeField(blank=True, db_index=True, editable=False, verbose_name='Last update')), | ||
('available_in_latest_dataset', models.BooleanField(default=True, verbose_name='Available in the latest dataset')), | ||
('year', models.IntegerField(db_index=True, verbose_name='Year')), | ||
('applicant_id', models.IntegerField(db_index=True, verbose_name='Applicant ID')), | ||
('total_reimbursement_value', models.DecimalField(blank=True, decimal_places=3, max_digits=10, null=True, verbose_name='Total reimbusrsement value')), | ||
('total_net_value', models.DecimalField(db_index=True, decimal_places=3, max_digits=10, verbose_name='Total net value')), | ||
('reimbursement_numbers', models.CharField(max_length=140, verbose_name='Reimbursement numbers')), | ||
('net_values', models.CharField(max_length=140, verbose_name='Net values')), | ||
('congressperson_id', models.IntegerField(blank=True, db_index=True, null=True, verbose_name='Congressperson ID')), | ||
('congressperson_name', models.CharField(blank=True, db_index=True, max_length=140, null=True, verbose_name='Congressperson name')), | ||
('congressperson_document', models.IntegerField(blank=True, null=True, verbose_name='Congressperson document')), | ||
('party', models.CharField(blank=True, db_index=True, max_length=7, null=True, verbose_name='Party')), | ||
('state', models.CharField(blank=True, db_index=True, max_length=2, null=True, verbose_name='State')), | ||
('term_id', models.IntegerField(blank=True, null=True, verbose_name='Term ID')), | ||
('term', models.IntegerField(blank=True, null=True, verbose_name='Term')), | ||
('subquota_id', models.IntegerField(db_index=True, verbose_name='Subquota ID')), | ||
('subquota_description', models.CharField(max_length=140, verbose_name='Subquota descrition')), | ||
('subquota_group_id', models.IntegerField(blank=True, null=True, verbose_name='Subquota group ID')), | ||
('subquota_group_description', models.CharField(blank=True, max_length=140, null=True, verbose_name='Subquota group description')), | ||
('supplier', models.CharField(max_length=140, verbose_name='Supplier')), | ||
('cnpj_cpf', models.CharField(blank=True, db_index=True, max_length=14, null=True, verbose_name='CNPJ or CPF')), | ||
('document_type', models.IntegerField(verbose_name='Document type')), | ||
('document_number', models.CharField(blank=True, max_length=140, null=True, verbose_name='Document number')), | ||
('document_value', models.DecimalField(decimal_places=3, max_digits=10, verbose_name='Document value')), | ||
('issue_date', models.DateField(verbose_name='Issue date')), | ||
('month', models.IntegerField(db_index=True, verbose_name='Month')), | ||
('remark_value', models.DecimalField(blank=True, decimal_places=3, max_digits=10, null=True, verbose_name='Remark value')), | ||
('installment', models.IntegerField(blank=True, null=True, verbose_name='Installment')), | ||
('batch_number', models.IntegerField(verbose_name='Batch number')), | ||
('reimbursement_values', models.CharField(blank=True, max_length=140, null=True, verbose_name='Reimbusrsement values')), | ||
('passenger', models.CharField(blank=True, max_length=140, null=True, verbose_name='Passenger')), | ||
('leg_of_the_trip', models.CharField(blank=True, max_length=140, null=True, verbose_name='Leg of the trip')), | ||
('probability', models.DecimalField(blank=True, decimal_places=5, max_digits=6, null=True, verbose_name='Probability')), | ||
('suspicions', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True, verbose_name='Suspicions')), | ||
('receipt_fetched', models.BooleanField(db_index=True, default=False, verbose_name='Was the receipt URL fetched?')), | ||
('receipt_url', models.CharField(blank=True, max_length=140, null=True, verbose_name='Receipt URL')), | ||
('history_id', models.AutoField(primary_key=True, serialize=False)), | ||
('history_date', models.DateTimeField()), | ||
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), | ||
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
'get_latest_by': 'history_date', | ||
'verbose_name': 'historical reimbursement', | ||
'ordering': ('-history_date', '-history_id'), | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters