Skip to content

Commit b501a37

Browse files
authored
Merge pull request #75 from darjeeling/add_payment_admin
Add payment admin
2 parents 788a3c7 + 5a60cfc commit b501a37

File tree

5 files changed

+28
-5
lines changed

5 files changed

+28
-5
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
hello

account/urls.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from django.urls import include, path
22

3-
from .views import GitHubLogin, GoogleLogin, MyPage
3+
from .views import GitHubLogin, GoogleLogin, MyPage, mypage_payments
44

55
urlpatterns = [
66
path("auth/", include("dj_rest_auth.urls")),
77
path("auth/github/login/", GitHubLogin.as_view(), name="github_login"),
88
path("auth/google/login/", GoogleLogin.as_view(), name="google_login"),
9-
path("my-page/payments", MyPage.as_view())
9+
#path("my-page/payments", MyPage.as_view())
10+
path("my-page/payments/", mypage_payments)
1011
]

account/views.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from allauth.socialaccount.providers.oauth2.client import OAuth2Client
44
from dj_rest_auth.registration.views import SocialLoginView
55
from django.conf import settings
6-
6+
from django.contrib.auth.decorators import login_required
7+
from django.shortcuts import render
78
from rest_framework.views import APIView
89

910

@@ -19,4 +20,8 @@ class GoogleLogin(SocialLoginView):
1920
client_class = OAuth2Client
2021

2122
class MyPage(APIView):
22-
pass
23+
pass
24+
25+
@login_required
26+
def mypage_payments(request):
27+
return render(request, 'account_mypage_payments.html')

payment/admin.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
from django.contrib import admin
22

3+
from .models import Payment, PaymentHistory
4+
35
# Register your models here.
6+
7+
class PaymentAdmin(admin.ModelAdmin):
8+
pass
9+
10+
11+
class PaymentHistoryAdmin(admin.ModelAdmin):
12+
pass
13+
14+
15+
admin.site.register(Payment, PaymentAdmin)
16+
admin.site.register(PaymentHistory, PaymentHistoryAdmin)

pyconkr/settings.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@
8080
TEMPLATES = [
8181
{
8282
"BACKEND": "django.template.backends.django.DjangoTemplates",
83-
"DIRS": [BASE_DIR / "templates"],
83+
"DIRS": [BASE_DIR / "templates" ,
84+
BASE_DIR / "account/templates",
85+
],
8486
"APP_DIRS": True,
8587
"OPTIONS": {
8688
"context_processors": [

0 commit comments

Comments
 (0)