Commit b7a0f563 authored by frekk's avatar frekk
Browse files

unfacked circular dependencies and shet

parent 28914968
......@@ -4,16 +4,12 @@ from gms import admin
from .models import CardPayment, MembershipPayment
class CardPaymentAdmin(admin.ModelAdmin):
list_display = ['amount', 'url_field', 'date_created', 'is_paid']
readonly_fields = ['token', 'idempotency_key']
list_display = ['amount', 'date_created', 'is_paid']
readonly_fields = ['idempotency_key']
def url_field(self, obj):
return format_html('<a href="{}">Goto payment page</a>', obj.get_absolute_url())
url_field.short_description = 'Payment URL'
url_field.allow_tags = True
class MembershipPaymentAdmin(CardPaymentAdmin):
list_display = ['amount', 'url_field', 'date_created', 'is_paid', 'membership']
list_display = ['amount', 'date_created', 'is_paid', 'membership'], CardPaymentAdmin), MembershipPaymentAdmin)
import uuid
from import get_random_string
from django.db import models
from django.urls import reverse
......@@ -15,9 +14,6 @@ class CardPayment(models.Model):
date_created = models.DateTimeField('Date created', auto_now_add=True)
date_paid = models.DateTimeField('Date paid (payment captured)', null=True, blank=True)
def get_absolute_url(self):
return reverse('squarepay:pay', kwargs={ 'pk':, 'token': self.token })
class MembershipPayment(CardPayment):
Link the payment to a specific membership
......@@ -4,6 +4,5 @@ from .views import PaymentFormView, MembershipPaymentView
app_name = 'squarepay'
urlpatterns = [
#path('pay/<int:pk>/<str:token>/', PaymentFormView.as_view(), name='pay'),
path('pay/<int:pk>/<str:token>/', MembershipPaymentView.as_view(), name='pay'),
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment