update help_text on a reimbursement field, and count reimbursement total with the right user field
This commit is contained in:
parent
733731ecf9
commit
5e95133267
20
src/economy/migrations/0004_auto_20181120_1835.py
Normal file
20
src/economy/migrations/0004_auto_20181120_1835.py
Normal 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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -258,7 +258,7 @@ class Reimbursement(CampRelatedModel, UUIDModel):
|
||||||
'auth.User',
|
'auth.User',
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
related_name='created_reimbursements',
|
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(
|
reimbursement_user = models.ForeignKey(
|
||||||
|
|
|
@ -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['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()
|
context['paid_reimbursement_count'] = Reimbursement.objects.filter(reimbursement_user=self.request.user, paid=True, camp=self.camp).count()
|
||||||
reimbursement_total = 0
|
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
|
reimbursement_total += reimbursement.amount
|
||||||
context['reimbursement_total'] = reimbursement_total
|
context['reimbursement_total'] = reimbursement_total
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue