Adjust titles for CRUD panels

master
Mark Veidemanis 1 year ago
parent 0aef440229
commit 312ddb4dc1
Signed by: m
GPG Key ID: 5ACFCEED46C0904F

@ -192,6 +192,10 @@ class ObjectCreate(RestrictedViewMixin, ObjectNameMixin, CreateView):
request = None
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.title = "Create " + self.context_object_name_singular
def post_save(self, obj):
pass
@ -340,6 +344,10 @@ class ObjectUpdate(RestrictedViewMixin, ObjectNameMixin, UpdateView):
request = None
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.title = "Update " + self.context_object_name_singular
def post_save(self, obj):
pass
@ -380,6 +388,8 @@ class ObjectUpdate(RestrictedViewMixin, ObjectNameMixin, UpdateView):
form = kwargs.get("form", None)
if form:
context["form"] = form
context["title"] = self.title + f" ({type})"
context["title_singular"] = self.title_singular
context["unique"] = unique
context["window_content"] = self.window_content
context["context_object_name"] = self.context_object_name

@ -70,7 +70,7 @@ class PositionAction(LoginRequiredMixin, OTPRequiredMixin, ObjectRead):
detail_template = "partials/position-detail.html"
context_object_name_singular = "position"
context_object_name = "positions"
context_object_name = "position info"
detail_url_name = "position_action"
detail_url_args = ["type", "account_id", "symbol"]

Loading…
Cancel
Save