양선아

5/24 update

1 +# Generated by Django 3.0.6 on 2020-05-20 09:19
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0003_auto_20200518_1332'),
10 + ]
11 +
12 + operations = [
13 + migrations.CreateModel(
14 + name='Maps',
15 + fields=[
16 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
17 + ('mapdata', models.TextField()),
18 + ],
19 + ),
20 + ]
1 +# Generated by Django 3.0.6 on 2020-05-22 05:18
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0004_maps'),
10 + ]
11 +
12 + operations = [
13 + migrations.CreateModel(
14 + name='RT_agri_policy',
15 + fields=[
16 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
17 + ('city', models.CharField(max_length=7)),
18 + ('cntr', models.CharField(max_length=7)),
19 + ('plcy_name', models.CharField(max_length=50)),
20 + ('plcy_condition', models.TextField()),
21 + ('plcy_content', models.TextField()),
22 + ('plcy_condition_detail', models.TextField()),
23 + ('plcy_document', models.TextField()),
24 + ('plcy_amount', models.TextField()),
25 + ('plcy_contact', models.CharField(max_length=60)),
26 + ],
27 + ),
28 + ]
1 +# Generated by Django 3.0.6 on 2020-05-22 06:10
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0005_rt_agri_policy'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='rt_agri_policy',
15 + name='plcy_amount',
16 + field=models.TextField(blank=True),
17 + ),
18 + migrations.AlterField(
19 + model_name='rt_agri_policy',
20 + name='plcy_condition_detail',
21 + field=models.TextField(blank=True),
22 + ),
23 + migrations.AlterField(
24 + model_name='rt_agri_policy',
25 + name='plcy_content',
26 + field=models.TextField(blank=True),
27 + ),
28 + migrations.AlterField(
29 + model_name='rt_agri_policy',
30 + name='plcy_document',
31 + field=models.TextField(blank=True),
32 + ),
33 + ]
1 +# Generated by Django 3.0.6 on 2020-05-22 06:10
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0006_auto_20200522_1510'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='rt_agri_policy',
15 + name='plcy_contact',
16 + field=models.CharField(blank=True, max_length=60),
17 + ),
18 + ]
1 +# Generated by Django 3.0.6 on 2020-05-22 06:13
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0007_auto_20200522_1510'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='rt_agri_policy',
15 + name='plcy_amount',
16 + field=models.TextField(null=True),
17 + ),
18 + migrations.AlterField(
19 + model_name='rt_agri_policy',
20 + name='plcy_condition_detail',
21 + field=models.TextField(null=True),
22 + ),
23 + migrations.AlterField(
24 + model_name='rt_agri_policy',
25 + name='plcy_contact',
26 + field=models.CharField(max_length=60, null=True),
27 + ),
28 + migrations.AlterField(
29 + model_name='rt_agri_policy',
30 + name='plcy_content',
31 + field=models.TextField(null=True),
32 + ),
33 + migrations.AlterField(
34 + model_name='rt_agri_policy',
35 + name='plcy_document',
36 + field=models.TextField(null=True),
37 + ),
38 + ]
1 +# Generated by Django 3.0.6 on 2020-05-22 06:14
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('market_analysis', '0008_auto_20200522_1513'),
10 + ]
11 +
12 + operations = [
13 + migrations.AlterField(
14 + model_name='rt_agri_policy',
15 + name='plcy_contact',
16 + field=models.TextField(null=True),
17 + ),
18 + ]
...@@ -11,3 +11,17 @@ class RT_edu(models.Model): ...@@ -11,3 +11,17 @@ class RT_edu(models.Model):
11 edu_end = models.DateField() 11 edu_end = models.DateField()
12 edu_time = models.IntegerField() 12 edu_time = models.IntegerField()
13 edu_infocall = models.CharField(max_length=30) 13 edu_infocall = models.CharField(max_length=30)
14 +
15 +class Maps(models.Model):
16 + mapdata = models.TextField()
17 +
18 +class RT_agri_policy(models.Model):
19 + city = models.CharField(max_length=7)
20 + cntr = models.CharField(max_length=7)
21 + plcy_name = models.CharField(max_length=50)
22 + plcy_condition = models.TextField()
23 + plcy_content = models.TextField(null=True)
24 + plcy_condition_detail = models.TextField(null=True)
25 + plcy_document = models.TextField(null=True)
26 + plcy_amount = models.TextField(null=True)
27 + plcy_contact = models.TextField(null=True)
...\ No newline at end of file ...\ No newline at end of file
......
1 +<html>
2 + <head>
3 + <!-- link에 들어가 있는건 지도 데이터를 위한 css 파일 -->
4 + <!-- script에 들어가 있는건 지도 데이터를 위한 js 파일 -->
5 + <!-- 직접 다운받아 넣을 수도 있는데 우선은 그냥 웹에서 불러올 수 있도록 해놨다. -->
6 + <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" />
7 + <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script>
8 + <!--css 내용 여기에 direct로 넣었다-->
9 + <style>
10 + #mapbase {position:relative; width:50%; height:0;padding-bottom:60%; }
11 + </style>
12 + </head>
13 +
14 + <body>
15 +
16 + {%for data in exportdata%}
17 + <p>{{data.cntr}}</p>
18 + {%endfor%}
19 +
20 + <div id="mapbase"></div>
21 +
22 + <script type="text/javascript">
23 + // map 객체 생성 map안에 넣어주는건 div id
24 + // 위도, 경도, zoom 수준
25 + var map = L.map('mapbase').setView([36.5205243,128.0540569], 7);
26 + // tilelayer를 씌우는 작업 OSM을 사용했음
27 + L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
28 + attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
29 + maxZoom: 10,
30 + id: 'mapbox/light-v9',
31 + tileSize: 512,
32 + zoomOffset:-1,
33 + accessToken: 'pk.eyJ1IjoidGpzZGszMTA1IiwiYSI6ImNrYWM5bXljZzB1N28ycnA5bTVsNHZsbnkifQ.W3-irWof5WMR8BcfBR4Ftw'
34 + }).addTo(map);
35 +
36 + // mapdata 가져오는 부분
37 + var statesData = "{{maps}}".replace(/&quot;/g,"\"");
38 +
39 + statesData = JSON.parse(statesData);
40 +
41 + // replace 쓰는 방법 : (바꾸기 전 문자, 바꾸고 난 후 문자)
42 + // density data 추가하는 부분
43 + var densitydata = "{{exportdata}}".replace(/&#x27;/g,"\"");
44 + densitydata = densitydata.slice(13,-4);
45 + densitydata = JSON.parse(densitydata);
46 +
47 + document.write(densitydata);
48 +
49 + for(var i =0; i<densitydata.length; i++)
50 + {
51 + for(var j=0; j<statesData.features.length; j++)
52 + {
53 + if (statesData.features[j]['properties']['SIG_KOR_NM'].indexOf(densitydata[i]['cntr'])==0)
54 + {
55 + statesData.features[j]['properties']['density']=densitydata[i]['count'];
56 + break;
57 + }
58 + }
59 + };
60 +
61 + function getColor(d) {
62 + return d > 30 ? '#800026' :
63 + d > 25 ? '#BD0026' :
64 + d > 20 ? '#E31A1C' :
65 + d > 15 ? '#FC4E2A' :
66 + d > 10 ? '#FD8D3C' :
67 + d > 5 ? '#FEB24C' :
68 + d > 0 ? '#FED976' :
69 + '#FFEDA0';
70 + }
71 + function style(feature) {
72 + return {
73 + fillColor: getColor(feature.properties.density),
74 + weight: 2,
75 + opacity: 1,
76 + color: 'white',
77 + dashArray: '3',
78 + fillOpacity: 0.7
79 + };
80 + }
81 + L.geoJson(statesData, {style: style}).addTo(map);
82 + </script>
83 + </body>
84 +</html>
...\ No newline at end of file ...\ No newline at end of file
...@@ -2,5 +2,5 @@ from django.conf.urls import url ...@@ -2,5 +2,5 @@ from django.conf.urls import url
2 from . import views 2 from . import views
3 3
4 urlpatterns = [ 4 urlpatterns = [
5 - url('edulist', views.edulist), 5 + url('maplist', views.maplist),
6 ] 6 ]
...\ No newline at end of file ...\ No newline at end of file
......
1 from django.shortcuts import render 1 from django.shortcuts import render
2 from django.db.models import Count 2 from django.db.models import Count
3 -from .models import RT_edu 3 +from .models import RT_edu, Maps, RT_agri_policy
4 4
5 -# Create your views here. 5 +# Create your views here.
6 6
7 -def edulist(request): 7 +def dbselect(dbnameis):
8 - educations = RT_edu.objects.values('city').annotate(ct=Count('city')) 8 + if dbnameis=='agri':
9 - context = {'educations': educations} 9 + policys = RT_agri_policy.objects.values('cntr').annotate(count=Count('cntr'))
10 - return render(request, 'edulist.html', context) 10 + return policys
11 + elif dbnameis=='normal':
12 + educations = RT_edu.objects.values(city='city').annotate(count=Count('city'))
13 + return educations
14 +
15 +
16 +def maplist(request):
17 + mapp = Maps.objects.get(id=10)
18 + mapp = mapp.mapdata
19 + exportdatas = dbselect('agri')
20 + context = {'exportdata': exportdatas, 'maps':mapp}
21 + return render(request, 'maplist.html', context)
......
No preview for this file type
No preview for this file type
1 +[LocalizedFileNames]
2 +전국+도매시장+경락가격(정산)+속성.xlsx=@전국+도매시장+경락가격(정산)+속성.xlsx,0
No preview for this file type
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
1 +http://data.fips.go.kr/openapi/service/ManageAcst0110Service/getAcst0110List?ServiceKey=3mibghQYDy9KNoH%2BWImJj0eZKQPaAvjq3GQ3ikImZtw4ds3uaWIPBhVJLzdmvnOZjdm100CbRBOOcCV6iPGxfw%3D%3D&numOfRows=10&pageNo=1&fromDt=20200510&toDt=20200510
...\ No newline at end of file ...\ No newline at end of file
1 +Sub 매크로2()
2 +'
3 +' 매크로2 매크로
4 +'
5 +' 바로 가기 키: Ctrl+Shift+Q
6 +'
7 + Columns("R:R").Select
8 + Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
9 + Columns("S:S").Select
10 + Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
11 + Columns("T:T").Select
12 + Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
13 + Columns("Q:Q").Select
14 + Selection.TextToColumns Destination:=Range("Q1"), DataType:=xlDelimited, _
15 + TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
16 + Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
17 + :=Array(Array(1, 1), Array(2, 1), Array(3, 1)), TrailingMinusNumbers:=True
18 + Columns("T:T").Select
19 + Selection.ClearContents
20 + Range("Q1").Select
21 + Selection.AutoFilter
22 + ActiveSheet.Range("$A$1:$S$29462").AutoFilter Field:=17, Criteria1:=Array( _
23 + "노르웨이", "뉴질랜드", "대만", "러시아", "말레이지아", "멕시코", "미국", "미얀마", "바레인", "베네주엘라", "베트남", "세네갈", _
24 + "수입산", "아르헨티나", "에쿠아도르", "오만", "인도네시아", "인디아", "일본", "중국", "칠레", "카나다", "콜롬비아", "태국", _
25 + "태평양산", "통가", "페루", "포클랜드", "필리핀", "한국", "호주", "="), Operator:=xlFilterValues
26 + Columns("R:R").Select
27 + Selection.ClearContents
28 + ActiveSheet.Range("$A$1:$S$29462").AutoFilter Field:=17
29 + Range("T2").Select
30 + ActiveCell.FormulaR1C1 = _
31 + "=IF(RC[-3]=RC[-2],RC[-1],IF(ISBLANK(RC[-2]),RC[-3],RC[-2]))"
32 + Range("T2").Select
33 + Selection.AutoFill Destination:=Range("T2:T29462")
34 + Range("T2:T29462").Select
35 + Range("T6").Select
36 + Selection.End(xlDown).Select
37 + Selection.End(xlUp).Select
38 + Columns("T:T").Select
39 + Selection.Copy
40 + Range("Z1").Select
41 + Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
42 + :=False, Transpose:=False
43 + Columns("R:T").Select
44 + Range("T1").Activate
45 + Application.CutCopyMode = False
46 + Selection.ClearContents
47 + Columns("S:T").Select
48 + Selection.Delete Shift:=xlToLeft
49 + Columns("X:X").Select
50 + Selection.Cut
51 + Range("R1").Select
52 + ActiveSheet.Paste
53 +End Sub
1 +select city, count(*) as cnt from market_analysis_rt_edu group by city;
2 +
3 +select city, avg(edu_time) from market_analysis_rt_edu group by city;
4 +
5 +
6 + L.tileLayer('https://api.maptiler.com/maps/positron/{z}/{x}/{y}.png?key=IHLiEj11tKzE3WCyeanP',{
7 + id : 'mapbox/light-v9',
8 + tilesize: 512,
9 + attribution: '<a href="https://www.maptiler.com/copyright/" target="_blank">&copy; MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a>',
10 + zoomOffset: -1
11 + }).addTo(map)
...\ No newline at end of file ...\ No newline at end of file
django-leaflet @ 56e46ff5
1 +Subproject commit 56e46ff5c9f564beb700215b260d33344b48db26