Ticket #2374: templatevalidator.diff
File templatevalidator.diff, 1.2 KB (added by , 18 years ago) |
---|
-
django/contrib/admin/views/template.py
22 22 new_data = request.POST.copy() 23 23 errors = manipulator.get_validation_errors(new_data) 24 24 if not errors: 25 request.user. add_message('The template is valid.')25 request.user.message_set.create(message='The template is valid.') 26 26 return render_to_response('admin/template_validator.html', { 27 27 'title': 'Template validator', 28 28 'form': forms.FormWrapper(manipulator, new_data, errors), … … 32 32 class TemplateValidator(forms.Manipulator): 33 33 def __init__(self, settings_modules): 34 34 self.settings_modules = settings_modules 35 site_list = Site.objects. get_in_bulk(settings_modules.keys()).values()35 site_list = Site.objects.in_bulk(settings_modules.keys()).values() 36 36 self.fields = ( 37 37 forms.SelectField('site', is_required=True, choices=[(s.id, s.name) for s in site_list]), 38 38 forms.LargeTextField('template', is_required=True, rows=25, validator_list=[self.isValidTemplate]),