Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Video AG Infrastruktur
website
Commits
45651018
Commit
45651018
authored
8 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Added backend support for featured articles
parent
e0f75739
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
db_schema.sql
+11
-0
11 additions, 0 deletions
db_schema.sql
server.py
+11
-1
11 additions, 1 deletion
server.py
with
22 additions
and
1 deletion
db_schema.sql
+
11
−
0
View file @
45651018
...
...
@@ -194,6 +194,17 @@ CREATE TABLE IF NOT EXISTS `announcements` (
`time_updated`
datetime
NOT
NULL
,
`created_by`
INTEGER
NOT
NULL
);
CREATE
TABLE
IF
NOT
EXISTS
`featured`
(
`id`
INTEGER
NOT
NULL
PRIMARY
KEY
AUTOINCREMENT
,
`title`
text
NOT
NULL
DEFAULT
"Neuer Artikel"
,
`text`
text
NOT
NULL
DEFAULT
""
,
`internal`
text
NOT
NULL
DEFAULT
""
,
`visible`
INTEGER
NOT
NULL
DEFAULT
0
,
`deleted`
INTEGER
NOT
NULL
DEFAULT
0
,
`time_created`
datetime
NOT
NULL
,
`time_updated`
datetime
NOT
NULL
,
`created_by`
INTEGER
NOT
NULL
);
CREATE
VIEW
IF
NOT
EXISTS
`courses`
AS
select
*
from
`courses_data`
where
(
not
(
`courses_data`
.
`deleted`
));
CREATE
VIEW
IF
NOT
EXISTS
`lectures`
AS
select
*
from
`lectures_data`
where
(
not
(
`lectures_data`
.
`deleted`
));
...
...
This diff is collapsed.
Click to expand it.
server.py
+
11
−
1
View file @
45651018
...
...
@@ -144,7 +144,8 @@ def index():
GROUP BY videos.lecture_id
ORDER BY lastvidtime DESC
LIMIT 6
'''
,
ismod
())
return
render_template
(
'
index.html
'
,
latestvideos
=
latestvideos
,
upcomming
=
upcomming
)
featured
=
query
(
'
SELECT * FROM featured WHERE NOT deleted AND (? OR visible)
'
,
ismod
())
return
render_template
(
'
index.html
'
,
latestvideos
=
latestvideos
,
upcomming
=
upcomming
,
featured
=
featured
)
@app.route
(
'
/course
'
)
@register_navbar
(
'
Videos
'
,
icon
=
'
film
'
)
...
...
@@ -384,6 +385,15 @@ def new_announcement():
return
redirect
(
request
.
values
[
'
ref
'
])
return
id
,
200
@app.route
(
'
/newfeatured
'
,
methods
=
[
'
POST
'
,
'
GET
'
])
@mod_required
def
new_featured
():
id
=
query
(
'
INSERT INTO featured (time_created, time_updated, created_by) VALUES (?, ?, ?)
'
,
datetime
.
now
(),
datetime
.
now
(),
session
.
get
(
'
user
'
,
{
'
dbid
'
:
None
})[
'
dbid
'
])
if
'
ref
'
in
request
.
values
:
return
redirect
(
request
.
values
[
'
ref
'
])
return
id
,
200
import
feeds
import
importer
import
schedule
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment