1
0

3 Commity 6ac651f4a1 ... ab33fd79ef

Autor SHA1 Správa Dátum
  DYaiu ab33fd79ef payment的后端使用ModelViewSet加反序列化 4 rokov pred
  DYaiu ee897d1662 payment建model与表 4 rokov pred
  DYaiu 391c110eef 人大预算功能开发之payment初始化 4 rokov pred

+ 2 - 1
my_project/settings.py

@@ -40,7 +40,8 @@ INSTALLED_APPS = [
     'workreport',
     'mptt',
     'workTtree',
-    'treeAndTable'
+    'treeAndTable',
+    'payment'
 ]
 
 MIDDLEWARE = [

+ 2 - 1
my_project/urls.py

@@ -21,5 +21,6 @@ urlpatterns = [
     path('admin/', admin.site.urls),
     url(r'^', include('workreport.urls')),
     url(r'^', include('workTtree.urls')),
-    url(r'^treeAndTable/', include('treeAndTable.urls'))
+    url(r'^treeAndTable/', include('treeAndTable.urls')),
+    url(r'^payment/',include('payment.urls'))
 ]

+ 0 - 0
payment/__init__.py


+ 3 - 0
payment/admin.py

@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.

+ 5 - 0
payment/apps.py

@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class PaymentConfig(AppConfig):
+    name = 'payment'

+ 32 - 0
payment/migrations/0001_initial.py

@@ -0,0 +1,32 @@
+# Generated by Django 3.0.8 on 2020-07-28 08:10
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    initial = True
+
+    dependencies = [
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='Payment',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('payment_type', models.CharField(max_length=100)),
+                ('price_type', models.CharField(max_length=100)),
+                ('item_type', models.CharField(max_length=100)),
+                ('index_type', models.CharField(max_length=100)),
+                ('index_price', models.IntegerField()),
+                ('year', models.CharField(max_length=4)),
+                ('month', models.CharField(max_length=2)),
+            ],
+            options={
+                'verbose_name': '支出报表',
+                'verbose_name_plural': '支出报表列表',
+                'db_table': 'pay',
+            },
+        ),
+    ]

+ 0 - 0
payment/migrations/__init__.py


+ 17 - 0
payment/models.py

@@ -0,0 +1,17 @@
+from django.db import models
+
+
+class Payment(models.Model):
+    payment_type = models.CharField(max_length=100)
+    price_type = models.CharField(max_length=100)
+    item_type = models.CharField(max_length=100)
+    index_type = models.CharField(max_length=100)
+    index_price = models.IntegerField()
+    year = models.CharField(max_length=4)
+    month = models.CharField(max_length=2)
+
+    class Meta:
+        app_label = "payment"
+        db_table = "pay"
+        verbose_name = "支出报表"
+        verbose_name_plural = "支出报表列表"

+ 11 - 0
payment/serializer.py

@@ -0,0 +1,11 @@
+from rest_framework import serializers
+from rest_framework.serializers import ListSerializer
+
+from payment.models import Payment
+
+
+class PaymentSerializer(serializers.ModelSerializer):
+    class Meta:
+        model = Payment
+        list_serializer = ListSerializer
+        fields = '__all__'

+ 3 - 0
payment/tests.py

@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.

+ 11 - 0
payment/urls.py

@@ -0,0 +1,11 @@
+from rest_framework_bulk.routes import BulkRouter
+
+from payment.views import PaymentView
+
+router = BulkRouter()
+router.register(r'payment', PaymentView)
+
+urlpatterns = router.urls
+
+urlpatterns += [
+]

+ 10 - 0
payment/views.py

@@ -0,0 +1,10 @@
+from rest_framework.viewsets import ModelViewSet
+
+from payment.models import Payment
+from payment.serializer import PaymentSerializer
+
+
+class PaymentView(ModelViewSet):
+    queryset = Payment.objects.all()
+    serializer_class = PaymentSerializer
+    pagination_class = None