update help_text on a reimbursement field, and count reimbursement total with the right user field

This commit is contained in:
Thomas Steen Rasmussen 2018-11-20 18:36:06 +01:00
parent 733731ecf9
commit 5e95133267
3 changed files with 22 additions and 2 deletions

View file

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

View file

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

View file

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