1.2.1: Fix add set with no metadata #63
@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## 1.2.1:
|
||||
|
||||
This release fixes a bug where you could not add a set if no metadata was configured.
|
||||
|
||||
## 1.2.0:
|
||||
|
||||
> **Warning**
|
||||
|
@ -3,7 +3,7 @@ from typing import List, overload, Self, Type, TypeVar
|
||||
|
||||
from flask import url_for
|
||||
|
||||
from .exceptions import NotFoundException
|
||||
from .exceptions import ErrorException, NotFoundException
|
||||
from .fields import BrickRecordFields
|
||||
from .record_list import BrickRecordList
|
||||
from .set_owner import BrickSetOwner
|
||||
@ -113,12 +113,17 @@ class BrickMetadataList(BrickRecordList[T]):
|
||||
|
||||
# Grab a specific status
|
||||
@classmethod
|
||||
def get(cls, id: str, /, *, allow_none: bool = False) -> T:
|
||||
def get(cls, id: str | None, /, *, allow_none: bool = False) -> T:
|
||||
new = cls.new()
|
||||
|
||||
if allow_none and id == '':
|
||||
if allow_none and (id == '' or id is None):
|
||||
return new.model()
|
||||
|
||||
if id is None:
|
||||
raise ErrorException('Cannot get {kind} with no ID'.format(
|
||||
kind=new.kind.capitalize()
|
||||
))
|
||||
|
||||
if id not in new.mapping:
|
||||
raise NotFoundException(
|
||||
'{kind} with ID {id} was not found in the database'.format(
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import Final
|
||||
|
||||
__version__: Final[str] = '1.2.0'
|
||||
__version__: Final[str] = '1.2.1'
|
||||
__database_version__: Final[int] = 15
|
||||
|
@ -84,6 +84,7 @@ def admin() -> str:
|
||||
open_image = request.args.get('open_image', None)
|
||||
open_instructions = request.args.get('open_instructions', None)
|
||||
open_logout = request.args.get('open_logout', None)
|
||||
open_metadata = request.args.get('open_metadata', None)
|
||||
open_owner = request.args.get('open_owner', None)
|
||||
open_purchase_location = request.args.get('open_purchase_location', None)
|
||||
open_retired = request.args.get('open_retired', None)
|
||||
@ -93,6 +94,7 @@ def admin() -> str:
|
||||
open_theme = request.args.get('open_theme', None)
|
||||
|
||||
open_metadata = (
|
||||
open_metadata or
|
||||
open_owner or
|
||||
open_purchase_location or
|
||||
open_status or
|
||||
|
@ -2,7 +2,7 @@ services:
|
||||
bricktracker:
|
||||
container_name: BrickTracker
|
||||
restart: unless-stopped
|
||||
image: gitea.baerentsen.space/frederikbaerentsen/bricktracker:1.2.0
|
||||
image: gitea.baerentsen.space/frederikbaerentsen/bricktracker:1.2.1
|
||||
ports:
|
||||
- "3333:3333"
|
||||
volumes:
|
||||
|
@ -2,7 +2,7 @@ services:
|
||||
bricktracker:
|
||||
container_name: BrickTracker
|
||||
restart: unless-stopped
|
||||
image: gitea.baerentsen.space/frederikbaerentsen/bricktracker:1.2.0
|
||||
image: gitea.baerentsen.space/frederikbaerentsen/bricktracker:1.2.1
|
||||
ports:
|
||||
- "3333:3333"
|
||||
volumes:
|
||||
|
@ -37,6 +37,12 @@
|
||||
</div>
|
||||
<h6 class="border-bottom mt-2">Metadata</h6>
|
||||
<div class="accordion accordion" id="metadata">
|
||||
{% if not (brickset_owners | length) and not (brickset_purchase_locations | length) and not (brickset_storages | length) and not (brickset_tags | length) %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
You have no metadata configured.
|
||||
You can add entries in the <a href="{{ url_for('admin.admin', open_metadata=true) }}" class="btn btn-warning" role="button"><i class="ri-profile-line"></i> Set metadata management</a> section of the Admin panel.
|
||||
</div>
|
||||
{% else %}
|
||||
{% if brickset_owners | length %}
|
||||
{{ accordion.header('Owners', 'owners', 'metadata', icon='user-line') }}
|
||||
<div id="add-owners">
|
||||
@ -91,6 +97,7 @@
|
||||
</div>
|
||||
{{ accordion.footer() }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<hr>
|
||||
<div class="mb-3">
|
||||
|
Loading…
x
Reference in New Issue
Block a user