Forms for nag e-mail
This commit is contained in:
parent
fcf4e5cffb
commit
051a942ffe
3 changed files with 17 additions and 4 deletions
|
@ -402,6 +402,9 @@ class InvoiceNagForm(forms.Form):
|
||||||
widget=forms.CheckboxSelectMultiple,
|
widget=forms.CheckboxSelectMultiple,
|
||||||
queryset=commerce.Invoice.objects.all(),
|
queryset=commerce.Invoice.objects.all(),
|
||||||
)
|
)
|
||||||
|
message = forms.CharField(
|
||||||
|
widget=forms.Textarea,
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, *a, **k):
|
def __init__(self, *a, **k):
|
||||||
category = k.pop('category', None) or []
|
category = k.pop('category', None) or []
|
||||||
|
@ -412,8 +415,6 @@ class InvoiceNagForm(forms.Form):
|
||||||
|
|
||||||
super(InvoiceNagForm, self).__init__(*a, **k)
|
super(InvoiceNagForm, self).__init__(*a, **k)
|
||||||
|
|
||||||
print repr(category), repr(product)
|
|
||||||
|
|
||||||
qs = commerce.Invoice.objects.filter(
|
qs = commerce.Invoice.objects.filter(
|
||||||
status=commerce.Invoice.STATUS_UNPAID,
|
status=commerce.Invoice.STATUS_UNPAID,
|
||||||
).filter(
|
).filter(
|
||||||
|
@ -421,4 +422,10 @@ class InvoiceNagForm(forms.Form):
|
||||||
Q(lineitem__product__in=product)
|
Q(lineitem__product__in=product)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Uniqify
|
||||||
|
qs = commerce.Invoice.objects.filter(
|
||||||
|
id__in=qs,
|
||||||
|
)
|
||||||
|
|
||||||
self.fields['invoice'].queryset = qs
|
self.fields['invoice'].queryset = qs
|
||||||
|
self.fields['invoice'].initial = [i.id for i in qs]
|
||||||
|
|
|
@ -152,7 +152,9 @@ class Invoice(models.Model):
|
||||||
]
|
]
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Invoice #%d" % self.id
|
return "Invoice #%d (to: %s, due: %s, value: %s)" % (
|
||||||
|
self.id, self.user.email, self.due_time, self.value
|
||||||
|
)
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if self.cart is not None and self.cart_revision is None:
|
if self.cart is not None and self.cart_revision is None:
|
||||||
|
|
|
@ -931,4 +931,8 @@ def nag_unpaid(request):
|
||||||
product=product,
|
product=product,
|
||||||
)
|
)
|
||||||
|
|
||||||
print form.fields['invoice'].queryset
|
data = {
|
||||||
|
"form": form,
|
||||||
|
}
|
||||||
|
|
||||||
|
return render(request, "registrasion/nag_unpaid.html", data)
|
||||||
|
|
Loading…
Reference in a new issue