-
-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Admin for payments #418
Comments
Hi! I'm curious because most of the work is done automatically, what would you like to see in an admin? I personally use django-baton and I can manage most payment cases editing the payment object. |
No, i don't see admin things for the models/payments. |
We don't currently ship an admin. I can't really imagine an implementation that would make sense; each project will have needs that are too specific in this sense. FWIW, creating an admin is pretty simple. I use the following in one of my applications: @admin.register(models.Payment, site=backoffice)
class PaymentAdmin(PaymentMixin, admin.ModelAdmin):
view_on_site = False
list_display = (
"_display",
"status",
"variant",
"order",
)
readonly_fields = (
"invoice_type",
"_display",
)
search_fields = ("order__pk",)
raw_id_fields = (
"order",
"author",
"receipt",
)
def get_queryset(self, request: HttpRequest) -> QuerySet[models.Payment]:
return super().get_queryset(request).select_related("order")
def has_add_permission(
self,
request: HttpRequest,
obj: models.Payment | None = None,
) -> bool:
return False
def has_delete_permission(
self,
request: HttpRequest,
obj: models.Payment | None = None,
) -> bool:
return False
def has_change_permission(
self,
request: HttpRequest,
obj: models.Payment | None = None,
) -> bool:
return False |
Im not mean external admin, but im searching for the admin classes that make it appear on django admin. The PaymentAdmin class that you sad above is the answer. |
We can probably include it as an example in the docs. |
Hi,
There is any admin for this payments?
Thanks.
The text was updated successfully, but these errors were encountered: