Commit bcae7bea authored by ibuler's avatar ibuler

upload avatar

parent 93530226
...@@ -131,3 +131,4 @@ STATICFILES_DIRS = ( ...@@ -131,3 +131,4 @@ STATICFILES_DIRS = (
AUTH_USER_MODEL = 'users.User' AUTH_USER_MODEL = 'users.User'
BOOTSTRAP_COLUMN_COUNT = 11 BOOTSTRAP_COLUMN_COUNT = 11
MEDIA_ROOT = os.path.join(BASE_DIR, 'img').replace('\\', '/') + '/'
...@@ -10,7 +10,7 @@ class UserForm(ModelForm): ...@@ -10,7 +10,7 @@ class UserForm(ModelForm):
class Meta: class Meta:
model = User model = User
fields = [ fields = [
'username', 'name', 'email', 'groups', 'wechat', 'username', 'name', 'email', 'groups', 'wechat', 'avatar',
'phone', 'enable_2FA', 'role', 'date_expired', 'comment', 'phone', 'enable_2FA', 'role', 'date_expired', 'comment',
] ]
# widgets = { # widgets = {
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-16 16:32
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0005_auto_20160816_1358'),
('users', '0005_auto_20160816_2252'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-16 16:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0006_merge_20160817_0032'),
]
operations = [
migrations.AlterField(
model_name='user',
name='avatar',
field=models.ImageField(blank=True, upload_to='avatar', verbose_name='\u5934\u50cf'),
),
]
...@@ -61,7 +61,7 @@ class User(AbstractUser): ...@@ -61,7 +61,7 @@ class User(AbstractUser):
name = models.CharField(max_length=20, verbose_name='姓名', help_text='* required') name = models.CharField(max_length=20, verbose_name='姓名', help_text='* required')
email = models.EmailField(max_length=30, unique=True, verbose_name='邮件', help_text='* required') email = models.EmailField(max_length=30, unique=True, verbose_name='邮件', help_text='* required')
groups = models.ManyToManyField(UserGroup, verbose_name='用户组') groups = models.ManyToManyField(UserGroup, verbose_name='用户组')
avatar = models.ImageField(verbose_name='头像', blank=True) avatar = models.ImageField(upload_to="avatar", verbose_name='头像', blank=True)
wechat = models.CharField(max_length=30, blank=True, verbose_name='微信') wechat = models.CharField(max_length=30, blank=True, verbose_name='微信')
phone = models.CharField(max_length=20, blank=True, verbose_name='手机号') phone = models.CharField(max_length=20, blank=True, verbose_name='手机号')
enable_2FA = models.BooleanField(default=False, verbose_name='启用二次验证') enable_2FA = models.BooleanField(default=False, verbose_name='启用二次验证')
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
</div> </div>
<div class="hr-line-dashed"></div> <div class="hr-line-dashed"></div>
<h3>信息</h3> <h3>信息</h3>
{{ form.avatar|bootstrap_horizontal }}
{{ form.phone|bootstrap_horizontal }} {{ form.phone|bootstrap_horizontal }}
{{ form.wechat|bootstrap_horizontal }} {{ form.wechat|bootstrap_horizontal }}
{{ form.comment|bootstrap_horizontal }} {{ form.comment|bootstrap_horizontal }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment