Use Rebrickable URL for cosmetics if available
This commit is contained in:
parent
fe13cfdb08
commit
d93723ab4e
@ -138,6 +138,13 @@ class RebrickablePart(BrickRecord):
|
||||
def url_for_rebrickable(self, /) -> str:
|
||||
if current_app.config['REBRICKABLE_LINKS']:
|
||||
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
|
||||
part=self.fields.part,
|
||||
color=self.fields.color,
|
||||
|
Loading…
Reference in New Issue
Block a user