Avatar django model field
Project description
=====================
django-awesome-avatar
=====================
Django-awesome-avatar is a reusable application providing Avatar model field.
It allows crop selected area before saving image.
Purpose
=======
| Unlike django-avatar_ and django-upload-avatar_
| django-awesome-avatar_ uses:
- field in profile model instead creating model for saving images
- HTML FileAPI 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:
#. ``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
===============
``settings.py``::
AWESOME_AVATAR = {
'width': 100,
'height': 100,
'select_area_width': 400,
'select_area_height': 300,
'save_quality': 90,
'save_format': 'png',
...
}
.. _django-avatar: https://github.com/jezdez/django-avatar
.. _django-upload-avatar: https://github.com/yueyoum/django-upload-avatar
.. _django-awesome-avatar: https://github.com/dimka665/django-awesome-avatar
django-awesome-avatar
=====================
Django-awesome-avatar is a reusable application providing Avatar model field.
It allows crop selected area before saving image.
Purpose
=======
| Unlike django-avatar_ and django-upload-avatar_
| django-awesome-avatar_ uses:
- field in profile model instead creating model for saving images
- HTML FileAPI 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:
#. ``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
===============
``settings.py``::
AWESOME_AVATAR = {
'width': 100,
'height': 100,
'select_area_width': 400,
'select_area_height': 300,
'save_quality': 90,
'save_format': 'png',
...
}
.. _django-avatar: https://github.com/jezdez/django-avatar
.. _django-upload-avatar: https://github.com/yueyoum/django-upload-avatar
.. _django-awesome-avatar: https://github.com/dimka665/django-awesome-avatar
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
Close
Hashes for django-awesome-avatar-1.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfb02781e62864114a0b5b04420f5ef29b576378233c6588afa7f2693dbacdb8 |
|
MD5 | f5d4a97edab5de55a191cabf5d43fa49 |
|
BLAKE2b-256 | 5fda77cb7628cb6a85ceddd577b60c114c045910df91021492cb13e85933a173 |