Use Rebrickable URL for cosmetics if available
This commit is contained in:
parent
deb4a36604
commit
8b5784bc9e
@ -138,6 +138,13 @@ class RebrickablePart(BrickRecord):
|
|||||||
def url_for_rebrickable(self, /) -> str:
|
def url_for_rebrickable(self, /) -> str:
|
||||||
if current_app.config['REBRICKABLE_LINKS']:
|
if current_app.config['REBRICKABLE_LINKS']:
|
||||||
try:
|
try:
|
||||||
|
if self.fields.url is not None:
|
||||||
|
# The URL does not contain color info...
|
||||||
|
return '{url}{color}'.format(
|
||||||
|
url=self.fields.url,
|
||||||
|
color=self.fields.color
|
||||||
|
)
|
||||||
|
else:
|
||||||
return current_app.config['REBRICKABLE_LINK_PART_PATTERN'].format( # noqa: E501
|
return current_app.config['REBRICKABLE_LINK_PART_PATTERN'].format( # noqa: E501
|
||||||
part=self.fields.part,
|
part=self.fields.part,
|
||||||
color=self.fields.color,
|
color=self.fields.color,
|
||||||
|
Loading…
Reference in New Issue
Block a user