Question 1:

    When I removed "blank=True" from FileField ,then use below method
to upload file , but no matter whether your choosed file , the from
valid will report error "This field is required."

    How can FileField work with newform without blank=True ?

    def file_fix_callback(field, **kwargs):
    if isinstance(field, models.FileField):
        return field.formfield(widget=forms.FileInput(),**kwargs)
    else:
        return field.formfield(**kwargs)

    Form=form_for_model(model,formfield_callback=file_fix_callback)
    .............

Question 2:
    How to limit the size of upload files.


At last , thanks to the django authors . It's really a great
framework :)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to