Django Avatar field
Project description
Django-awesome-avatar is a reusable application providing Avatar model field. It allows crop selected area before saving image.
Purpose
field in profile model instead creating model for saving images
HTML5 File API instead hidden iframe AJAX for image preview
easy customizable presence (any view and widget templates)
Usage
To integrate django-awesome-avatar with your site, there are few things that are required:
Installing:
pip install django-awesome-avatar
List this application in the INSTALLED_APPS portion of your settings file. Your settings file will look something like:
INSTALLED_APPS = ( ... 'awesome_avatar', )
Add the AvatarField to your profile model:
from awesome_avatar.fields import AvatarField class Profile(Model): ... avatar = AvatarField(upload_to='avatars', width=100, height=100)
And for example, use in ModelForm:
class AvatarChangeForm(ModelForm): class Meta: model = Profile fields = ['avatar'] ... return render(request, template, {'form': AvatarChangeForm})
Global Settings
Django’s settings.py:
AWESOME_AVATAR = { 'width': 100, 'height': 100, 'select_area_width': 400, 'select_area_height': 300, 'save_quality': 90, 'save_format': 'png', ... }
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-awesome-avatar-1.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb239572b704d433eaa2652d93e747814532d147a3baa2c5c5fd25905d1208c5 |
|
MD5 | c2265a0fc28c43a925832b1f074db513 |
|
BLAKE2b-256 | 2c65d1938028cf553462fd213fcb9ade631fb9f03b932ac4a609a51304cbe3c1 |