def __init__(self, *args, **kwargs): _EditSettingsForm.__init__(self, *args, **kwargs) self.tier = SiteTierInfo.objects.get_current().tier if not self.tier.custom_css: # Uh-oh: custom CSS is not permitted! # # To handle only letting certain paid users edit CSS, # we do two things. # # 1. Cosmetically, we set the CSS editing box's CSS class # to be 'hidden'. (We have some CSS that makes it not show # up.) SB: Not sure why we don't just remove the field... css_field = self.fields['css'] css_field.label += ' (upgrade to enable this form field)' css_field.widget.attrs['readonly'] = True
def __init__(self, *args, **kwargs): _EditSettingsForm.__init__(self, *args, **kwargs) tier_info = self.tier_info = TierInfo.objects.get_current() if (tier_info.enforce_tiers() and not tier_info.get_tier().permit_custom_css()): # Uh-oh: custom CSS is not permitted! # # To handle only letting certain paid users edit CSS, # we do two things. # # 1. Cosmetically, we set the CSS editing box's CSS class # to be 'hidden'. (We have some CSS that makes it not show # up.) css_field = self.fields['css'] css_field.label += ' (upgrade to enable this form field)' css_field.widget.attrs['readonly'] = True