You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

18 line
384 B

  1. from django import forms
  2. from django_images.models import Image
  3. FIELD_NAME_MAPPING = {
  4. 'image': 'qqfile',
  5. }
  6. class ImageForm(forms.ModelForm):
  7. def add_prefix(self, field_name):
  8. field_name = FIELD_NAME_MAPPING.get(field_name, field_name)
  9. return super(ImageForm, self).add_prefix(field_name)
  10. class Meta:
  11. model = Image
  12. fields = ('image',)