From 5e951332673ae4b98e1ddfa032b972536479cf4b Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Tue, 20 Nov 2018 18:36:06 +0100 Subject: [PATCH] update help_text on a reimbursement field, and count reimbursement total with the right user field --- .../migrations/0004_auto_20181120_1835.py | 20 +++++++++++++++++++ src/economy/models.py | 2 +- src/economy/views.py | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 src/economy/migrations/0004_auto_20181120_1835.py diff --git a/src/economy/migrations/0004_auto_20181120_1835.py b/src/economy/migrations/0004_auto_20181120_1835.py new file mode 100644 index 00000000..bfc9c5b6 --- /dev/null +++ b/src/economy/migrations/0004_auto_20181120_1835.py @@ -0,0 +1,20 @@ +# Generated by Django 2.1.3 on 2018-11-20 17:35 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('economy', '0003_auto_20180917_1933'), + ] + + operations = [ + migrations.AlterField( + model_name='reimbursement', + name='user', + field=models.ForeignKey(help_text='The economy team member who created this reimbursement.', on_delete=django.db.models.deletion.PROTECT, related_name='created_reimbursements', to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/src/economy/models.py b/src/economy/models.py index 531d0033..794fbbb9 100644 --- a/src/economy/models.py +++ b/src/economy/models.py @@ -258,7 +258,7 @@ class Reimbursement(CampRelatedModel, UUIDModel): 'auth.User', on_delete=models.PROTECT, related_name='created_reimbursements', - help_text='The user who created this reimbursement.' + help_text='The economy team member who created this reimbursement.' ) reimbursement_user = models.ForeignKey( diff --git a/src/economy/views.py b/src/economy/views.py index bc50f3b0..cfac40e0 100644 --- a/src/economy/views.py +++ b/src/economy/views.py @@ -33,7 +33,7 @@ class EconomyDashboardView(LoginRequiredMixin, CampViewMixin, TemplateView): context['unpaid_reimbursement_count'] = Reimbursement.objects.filter(reimbursement_user=self.request.user, paid=False, camp=self.camp).count() context['paid_reimbursement_count'] = Reimbursement.objects.filter(reimbursement_user=self.request.user, paid=True, camp=self.camp).count() reimbursement_total = 0 - for reimbursement in Reimbursement.objects.filter(user=self.request.user, camp=self.camp): + for reimbursement in Reimbursement.objects.filter(reimbursement_user=self.request.user, camp=self.camp): reimbursement_total += reimbursement.amount context['reimbursement_total'] = reimbursement_total