Pull object names from model definitions in CRUD views
This commit is contained in:
@@ -39,14 +39,7 @@ class AccountInfo(LoginRequiredMixin, View):
|
||||
}
|
||||
return render(request, template_name, context)
|
||||
|
||||
success, live_info = account.client.get_account()
|
||||
if not success:
|
||||
context = {
|
||||
"message": "Could not get account info",
|
||||
"class": "danger",
|
||||
"window_content": self.window_content,
|
||||
}
|
||||
return render(request, template_name, context)
|
||||
live_info = account.client.get_account()
|
||||
live_info = live_info
|
||||
account_info = account.__dict__
|
||||
account_info = {
|
||||
@@ -70,10 +63,6 @@ class AccountInfo(LoginRequiredMixin, View):
|
||||
class AccountList(LoginRequiredMixin, ObjectList):
|
||||
list_template = "partials/account-list.html"
|
||||
model = Account
|
||||
context_object_name = "accounts"
|
||||
context_object_name_singular = "account"
|
||||
title = "Accounts"
|
||||
title_singular = "Account"
|
||||
page_title = "List of accounts"
|
||||
|
||||
list_url_name = "accounts"
|
||||
@@ -85,8 +74,6 @@ class AccountList(LoginRequiredMixin, ObjectList):
|
||||
class AccountCreate(LoginRequiredMixin, ObjectCreate):
|
||||
model = Account
|
||||
form_class = AccountForm
|
||||
context_object_name = "accounts"
|
||||
context_object_name_singular = "account"
|
||||
|
||||
list_url_name = "accounts"
|
||||
list_url_args = ["type"]
|
||||
@@ -110,8 +97,6 @@ class AccountCreate(LoginRequiredMixin, ObjectCreate):
|
||||
class AccountUpdate(LoginRequiredMixin, ObjectUpdate):
|
||||
model = Account
|
||||
form_class = AccountForm
|
||||
context_object_name = "accounts"
|
||||
context_object_name_singular = "account"
|
||||
|
||||
list_url_name = "accounts"
|
||||
list_url_args = ["type"]
|
||||
@@ -121,8 +106,6 @@ class AccountUpdate(LoginRequiredMixin, ObjectUpdate):
|
||||
|
||||
class AccountDelete(LoginRequiredMixin, ObjectDelete):
|
||||
model = Account
|
||||
context_object_name = "accounts"
|
||||
context_object_name_singular = "account"
|
||||
|
||||
list_url_name = "accounts"
|
||||
list_url_args = ["type"]
|
||||
|
||||
Reference in New Issue
Block a user