소스 검색

客户报备

hujingpei 4 년 전
부모
커밋
f2f1af7361
8개의 변경된 파일16개의 추가작업 그리고 7개의 파일을 삭제
  1. 0 0
      apps/customer/__init__.py
  2. 0 0
      apps/customer/filters.py
  3. 6 3
      apps/customer/models.py
  4. 0 0
      apps/customer/serializers.py
  5. 7 1
      apps/customer/urls.py
  6. 1 1
      apps/customer/views.py
  7. 1 1
      decorate/settings.py
  8. 1 1
      decorate/urls.py

+ 0 - 0
apps/new_customer/customer/__init__.py → apps/customer/__init__.py


+ 0 - 0
apps/new_customer/customer/filters.py → apps/customer/filters.py


+ 6 - 3
apps/new_customer/customer/models.py → apps/customer/models.py

@@ -2,6 +2,8 @@
 from django.db import models
 from django.conf import settings
 
+from apps.option.models import Option
+
 
 class Customer(models.Model):
     NOT_CHECKED = 0
@@ -19,9 +21,10 @@ class Customer(models.Model):
                                               default=settings.MALE)
     village = models.CharField(max_length=100,verbose_name=u'小区')
     address = models.CharField(max_length=100,verbose_name=u'地址')
-    source = models.CharField(max_length=100,verbose_name=u'来源')
-
-    # project = models.ForeignKey('',max_length=20, verbose_name=u'项目', null=True)
+    source = models.ForeignKey(Option,max_length=100,verbose_name=u'来源',related_name='customer_source',
+                               on_delete=models.PROTECT,null=True)
+    project = models.ForeignKey(Option,max_length=100, verbose_name=u'项目',related_name='customer_category',
+                                on_delete=models.PROTECT,null=True)
     notes = models.CharField(max_length=500, verbose_name=u"备注", null=True)
     report_status = models.PositiveSmallIntegerField(choices=STATUS_CHOICES, verbose_name=u'报备状态',default=NOT_CHECKED)
     check_user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=u'审核人',related_name='customer_check_user',

+ 0 - 0
apps/new_customer/customer/serializers.py → apps/customer/serializers.py


+ 7 - 1
apps/new_customer/customer/urls.py → apps/customer/urls.py

@@ -4,10 +4,16 @@ from rest_framework.routers import SimpleRouter
 
 from .views import CustomerViewSet
 
+from django.conf.urls import url, include
+from rest_framework.routers import SimpleRouter
+
+from .views import CustomerViewSet
+
+
 urlpatterns = [
 
 ]
 
 router = SimpleRouter()
 router.register(r'', CustomerViewSet)
-urlpatterns += router.urls
+urlpatterns += router.urls

+ 1 - 1
apps/new_customer/customer/views.py → apps/customer/views.py

@@ -38,7 +38,7 @@ class CustomerViewSet(CustomModelViewSet):
         super(CustomerViewSet, self).destroy(self, request, *args, **kwargs)
         return response_ok()
 
-    @action(methods=['post'], detail=True)
+    @action(methods=['post'], detail=False)
     def check(self, request, pk):
         # 审核
         report_status = request.POST.get('report_status')

+ 1 - 1
decorate/settings.py

@@ -48,7 +48,7 @@ INSTALLED_APPS = [
     'apps.api',
     'apps.upload',
     'apps.agent',
-    'apps.new_customer',
+    'apps.customer',
     'apps.option',
 
 ]

+ 1 - 1
decorate/urls.py

@@ -25,7 +25,7 @@ urlpatterns = [
     url(r'^$', index),
     url(r'^account/', include('apps.account.urls')),
     url(r'^api/', include('apps.api.urls')),
-    url(r'^new_customer/', include('apps.new_customer.urls')),
+    url(r'^customer/', include('apps.customer.urls')),
     url(r'^option/', include('apps.option.urls')),
 ]