forked from ScoDoc/ScoDoc
Merge branch 'master' of https://scodoc.org/git/viennet/ScoDoc into new_api
This commit is contained in:
commit
dc9da88fc1
@ -102,9 +102,15 @@ class ScolarNews(db.Model):
|
|||||||
}
|
}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def last_news(cls, n=1) -> list:
|
def last_news(cls, n=1, dept_id=None, filter_dept=True) -> list:
|
||||||
"The most recent n news. Returns list of ScolarNews instances."
|
"The most recent n news. Returns list of ScolarNews instances."
|
||||||
return cls.query.order_by(cls.date.desc()).limit(n).all()
|
query = cls.query
|
||||||
|
if filter_dept:
|
||||||
|
if dept_id is None:
|
||||||
|
dept_id = g.scodoc_dept_id
|
||||||
|
query = query.filter_by(dept_id=dept_id)
|
||||||
|
|
||||||
|
return query.order_by(cls.date.desc()).limit(n).all()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def add(cls, typ, obj=None, text="", url=None, max_frequency=0):
|
def add(cls, typ, obj=None, text="", url=None, max_frequency=0):
|
||||||
|
@ -222,7 +222,7 @@ def do_ue_delete(ue_id, delete_validations=False, force=False):
|
|||||||
ScolarNews.add(
|
ScolarNews.add(
|
||||||
typ=ScolarNews.NEWS_FORM,
|
typ=ScolarNews.NEWS_FORM,
|
||||||
obj=ue.formation_id,
|
obj=ue.formation_id,
|
||||||
text="Modification de la formation %(acronyme)s" % F,
|
text=f"Modification de la formation {F['acronyme']}",
|
||||||
max_frequency=10 * 60,
|
max_frequency=10 * 60,
|
||||||
)
|
)
|
||||||
#
|
#
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- mode: python -*-
|
# -*- mode: python -*-
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
SCOVERSION = "9.2.1"
|
SCOVERSION = "9.2.2"
|
||||||
|
|
||||||
SCONAME = "ScoDoc"
|
SCONAME = "ScoDoc"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user