+from django.core.exceptions import ValidationError
+from django.db.models import Q
import django.forms
import django.forms.widgets
from django.forms.widgets import TextInput
del self.fields['upsell_target']
self.update_protected_fields()
+ def clean_cost(self):
+ if self.instance and self.instance.cost != self.cleaned_data['cost']:
+ if self.instance.conferenceregistration_set.filter(Q(payconfirmedat__isnull=False)|Q(invoice__isnull=False)|Q(bulkpayment__isnull=False)).exists():
+ raise ValidationError("This registration type has been used, so the cost can no longer be changed")
+
+ return self.cleaned_data['cost']
class BackendRegistrationDayForm(BackendForm):
list_fields = [ 'day', ]