add links to add a new X to: game, edition, purchase, session, device, platform
This commit is contained in:
@ -7,6 +7,7 @@ from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.template.loader import render_to_string
|
||||
from django.urls import reverse
|
||||
|
||||
from common.utils import A, Button
|
||||
from games.forms import DeviceForm
|
||||
from games.models import Device
|
||||
from games.views.general import dateformat
|
||||
@ -35,6 +36,7 @@ def list_devices(request: HttpRequest) -> HttpResponse:
|
||||
else None
|
||||
),
|
||||
"data": {
|
||||
"header_action": A([], Button([], "Add device"), url="add_device"),
|
||||
"columns": [
|
||||
"Name",
|
||||
"Type",
|
||||
|
@ -7,7 +7,7 @@ from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.template.loader import render_to_string
|
||||
from django.urls import reverse
|
||||
|
||||
from common.utils import A, truncate_with_popover
|
||||
from common.utils import A, Button, truncate_with_popover
|
||||
from games.forms import EditionForm
|
||||
from games.models import Edition, Game
|
||||
from games.views.general import dateformat
|
||||
@ -36,6 +36,7 @@ def list_editions(request: HttpRequest) -> HttpResponse:
|
||||
else None
|
||||
),
|
||||
"data": {
|
||||
"header_action": A([], Button([], "Add edition"), url="add_edition"),
|
||||
"columns": [
|
||||
"Game",
|
||||
"Name",
|
||||
|
@ -9,7 +9,7 @@ from django.template.loader import render_to_string
|
||||
from django.urls import reverse
|
||||
|
||||
from common.time import format_duration
|
||||
from common.utils import A, safe_division, truncate_with_popover
|
||||
from common.utils import A, Button, safe_division, truncate_with_popover
|
||||
from games.forms import GameForm
|
||||
from games.models import Edition, Game, Purchase, Session
|
||||
from games.views.general import (
|
||||
@ -45,6 +45,7 @@ def list_games(request: HttpRequest) -> HttpResponse:
|
||||
else None
|
||||
),
|
||||
"data": {
|
||||
"header_action": A([], Button([], "Add game"), url="add_game"),
|
||||
"columns": [
|
||||
"Name",
|
||||
"Sort Name",
|
||||
|
@ -7,6 +7,7 @@ from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.template.loader import render_to_string
|
||||
from django.urls import reverse
|
||||
|
||||
from common.utils import A, Button
|
||||
from games.forms import PlatformForm
|
||||
from games.models import Platform
|
||||
from games.views.general import dateformat, use_custom_redirect
|
||||
@ -35,6 +36,7 @@ def list_platforms(request: HttpRequest) -> HttpResponse:
|
||||
else None
|
||||
),
|
||||
"data": {
|
||||
"header_action": A([], Button([], "Add platform"), url="add_platform"),
|
||||
"columns": [
|
||||
"Name",
|
||||
"Group",
|
||||
|
@ -13,7 +13,7 @@ from django.template.loader import render_to_string
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
|
||||
from common.utils import A, truncate_with_popover
|
||||
from common.utils import A, Button, truncate_with_popover
|
||||
from games.forms import PurchaseForm
|
||||
from games.models import Edition, Purchase
|
||||
from games.views.general import dateformat, use_custom_redirect
|
||||
@ -42,6 +42,7 @@ def list_purchases(request: HttpRequest) -> HttpResponse:
|
||||
else None
|
||||
),
|
||||
"data": {
|
||||
"header_action": A([], Button([], "Add purchase"), url="add_purchase"),
|
||||
"columns": [
|
||||
"Name",
|
||||
"Type",
|
||||
|
@ -9,7 +9,7 @@ from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
|
||||
from common.time import format_duration
|
||||
from common.utils import A, truncate_with_popover
|
||||
from common.utils import A, Button, truncate_with_popover
|
||||
from games.forms import SessionForm
|
||||
from games.models import Purchase, Session
|
||||
from games.views.general import (
|
||||
@ -45,6 +45,7 @@ def list_sessions(request: HttpRequest) -> HttpResponse:
|
||||
else None
|
||||
),
|
||||
"data": {
|
||||
"header_action": A([], Button([], "Add session"), url="add_session"),
|
||||
"columns": [
|
||||
"Name",
|
||||
"Date",
|
||||
@ -57,16 +58,11 @@ def list_sessions(request: HttpRequest) -> HttpResponse:
|
||||
"rows": [
|
||||
[
|
||||
A(
|
||||
[
|
||||
(
|
||||
"href",
|
||||
reverse(
|
||||
"view_game",
|
||||
args=[session.purchase.edition.game.pk],
|
||||
),
|
||||
)
|
||||
],
|
||||
truncate_with_popover(session.purchase.edition.name),
|
||||
children=truncate_with_popover(session.purchase.edition.name),
|
||||
url=reverse(
|
||||
"view_game",
|
||||
args=[session.purchase.edition.game.pk],
|
||||
),
|
||||
),
|
||||
f"{session.timestamp_start.strftime(datetimeformat)}{f" — {session.timestamp_end.strftime(timeformat)}" if session.timestamp_end else ""}",
|
||||
(
|
||||
|
Reference in New Issue
Block a user