+
+
+class PayUNotificationAdmin(admin.ModelAdmin):
+ list_display = ['received_at', 'order']
+ fields = ['received_at', 'order', 'body_']
+ readonly_fields = ['received_at', 'body_']
+ raw_id_fields = ['order']
+
+ def body_(self, obj):
+ return mark_safe(
+ "<pre>" +
+ conditional_escape(json.dumps(json.loads(obj.body), indent=4))
+ + "</pre>")
+
+
+admin.site.register(models.PayUNotification, PayUNotificationAdmin)
+
+
+class PayUNotificationInline(admin.TabularInline):
+ model = models.PayUNotification
+ fields = ['received_at', 'body_']
+ readonly_fields = fields
+ extra = 0
+ show_change_link = True
+ can_delete = False
+
+ def body_(self, obj):
+ return mark_safe(
+ "<pre>" +
+ conditional_escape(json.dumps(json.loads(obj.body), indent=4))
+ + "</pre>")
+
+ def has_add_permission(self, request, obj):
+ return False
+
+
+class PayUOrderAdmin(admin.ModelAdmin):
+ list_display = ['schedule']
+ raw_id_fields = ['schedule']
+ inlines = [PayUNotificationInline]
+
+
+admin.site.register(models.PayUOrder, PayUOrderAdmin)
+
+
+admin.site.register(models.Ambassador)
+
+
+
+
+@admin.register(models.Consent)
+class ConsentAdmin(admin.ModelAdmin):
+ list_display = ['text', 'order', 'active', 'required']
+
+ def get_readonly_fields(self, request, obj=None):
+ if obj:
+ return ['text']
+ else:
+ return []