forked from MarseyWorld/MarseyWorld
fgg
parent
28f5482c6e
commit
ac15bd64b3
|
@ -10,7 +10,7 @@ from json import loads
|
|||
class BadgeDef(Base):
|
||||
__tablename__ = "badge_defs"
|
||||
|
||||
id = Column(Integer, ForeignKey("badges.id"), primary_key=True, autoincrement=True)
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
name = Column(String)
|
||||
description = Column(String)
|
||||
|
||||
|
@ -29,7 +29,7 @@ class Badge(Base):
|
|||
description = Column(String)
|
||||
url = Column(String)
|
||||
user = relationship("User", viewonly=True)
|
||||
badge = relationship("BadgeDef", viewonly=True)
|
||||
badge = relationship("BadgeDef", primaryjoin="foreign(Badge.badge_id) == remote(BadgeDef.id)", viewonly=True)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Badge(user_id={self.user_id}, badge_id={self.badge_id})>"
|
||||
|
@ -51,12 +51,12 @@ class Badge(Base):
|
|||
elif self.description: text = self.description
|
||||
elif self.badge.description: text = self.badge.description
|
||||
else: return ''
|
||||
return f' - {text}'
|
||||
return f'{self.name} - {text}'
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def name(self):
|
||||
return ""
|
||||
return self.badge.name
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -311,9 +311,9 @@
|
|||
<div>
|
||||
{% for b in u.badges %}
|
||||
{% if b.url %}
|
||||
<a rel="nofollow noopener noreferrer" href="{{b.url}}"><img alt="{{b.name}}" width=55 height=60 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.name}}{{b.text}}"></a>
|
||||
<a rel="nofollow noopener noreferrer" href="{{b.url}}"><img alt="{{b.name}}" width=55 height=60 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.text}}"></a>
|
||||
{% else %}
|
||||
<img alt="{{b.name}}" width=55 height=60 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.name}}{{b.text}}">
|
||||
<img alt="{{b.name}}" width=55 height=60 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.text}}">
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -419,9 +419,9 @@
|
|||
<div class="mb-3">
|
||||
{% for b in u.badges %}
|
||||
{% if b.url %}
|
||||
<a rel="nofollow noopener noreferrer" href="{{b.url}}"><img alt="{{b.name}}" width=29.33 height=32 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.name}}{{b.text}}"></a>
|
||||
<a rel="nofollow noopener noreferrer" href="{{b.url}}"><img alt="{{b.name}}" width=29.33 height=32 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.text}}"></a>
|
||||
{% else %}
|
||||
<img alt="{{b.name}}" width=29.33 height=32 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.name}}{{b.text}}">
|
||||
<img alt="{{b.name}}" width=29.33 height=32 loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{b.text}}">
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue