from django import forms from rbac import models from django.utils.safestring import mark_safe ############safe#################3 class MenuModuleForm(forms.ModelForm): class Meta: model = models.Menu fields="__all__" error_messages={ 'title': { 'required': "该字段不能为空!" }, 'icon':{ 'required':"必须选择图标!" } } widgets={ 'title':forms.TextInput(attrs={'class':'form-control'}), 'icon':forms.RadioSelect(choices=[ #######RadioSelect ==》 列表套列表 ['fa-address-book-o',mark_safe('<i class="fa fa-address-book-o" aria-hidden="true"></i>')],#########标记安全 ['fa-id-card-o',mark_safe('<i class="fa fa-id-card-o" aria-hidden="true"></i>')], ['fa-free-code-camp',mark_safe('<i class="fa fa-free-code-camp" aria-hidden="true"></i>')], ['fa-etsy fa-6',mark_safe('<i class="fa fa-etsy fa-6" aria-hidden="true"></i>')], ['fa-battery-2',mark_safe('<i class="fa fa-battery-2" aria-hidden="true"></i>')], ['fa-automobile',mark_safe('<i class="fa fa-automobile" aria-hidden="true"></i>')], ]) }