-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Update view based on model structure
- Loading branch information
Showing
4 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<h1>{{region.dong_name}}의 집값 추이는?</h1> | ||
|
||
<ul> | ||
<li> | ||
<p>{{biggest_increase}}은 00%로 가장 많이 오른 지역입니다.</p> | ||
<p>{{biggest_decrease}}은 00%로 가장 많이 떨어진 지역입니다.</p> | ||
</li> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<head></head> | ||
<body> | ||
<h1>주택 실거래 가격</h1> | ||
<h3>우리 동네에서 실거래가 변화가 가장 큰 곳은 어디일까?</h3> | ||
|
||
<div class="search-dropdown"> | ||
<p>드롭다운 검색창 위치</p> | ||
</div> | ||
<div class="map"> | ||
<p>지도 위치</p> | ||
</div> | ||
<div> | ||
<p>지역 리스트 위치</p> | ||
{% if regions %} | ||
<ul> | ||
{% for region in regions %} | ||
<li> | ||
<a href="{% url 'trades:detail' region.id %}" | ||
>{{region.dong_name}}</a | ||
> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{%else%} | ||
<p>no regions</p> | ||
{%endif%} | ||
</div> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
from django.shortcuts import render | ||
from django.shortcuts import render, get_object_or_404 | ||
from django.http import HttpResponse | ||
from .models import * | ||
|
||
|
||
# Create your views here. | ||
def index(request): | ||
return HttpResponse("Test Response") | ||
regions = Region.objects.all() | ||
context = {"regions": regions} | ||
return render(request, "trades/index.html", context) | ||
|
||
|
||
def detail(request, region_id): | ||
region = get_object_or_404(Region, pk=region_id) | ||
biggest_increase = "정자동" | ||
biggest_decrease = "상도동" | ||
context = { | ||
"region": region, | ||
"biggest_increase": biggest_increase, | ||
"biggest_decrease": biggest_decrease, | ||
} | ||
return render(request, "trades/detail.html", context) |