Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.

Commit ac24cd6

Browse files
committed
Merge branch 'develop'
2 parents 03b809b + 0caf290 commit ac24cd6

File tree

11 files changed

+238
-523
lines changed

11 files changed

+238
-523
lines changed

README.md

+46-23
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,57 @@
11
<div align="center">
22

3-
# 新冠肺炎实时接口 {docsify-ignore}
4-
5-
<!-- Place this tag where you want the button to render. -->
6-
<a class="github-button" href="https://github.com/leafcoder/django-covid19/subscription" data-color-scheme="no-preference: light; light: light; dark: dark;" data-show-count="true" aria-label="Watch leafcoder/django-covid19 on GitHub">
7-
<img alt="GitHub forks" src="https://img.shields.io/github/watchers/leafcoder/django-covid19?style=social">
8-
</a>
9-
<a class="github-button" href="https://github.com/leafcoder/django-covid19" data-color-scheme="no-preference: light; light: light; dark: dark;" data-show-count="true" aria-label="Star leafcoder/django-covid19 on GitHub">
10-
<img alt="GitHub forks" src="https://img.shields.io/github/stars/leafcoder/django-covid19?style=social">
11-
</a>
12-
<a class="github-button" href="https://github.com/leafcoder/django-covid19/fork" data-color-scheme="no-preference: light; light: light; dark: dark;" data-show-count="true" aria-label="Fork leafcoder/django-covid19 on GitHub">
13-
<img alt="GitHub forks" src="https://img.shields.io/github/forks/leafcoder/django-covid19?style=social">
14-
</a>
15-
16-
![GitHub release (latest by date)](https://img.shields.io/github/v/release/leafcoder/django-covid19)
17-
![GitHub top language](https://img.shields.io/github/languages/top/leafcoder/django-covid19)
18-
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/leafcoder/django-covid19)
19-
![GitHub commit activity](https://img.shields.io/github/commit-activity/w/leafcoder/django-covid19)
20-
![GitHub All Releases](https://img.shields.io/github/downloads/leafcoder/django-covid19/total)
3+
# 新冠肺炎实时接口
4+
5+
<p>
6+
<!-- Place this tag where you want the button to render. -->
7+
<a class="github-button" href="https://github.com/leafcoder/django-covid19/subscription" data-color-scheme="no-preference: light; light: light; dark: dark;" data-show-count="true" aria-label="Watch leafcoder/django-covid19 on GitHub">
8+
<img alt="GitHub forks" src="https://img.shields.io/github/watchers/leafcoder/django-covid19?style=social">
9+
</a>
10+
<a class="github-button" href="https://github.com/leafcoder/django-covid19" data-color-scheme="no-preference: light; light: light; dark: dark;" data-show-count="true" aria-label="Star leafcoder/django-covid19 on GitHub">
11+
<img alt="GitHub forks" src="https://img.shields.io/github/stars/leafcoder/django-covid19?style=social">
12+
</a>
13+
<a class="github-button" href="https://github.com/leafcoder/django-covid19/fork" data-color-scheme="no-preference: light; light: light; dark: dark;" data-show-count="true" aria-label="Fork leafcoder/django-covid19 on GitHub">
14+
<img alt="GitHub forks" src="https://img.shields.io/github/forks/leafcoder/django-covid19?style=social">
15+
</a>
16+
</p>
17+
18+
<p>
19+
<img src="https://img.shields.io/github/v/release/leafcoder/django-covid19" data-origin="https://img.shields.io/github/v/release/leafcoder/django-covid19" alt="GitHub release (latest by date)">
20+
<img src="https://img.shields.io/github/languages/top/leafcoder/django-covid19" data-origin="https://img.shields.io/github/languages/top/leafcoder/django-covid19" alt="GitHub top language">
21+
<img src="https://img.shields.io/github/languages/code-size/leafcoder/django-covid19" data-origin="https://img.shields.io/github/languages/code-size/leafcoder/django-covid19" alt="GitHub code size in bytes">
22+
<img src="https://img.shields.io/github/commit-activity/w/leafcoder/django-covid19" data-origin="https://img.shields.io/github/commit-activity/w/leafcoder/django-covid19" alt="GitHub commit activity">
23+
<img src="https://img.shields.io/github/downloads/leafcoder/django-covid19/total" data-origin="https://img.shields.io/github/downloads/leafcoder/django-covid19/total" alt="GitHub All Releases">
24+
</p>
2125

2226
</div>
2327

24-
# 接口文档
28+
# 项目文档
2529

26-
点击查看 [在线接口文档](https://blog.leafcoder.cn/django-covid19/)
30+
本项目使用开源文档工具 [docsify](https://docsify.js.org) 编写了一份开发文档。
31+
32+
文档将如何安装部署本项目作了详细的描述,开发者可根据自身需求搭建一个属于个人
33+
*新冠肺炎实时接口*,并通过项目提供的爬虫工具实时、定时的更新疫情数据,追踪
34+
疫情的最新情况。
35+
36+
如果开发者本身没有个人的云服务器用来部署本项目,也可以直接调用本项目已部署好
37+
的实时接口,可用于科研、娱乐、教学等各方面。
38+
39+
[![在线文档](docs/images/docs.png)](http://111.231.75.86:8000/docs/)
2740

2841
# 在线大屏
2942

30-
点击查看 [在线数据大屏](http://111.231.75.86/dashboard)
43+
根据已部署的疫情在线接口,并结合使用开源数据大屏项目中的示例代码,本项目提
44+
供了一个使用本项目接口的数据大屏示例。
45+
46+
[![在线数据大屏](docs/images/dashboard.png)](http://111.231.75.86/dashboard)
47+
48+
# 问题相关
49+
50+
有任何问题欢迎在 github 中提 issue,或者在文档页面的最后提交[评论](http://111.231.75.86:8000/docs/#/?id=detail-1),我会尽快解答。
51+
52+
* 推荐使用评论方式提问;
53+
* 推荐使用 isuss 提交 bug;
3154

32-
# 文档预览
55+
# 致各位
3356

34-
![图片](docs/images/docs.png)
57+
如果本项目对你有所帮助,请在[此处](http://111.231.75.86:8000/docs/#/?id=detail-1)留下你的项目地址。

docs/README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@
2626
本项目的数据来源为[`丁香园`](http://ncov.dxy.cn/ncovh5/view/pneumonia),定时获取疫
2727
情数据,保存疫情数据变更情况,以备跟踪研究和数据图表化展示。
2828

29+
# 快速开始 :id=quick-start
30+
31+
请按照以下步骤完成项目的初始化和启动。
32+
33+
!> 注意:请先修改 covid19/settings.py 中 `SCRAPY_CMD`,设置为 scrapy 命令完整路径。
34+
否则,自动更新任务将无法正常运行
35+
2936
## 代码仓库
3037

3138
项目开源,需要源代码可以前往仓库自行获取。
3239

3340
[前往获取源码](https://github.com/leafcoder/django-covid19)
3441

35-
# 线上示例
42+
## 线上示例
3643

3744
使用本项目的接口开发了一个数据大屏的示例页面,代码在项目根目录的 `demo/` 文件夹中。
3845

3946
前往在线示例 [新冠肺炎实时数据大屏](http://111.231.75.86/dashboard)
4047

41-
# 快速开始 :id=quick-start
42-
43-
请按照以下步骤完成项目的初始化和启动。
44-
45-
!> 注意:请先修改 covid19/settings.py 中 `SCRAPY_CMD`,设置为 scrapy 命令完整路径。
46-
否则,自动更新任务将无法正常运行
47-
4848
## 源码下载 :id=download
4949

5050
可以通过 `git clone` 直接将 `master` 分支的代码克隆到本机使用;

docs/images/dashboard.png

267 KB
Loading

ncovapi/admin.py

+3-56
Original file line numberDiff line numberDiff line change
@@ -18,67 +18,14 @@ class BaseAdmin(admin.ModelAdmin):
1818
preserve_filters = True
1919

2020

21-
@admin.register(models.Crawler)
22-
class CrawlerAdmin(BaseAdmin):
23-
24-
list_display = (
25-
'id', 'crawlTime', 'createTime', 'modifyTime'
26-
)
27-
28-
2921
@admin.register(models.Statistics)
3022
class StatisticsAdmin(BaseAdmin):
3123

3224
list_display = (
33-
'id', 'countryType', 'seriousCount', 'currentConfirmedCount',
34-
'confirmedCount', 'suspectedCount', 'curedCount', 'deadCount'
35-
)
36-
search_fields = ('crawler_id', )
37-
list_filter = ('countryType', )
38-
39-
40-
@admin.register(models.Notice)
41-
class NoticeAdmin(BaseAdmin):
42-
43-
list_display = (
44-
'id', 'crawler', 'remarks', 'notes', 'generalRemark'
25+
'globalStatistics', 'domesticStatistics', 'internationalStatistics',
26+
'modifyTime', 'createTime', 'crawlTime'
4527
)
46-
47-
@admin.register(models.WHOArticle)
48-
class WHOArticleAdmin(BaseAdmin):
49-
50-
list_display = ('id', 'title', 'linkUrl', 'imgUrl')
51-
52-
@admin.register(models.Recommend)
53-
class RecommendAdmin(BaseAdmin):
54-
55-
list_display = (
56-
'id', 'title', 'linkUrl', 'imgUrl', 'contentType',
57-
'countryType', 'recordStatus')
58-
59-
@admin.register(models.Timeline)
60-
class TimelineAdmin(BaseAdmin):
61-
62-
list_display = (
63-
'id', 'title', 'summary', 'pubDateStr', 'infoSource', 'sourceUrl')
64-
65-
@admin.register(models.Wiki)
66-
class WikiAdmin(BaseAdmin):
67-
68-
list_display = ('id', 'title', 'linkUrl', 'imgUrl', 'description')
69-
70-
@admin.register(models.GoodsGuide)
71-
class GoodsGuideAdmin(BaseAdmin):
72-
73-
list_display = (
74-
'categoryName', 'title', 'recordStatus', 'contentImgUrls')
75-
76-
@admin.register(models.Rumor)
77-
class RumorAdmin(BaseAdmin):
78-
79-
list_display = (
80-
'title', 'mainSummary', 'summary', 'body',
81-
'sourceUrl', 'score', 'rumorType')
28+
search_fields = ('crawlTime', 'modifyTime')
8229

8330
@admin.register(models.City)
8431
class CityAdmin(BaseAdmin):

ncovapi/filters.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,21 @@ class CityFilter(django_filters.rest_framework.FilterSet):
1111

1212
provinceShortNames = CharInFilter(
1313
field_name='province__provinceShortName', lookup_expr='in')
14+
provinceNames = CharInFilter(
15+
field_name='province__provinceName', lookup_expr='in')
1416
cityNames = CharInFilter(
1517
field_name='cityName', lookup_expr='in')
18+
19+
provinceShortName = django_filters.CharFilter(
20+
field_name='province__provinceShortName', lookup_expr='exact')
21+
provinceName = django_filters.CharFilter(
22+
field_name='province__provinceName', lookup_expr='exact')
23+
cityName = django_filters.CharFilter(
24+
field_name='cityName', lookup_expr='exact')
1625

1726
class Meta:
1827
model = City
19-
fields = ['provinceShortNames', 'cityName']
28+
fields = ['provinceShortName', 'provinceName', 'cityName']
2029

2130

2231
class ProvinceFilter(django_filters.rest_framework.FilterSet):
@@ -26,6 +35,11 @@ class ProvinceFilter(django_filters.rest_framework.FilterSet):
2635
provinceNames = CharInFilter(
2736
field_name='provinceName', lookup_expr='in')
2837

38+
provinceShortName = django_filters.CharFilter(
39+
field_name='provinceShortName', lookup_expr='exact')
40+
provinceName = django_filters.CharFilter(
41+
field_name='provinceName', lookup_expr='exact')
42+
2943
class Meta:
3044
model = Province
3145
fields = ['provinceName', 'provinceShortName']

0 commit comments

Comments
 (0)