add refused relative

Brightcells 8 gadi atpakaļ
vecāks
revīzija
30d24179d9

+ 19 - 0
account/migrations/0014_lensmaninfo_refused_reason.py

@@ -0,0 +1,19 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.db import models, migrations
5
+
6
+
7
+class Migration(migrations.Migration):
8
+
9
+    dependencies = [
10
+        ('account', '0013_auto_20160711_1436'),
11
+    ]
12
+
13
+    operations = [
14
+        migrations.AddField(
15
+            model_name='lensmaninfo',
16
+            name='refused_reason',
17
+            field=models.TextField(help_text='\u5ba1\u6838\u62d2\u7edd\u539f\u56e0', null=True, verbose_name='refused_reason', blank=True),
18
+        ),
19
+    ]

+ 19 - 0
account/migrations/0015_auto_20160713_1646.py

@@ -0,0 +1,19 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.db import models, migrations
5
+
6
+
7
+class Migration(migrations.Migration):
8
+
9
+    dependencies = [
10
+        ('account', '0014_lensmaninfo_refused_reason'),
11
+    ]
12
+
13
+    operations = [
14
+        migrations.AlterField(
15
+            model_name='lensmaninfo',
16
+            name='user_status',
17
+            field=models.IntegerField(default=0, verbose_name='user_status', choices=[(-1, '\u5df2\u62d2\u7edd'), (0, '\u672a\u9a8c\u8bc1'), (1, '\u5df2\u6fc0\u6d3b'), (2, '\u5df2\u7981\u7528'), (3, '\u5df2\u5220\u9664'), (10, '\u5df2\u5206\u914d')]),
18
+        ),
19
+    ]

+ 4 - 0
account/models.py

@@ -16,6 +16,7 @@ class LensmanInfo(CreateUpdateMixin):
16 16
         (FEMALE, u'女'),
17 17
     )
18 18
 
19
+    REFUSED = -1
19 20
     UNVERIFIED = 0
20 21
     ACTIVATED = 1
21 22
     DISABLED = 2
@@ -23,6 +24,7 @@ class LensmanInfo(CreateUpdateMixin):
23 24
     ASSIGN = 10
24 25
 
25 26
     USER_STATUS = (
27
+        (REFUSED, u'已拒绝'),
26 28
         (UNVERIFIED, u'未验证'),
27 29
         (ACTIVATED, u'已激活'),
28 30
         (DISABLED, u'已禁用'),
@@ -48,6 +50,7 @@ class LensmanInfo(CreateUpdateMixin):
48 50
     balance = models.IntegerField(_(u'balance'), default=0, help_text=u'摄影师余额(分)')
49 51
 
50 52
     user_status = models.IntegerField(_(u'user_status'), choices=USER_STATUS, default=UNVERIFIED)
53
+    refused_reason = models.TextField(_(u'refused_reason'), blank=True, null=True, help_text=u'审核拒绝原因')
51 54
 
52 55
     signup_ip = models.CharField(_(u'signup_ip'), max_length=255, blank=True, null=True, help_text=_(u'注册IP'))
53 56
     login_ip = models.CharField(_(u'login_ip'), max_length=255, blank=True, null=True, help_text=_(u'登录IP'))
@@ -68,6 +71,7 @@ class LensmanInfo(CreateUpdateMixin):
68 71
             'phone': self.phone,
69 72
             'location': self.location,
70 73
             'status': self.user_status,
74
+            'refused_reason': self.refused_reason,
71 75
         }
72 76
 
73 77
 

+ 1 - 1
group/lensman_views.py

@@ -48,7 +48,7 @@ def lensman_submit_api(request):
48 48
 
49 49
     lensman, created = LensmanInfo.objects.get_or_create(unionid=unionid, defaults=fields)
50 50
     # 状态为 UNVERIFIED 的允许修改, 其他需要登录摄影师 APP 进行信息的修改
51
-    if lensman.user_status != LensmanInfo.UNVERIFIED:
51
+    if lensman.user_status not in [LensmanInfo.UNVERIFIED, LensmanInfo.REFUSED]:
52 52
         return response(LensmanStatusCode.LENSMAN_ALREADY_NOT_UNVERIFIED)
53 53
     if not created:
54 54
         for key, value in fields.iteritems():

+ 14 - 0
page/templates/page/lensman_oauth.html

@@ -61,6 +61,7 @@
61 61
                         <p>状态</p>
62 62
                     </div>
63 63
                     <div class="weui_cell_ft">
64
+                        {% ifequal lensman_info.status -1 %}已拒绝{% endifequal %}
64 65
                         {% ifequal lensman_info.status 0 %}审核中{% endifequal %}
65 66
                         {% ifequal lensman_info.status 1 %}已激活{% endifequal %}
66 67
                         {% ifequal lensman_info.status 2 %}已禁用{% endifequal %}
@@ -70,6 +71,18 @@
70 71
             </div>
71 72
             {% endif %}
72 73
 
74
+
75
+            {% ifequal lensman_info.status -1 %}
76
+            <div class="weui_cells_title">拒绝原因</div>
77
+            <div class="weui_cells">
78
+                <div class="weui_panel_bd">
79
+                    <div class="weui_media_box weui_media_text">
80
+                        <p class="weui_media_desc">{{ lensman_info.refused_reason|safe|linebreaks }}</p>
81
+                    </div>
82
+                </div>
83
+            </div>
84
+            {% endifequal %}
85
+
73 86
             <br>
74 87
 
75 88
             {% if modified %}<button id="submit" class="weui_btn weui_btn_warn">确认</button>{% endif %}
@@ -155,6 +168,7 @@
155 168
                                     setTimeout(function () {
156 169
                                         $('#toast').hide();
157 170
                                     }, 1000);
171
+                                    window.location.reload();
158 172
                                 } else {
159 173
                                     show_error_dialog('错误', data.description);
160 174
                                 }

+ 1 - 1
page/views.py

@@ -23,5 +23,5 @@ def lensman_oauth(request):
23 23
 
24 24
     return render(request, 'page/lensman_oauth.html', {
25 25
         'lensman_info': lensman and lensman.data,
26
-        'modified': bool((not lensman) or (lensman and lensman.user_status == LensmanInfo.UNVERIFIED)),  # 是否可以更改信息
26
+        'modified': bool((not lensman) or (lensman and lensman.user_status in [LensmanInfo.UNVERIFIED, LensmanInfo.REFUSED])),  # 是否可以更改信息
27 27
     })