forked from rDrama/rDrama
blocks num
parent
39254f19eb
commit
fa14b9019e
|
@ -4,6 +4,7 @@ from files.__main__ import Base
|
||||||
from files.helpers.lazy import lazy
|
from files.helpers.lazy import lazy
|
||||||
from os import environ
|
from os import environ
|
||||||
from .sub_subscription import *
|
from .sub_subscription import *
|
||||||
|
from .sub_block import *
|
||||||
|
|
||||||
SITE_NAME = environ.get("SITE_NAME", '').strip()
|
SITE_NAME = environ.get("SITE_NAME", '').strip()
|
||||||
SITE = environ.get("DOMAIN", '').strip()
|
SITE = environ.get("DOMAIN", '').strip()
|
||||||
|
@ -21,6 +22,8 @@ class Sub(Base):
|
||||||
css = Column(String)
|
css = Column(String)
|
||||||
|
|
||||||
subscriptions = relationship("SubSubscription", lazy="dynamic", primaryjoin="SubSubscription.sub==Sub.name", viewonly=True)
|
subscriptions = relationship("SubSubscription", lazy="dynamic", primaryjoin="SubSubscription.sub==Sub.name", viewonly=True)
|
||||||
|
blocks = relationship("SubBlock", lazy="dynamic", primaryjoin="SubBlock.sub==Sub.name", viewonly=True)
|
||||||
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<Sub(name={self.name})>"
|
return f"<Sub(name={self.name})>"
|
||||||
|
@ -41,3 +44,8 @@ class Sub(Base):
|
||||||
@lazy
|
@lazy
|
||||||
def subscription_num(self):
|
def subscription_num(self):
|
||||||
return self.subscriptions.count()
|
return self.subscriptions.count()
|
||||||
|
|
||||||
|
@property
|
||||||
|
@lazy
|
||||||
|
def block_num(self):
|
||||||
|
return self.blocks.count()
|
|
@ -16,6 +16,8 @@
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th role="button" onclick="sort_table(2)">Posts</th>
|
<th role="button" onclick="sort_table(2)">Posts</th>
|
||||||
<th role="button" onclick="sort_table(3)">Subscribers</th>
|
<th role="button" onclick="sort_table(3)">Subscribers</th>
|
||||||
|
<th role="button" onclick="sort_table(4)">Blockers</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for sub, count in subs %}
|
{% for sub, count in subs %}
|
||||||
|
@ -24,6 +26,7 @@
|
||||||
<td><a href="/s/{{sub.name}}" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %}>{{sub.name}}</a></td>
|
<td><a href="/s/{{sub.name}}" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %}>{{sub.name}}</a></td>
|
||||||
<td>{{count}}</a>
|
<td>{{count}}</a>
|
||||||
<td>{{sub.subscription_num}}</td>
|
<td>{{sub.subscription_num}}</td>
|
||||||
|
<td>{{sub.block_num}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue