Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
Nuovo sito
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gruppo Web
Nuovo sito
Commits
022769a4
Commit
022769a4
authored
Dec 27, 2023
by
shadMod
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor list() to render view and to get year, month and category from a request GET
parent
554472fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
uitwww/src/news/views.py
uitwww/src/news/views.py
+10
-4
No files found.
uitwww/src/news/views.py
View file @
022769a4
...
...
@@ -17,6 +17,8 @@
import
os
import
flask
from
flask
import
request
from
...
import
cache
from
.utils
import
GetNews
...
...
@@ -35,12 +37,16 @@ class News:
nw_cl
=
GetNews
(
os
.
path
.
join
(
app
.
instance_path
,
"news"
))
@
bp
.
route
(
"/"
)
@
bp
.
route
(
"/<year>"
)
@
cache
.
enable
def
index
(
year
:
int
=
None
):
def
list
():
req
=
request
.
args
month
=
req
.
get
(
"month"
)
year
=
req
.
get
(
"year"
)
category
=
req
.
get
(
"category"
)
return
flask
.
render_template
(
"news/index.html"
,
news
=
nw_cl
.
list_news
(
year
),
"news/list.html"
,
news
=
nw_cl
.
list_news
(
year
=
year
,
category
=
category
,
month
=
month
),
list_years
=
nw_cl
.
list_year_month
)
@
bp
.
route
(
"/<year>/<filename>"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment