SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
f2b21d17
Commit
f2b21d17
authored
6 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Allow Post creation on Meeting only if Meeting is ongoing
parent
3fc0bdce
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
forums/templates/forums/forum_list.html
+1
-1
1 addition, 1 deletion
forums/templates/forums/forum_list.html
forums/views.py
+14
-0
14 additions, 0 deletions
forums/views.py
with
15 additions
and
1 deletion
forums/templates/forums/forum_list.html
+
1
−
1
View file @
f2b21d17
...
...
@@ -78,7 +78,7 @@
<td><a
href=
"{{ forum.get_absolute_url }}"
>
{{ forum }}
</a></td>
<td>
{{ forum.latest_post }}
</td>
<td>
{{ forum.latest_post.posted_on|date:"Y-m-d" }}
</td>
<td>
{{ forum.nr_posts }}
</td>
<td>
<span
class=
"badge badge-primary badge-pill"
>
{{ forum.nr_posts }}
</
span></
td>
</tr>
{% empty %}
<tr>
...
...
This diff is collapsed.
Click to expand it.
forums/views.py
+
14
−
0
View file @
f2b21d17
...
...
@@ -2,6 +2,8 @@ __copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
__license__
=
"
AGPL v3
"
import
datetime
from
django
import
forms
from
django.contrib
import
messages
from
django.contrib.auth.models
import
Group
...
...
@@ -170,6 +172,18 @@ class PostCreateView(UserPassesTestMixin, CreateView):
if
self
.
request
.
user
.
has_perm
(
'
forums.add_forum
'
):
return
True
forum
=
get_object_or_404
(
Forum
,
slug
=
self
.
kwargs
.
get
(
'
slug
'
))
# Only allow posting if it's within a Forum, or within an ongoing meeting.
try
:
if
datetime
.
date
.
today
()
>
forum
.
meeting
.
date_until
:
messages
.
error
(
self
.
request
,
'
Error: you cannot Post to a Meeting which is finished.
'
)
raise
PermissionDenied
elif
datetime
.
date
.
today
()
<
forum
.
meeting
.
date_from
:
messages
.
warning
(
self
.
request
,
'
This meeting has not started yet, please come back later!
'
)
raise
PermissionDenied
except
Meeting
.
DoesNotExist
:
pass
if
self
.
request
.
user
.
has_perm
(
'
can_post_to_forum
'
,
forum
):
return
True
else
:
...
...
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