Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cb5a93e

Browse files
create payment history template
1 parent f9a2f8c commit cb5a93e

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed

‎account/templates/_base.html‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{% load static %}
2+
<!DOCTYPE html>
3+
<html lang="en">
4+
<head>
5+
<title>
6+
{% block title %}
7+
{% endblock title %}
8+
</title>
9+
<meta charset="UTF-8">
10+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
11+
<script src="https://cdn.tailwindcss.com"></script>
12+
<script>
13+
tailwind.config = {
14+
theme: {
15+
extend: {
16+
colors: {
17+
clifford: '#da373d',
18+
}
19+
}
20+
}
21+
}
22+
</script>
23+
</head>
24+
<body class="bg-green-50">
25+
<div class="container mx-auto mt-4">
26+
{% block content %}
27+
{% endblock content %}
28+
</div>
29+
</body>
30+
</html>
Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,19 @@
1-
2-
hello
1+
{% extends "_base.html" %}
2+
{% block content %}
3+
<table class="table-auto">
4+
<thead>
5+
<tr>
6+
<th>id </th>
7+
<th>user</th>
8+
</tr>
9+
</thead>
10+
<tbody>
11+
{% for payment in payment_list %}
12+
<tr>
13+
<td>{{ payment.id }}</td>
14+
<td>{{ payment.user_id }}</td>
15+
</tr>
16+
{% endfor %}
17+
</tbody>
18+
</table>
19+
{% endblock content %}

‎account/views.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from django.shortcuts import render
88
from rest_framework.views import APIView
99

10+
import payment
11+
1012

1113
class GitHubLogin(SocialLoginView):
1214
adapter_class = GitHubOAuth2Adapter
@@ -24,4 +26,6 @@ class MyPage(APIView):
2426

2527
@login_required
2628
def mypage_payments(request):
27-
return render(request, 'account_mypage_payments.html')
29+
payment_list = payment.models.Payment.objects.filter(user_id=request.user)
30+
return render(request, 'account_mypage_payments.html',
31+
context={'payment_list': payment_list})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /