Commit 49d4782c by attiyaishaque Committed by Attiya Ishaque

change one condition in price validation.

parent fa2466f4
......@@ -440,7 +440,7 @@ class SeatForm(BaseForm):
credit_price = self.cleaned_data.get('credit_price')
seat_type = self.cleaned_data.get('type')
if seat_type != Seat.AUDIT and price is not None and price < 0.01:
if seat_type != Seat.AUDIT and price and price < 0.01:
self.add_error('price', _('Price must be greater than or equal to 0.01'))
if seat_type in [Seat.PROFESSIONAL, Seat.VERIFIED, Seat.CREDIT] and not price:
......@@ -505,7 +505,7 @@ class CourseEntitlementForm(BaseForm):
mode = cleaned_data.get('mode')
price = cleaned_data.get('price')
if mode in [CourseEntitlement.VERIFIED, CourseEntitlement.PROFESSIONAL] and price is not None and price < 0.01:
if mode in [CourseEntitlement.VERIFIED, CourseEntitlement.PROFESSIONAL] and price and price < 0.01:
self.add_error('price', _('Price must be greater than or equal to 0.01'))
if mode in [CourseEntitlement.VERIFIED, CourseEntitlement.PROFESSIONAL] and not price:
self.add_error('price', _('Only audit seat can be without price.'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment