From f0f44ffacd4e2adb4b2d4b7cb89eb69c0f192a4f Mon Sep 17 00:00:00 2001 From: jintiancang <1055391676@qq.com> Date: Wed, 19 Jun 2019 19:39:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/api/migrations/0001_initial.py | 24 ++++++++++++++++++++++++ backend/api/models.py | 12 ++++++++---- backend/api/views.py | 2 ++ backend/backend/settings.py | 1 + backend/backend/urls.py | 15 --------------- 5 files changed, 35 insertions(+), 19 deletions(-) create mode 100644 backend/api/migrations/0001_initial.py diff --git a/backend/api/migrations/0001_initial.py b/backend/api/migrations/0001_initial.py new file mode 100644 index 0000000..5bb81c6 --- /dev/null +++ b/backend/api/migrations/0001_initial.py @@ -0,0 +1,24 @@ +# Generated by Django 2.1.2 on 2019-06-19 07:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Video', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('mvurl', models.CharField(max_length=200)), + ('introduction', models.CharField(blank=True, max_length=200, null=True)), + ('vcounts', models.IntegerField(blank=True, max_length=200, null=True)), + ('title', models.CharField(max_length=200)), + ], + ), + ] diff --git a/backend/api/models.py b/backend/api/models.py index 477eaf7..daf3689 100644 --- a/backend/api/models.py +++ b/backend/api/models.py @@ -2,12 +2,16 @@ from django.db import models # Create your models here. + class Video(models.Model): # 视频地址 # 视频简介,可以为空 # 播放量,可以为空 # 视频标题 - # TODO:靳天仓 - # TODO:靳天仓,使用数据库生成mock测试数据, 例如:使用dbeaver生成mock数据 - # TODO: 馨怡, 什么是mock测试 - pass \ No newline at end of file + # TODO:靳天苍 + # TODO:靳天苍,使用数据库生成mock测试数据, 例如:使用dbeaver生成mock数据 + # TODO: 王馨怡, 什么是mock测试 + mvurl = models.CharField(max_length=200) # 视频地址 + introduction = models.CharField(max_length=200, blank=True, null=True) # 视频简介 + vcounts = models.IntegerField(max_length=200, blank=True, null=True) # 播放量 + title = models.CharField(max_length=200) # 标题 diff --git a/backend/api/views.py b/backend/api/views.py index 8f9b1b5..99c0632 100644 --- a/backend/api/views.py +++ b/backend/api/views.py @@ -34,6 +34,7 @@ class VideoListView(View): """添加一个视频信息""" pass + class Video(View): def get(self,request,pk): """获取某个资源""" @@ -47,6 +48,7 @@ class Video(View): :return:返回Json数据 """ pass + def delete(self,request,pk): """ 删除id为pk的视频资源 diff --git a/backend/backend/settings.py b/backend/backend/settings.py index b368216..53e31a8 100644 --- a/backend/backend/settings.py +++ b/backend/backend/settings.py @@ -31,6 +31,7 @@ ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ + 'api.apps.ApiConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', diff --git a/backend/backend/urls.py b/backend/backend/urls.py index 3bfc13f..4f4242c 100644 --- a/backend/backend/urls.py +++ b/backend/backend/urls.py @@ -1,18 +1,3 @@ -"""backend URL Configuration - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/2.2/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: path('', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.urls import include, path - 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) -""" from django.contrib import admin from django.urls import path from api.views import HelloView -- Gitee