css등은 적용되지 않았고, template를 적용시키는 내용 외엔 복잡한 태그는 쓰이지 않았습니다.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-16" />
<title>{{ head_title }} - 현재 사용자: {{ username }}</title>
</head>
<body>
{{ program }} 이 현재 방영되고 있습니다 | {{ channel }}
<h1>{{ page_title }}</h1>
<ul>{% for comment in comments %}
<li>{{ comment.commenter }}
{{ comment.written_datetime }} written via: {{ comment.written_via }}
{{ comment.text }}
<p/>
</li>
{% endfor %}
</ul>
{% if username and program %}
<table border="1" align="center">
<tr>
<td width="100" align="center">사용자:</td>
<td>{{ username }}</td>
</tr>
<tr >
<form method="post" action="." >
{{ form.as_table }}
<input type="hidden" name="program" value="{{ program }}">
</form>
</tr>
<tr>
</tr>
</table>
{% else %}{% if not program %}
<p>현재 방송중인 프로그램을 얻을 수 없습니다</p>
{% else %}
<p>로그인 하세요</p>
{% endif %}{% endif %}
<a href="{{ url }}">{{ url_linktext }}</a> |
<a href="/comment">최근 댓글 페이지</a>
<h2><a href="http://tj850413.blogspot.com/"> 이 사이트에 대하여</a></h2>
</body>
</html>
앞부분에선 for문으로 comments를 통해 얻어온 내용들을 뿌려주며
아래쪽에선 user가 로그인해있고 program이 None이 아니면 comment입력 form을 형성해줍니다.
앱엔진에서 지원해주는 구글 로그인 url을 넣어주어 로그인했을 시엔 logout 링크가, 반대일때는 login이 뜨도록 하였습니다.
그 아래엔 최근 댓글들을 보여주는 링크가 있고
그 다음으론 이 블로그로 통하는 링크를 넣어주어습니다.
다음은 comments.html입니다.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>최근 댓글 페이지 {{ username }}</title>
</head>
<body>
<h1>최근에 등록 된 댓글 30개</h1>
<ul>{% for comment in comments %}
<li>{{ comment.text }} |
{{ comment.commenter }}
{{ comment.program.key.name }}
{{ comment.written_datetime }} written via: {{ comment.written_via }}
<p/>
</li>
{% endfor %}
</ul>
<a href="{{ url }}">{{ url_linktext }}</a> |
<a href="/">main page</a>
</body>
</html>
여기에선 comment를 뿌려주는 일 외엔 별다른 설명할 부분이 없는 것 같습니다.
댓글 없음:
댓글 쓰기