master
Aevann1 2021-07-31 15:54:04 +02:00
parent bdb26bcbc1
commit 51aea98f08
3 changed files with 9 additions and 4 deletions

View File

@ -56,7 +56,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
backref="submissions") backref="submissions")
domain_ref = Column(Integer, ForeignKey("domains.id")) domain_ref = Column(Integer, ForeignKey("domains.id"))
domain_obj = relationship("Domain") domain_obj = relationship("Domain")
flags = relationship("Flag", lazy="dynamic").order_by(Flag.created_utc).all() flags = relationship("Flag", lazy="dynamic")
is_approved = Column(Integer, ForeignKey("users.id"), default=0) is_approved = Column(Integer, ForeignKey("users.id"), default=0)
over_18 = Column(Boolean, default=False) over_18 = Column(Boolean, default=False)
author = relationship( author = relationship(
@ -419,7 +419,12 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
@property @property
@lazy @lazy
def active_flags(self): def active_flags(self):
return len(self.flags) return self.flags.count()
@property
@lazy
def ordered_flags(self):
return self.flags.order_by(Flag.created_utc).all()
class SaveRelationship(Base, Stndrd): class SaveRelationship(Base, Stndrd):

View File

@ -489,7 +489,7 @@
<strong><i class="far fa-fw fa-flag"></i> Reported by:</strong> <strong><i class="far fa-fw fa-flag"></i> Reported by:</strong>
<pre></pre> <pre></pre>
<ul style="padding-left:20px; margin-bottom: 0;"> <ul style="padding-left:20px; margin-bottom: 0;">
{% for f in p.flags %} {% for f in p.ordered_flags %}
<li><a href="{{f.user.url}}">@{{f.user.username}}</a>: {{f.reason}}</li> <li><a href="{{f.user.url}}">@{{f.user.username}}</a>: {{f.reason}}</li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@ -373,7 +373,7 @@
<strong><i class="far fa-fw fa-flag"></i> Reported by:</strong> <strong><i class="far fa-fw fa-flag"></i> Reported by:</strong>
<pre></pre> <pre></pre>
<ul style="padding-left:20px; margin-bottom: 0;"> <ul style="padding-left:20px; margin-bottom: 0;">
{% for f in p.flags %} {% for f in p.ordered_flags %}
<li><a href="{{f.user.url}}">@{{f.user.username}}</a>: {{f.reason}}</li> <li><a href="{{f.user.url}}">@{{f.user.username}}</a>: {{f.reason}}</li>
{% endfor %} {% endfor %}
</ul> </ul>