City as select
This commit is contained in:
@ -8,6 +8,15 @@ from django.shortcuts import render
|
||||
from project.main.models import Person
|
||||
from project.main.views.demo_view_base import DemoViewBase
|
||||
|
||||
CITIES: list[str] = [
|
||||
"",
|
||||
"Zagreb",
|
||||
"Split",
|
||||
"Pula",
|
||||
"Rijeka",
|
||||
"Kozari bok",
|
||||
]
|
||||
|
||||
|
||||
def get_person(pk: int) -> Person:
|
||||
try:
|
||||
@ -46,6 +55,7 @@ class TableInlineEditRowView(DemoViewBase):
|
||||
context_data.update(
|
||||
{
|
||||
"person": person,
|
||||
"cities": CITIES,
|
||||
"is_editing": action == "edit",
|
||||
}
|
||||
)
|
||||
@ -66,12 +76,11 @@ class TableInlineEditRowView(DemoViewBase):
|
||||
else:
|
||||
person.save()
|
||||
|
||||
print(errors)
|
||||
|
||||
return render(
|
||||
context={
|
||||
"person": person,
|
||||
"errors": errors,
|
||||
"cities": CITIES,
|
||||
"is_editing": errors is not None,
|
||||
},
|
||||
template_name=self.template_name,
|
||||
|
||||
Reference in New Issue
Block a user