This is a common case in django ORM.
from django.db import models
class Author(models.Model):| """Allows checking of form POST data as well as uploaded files when validating | |
| a standard Django `forms.Form`. | |
| The short version is that you check `Form().files` in the `clean()` method, | |
| assuming the form has been bound to the request. | |
| See: | |
| http://mattoc.com/django-handle-form-validation-with-combined-post-and-files-data/ | |
| """ |
| # -*- coding: utf-8 -*- | |
| import Image | |
| def resize_and_crop(img_path, modified_path, size, crop_type='top'): | |
| """ | |
| Resize and crop an image to fit the specified size. | |
| args: | |
| img_path: path for the image to resize. |