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
a42c459d
Commit
a42c459d
authored
6 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Basic views
parent
65465a6b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
SciPost_v1/urls.py
+1
-0
1 addition, 0 deletions
SciPost_v1/urls.py
forums/models.py
+4
-0
4 additions, 0 deletions
forums/models.py
forums/views.py
+37
-2
37 additions, 2 deletions
forums/views.py
with
42 additions
and
2 deletions
SciPost_v1/urls.py
+
1
−
0
View file @
a42c459d
...
@@ -46,6 +46,7 @@ urlpatterns = [
...
@@ -46,6 +46,7 @@ urlpatterns = [
url
(
r
'
^commentaries/
'
,
include
(
'
commentaries.urls
'
,
namespace
=
"
commentaries
"
)),
url
(
r
'
^commentaries/
'
,
include
(
'
commentaries.urls
'
,
namespace
=
"
commentaries
"
)),
url
(
r
'
^commentary/
'
,
include
(
'
commentaries.urls
'
,
namespace
=
"
_commentaries
"
)),
url
(
r
'
^commentary/
'
,
include
(
'
commentaries.urls
'
,
namespace
=
"
_commentaries
"
)),
url
(
r
'
^comments/
'
,
include
(
'
comments.urls
'
,
namespace
=
"
comments
"
)),
url
(
r
'
^comments/
'
,
include
(
'
comments.urls
'
,
namespace
=
"
comments
"
)),
url
(
r
'
^forums/
'
,
include
(
'
forums.urls
'
,
namespace
=
"
forums
"
)),
url
(
r
'
^funders/
'
,
include
(
'
funders.urls
'
,
namespace
=
"
funders
"
)),
url
(
r
'
^funders/
'
,
include
(
'
funders.urls
'
,
namespace
=
"
funders
"
)),
url
(
r
'
^finances/
'
,
include
(
'
finances.urls
'
,
namespace
=
"
finances
"
)),
url
(
r
'
^finances/
'
,
include
(
'
finances.urls
'
,
namespace
=
"
finances
"
)),
url
(
r
'
^guides/
'
,
include
(
'
guides.urls
'
,
namespace
=
"
guides
"
)),
url
(
r
'
^guides/
'
,
include
(
'
guides.urls
'
,
namespace
=
"
guides
"
)),
...
...
This diff is collapsed.
Click to expand it.
forums/models.py
+
4
−
0
View file @
a42c459d
...
@@ -4,6 +4,7 @@ __license__ = "AGPL v3"
...
@@ -4,6 +4,7 @@ __license__ = "AGPL v3"
from
django.contrib.contenttypes.fields
import
GenericForeignKey
,
GenericRelation
from
django.contrib.contenttypes.fields
import
GenericForeignKey
,
GenericRelation
from
django.contrib.contenttypes.models
import
ContentType
from
django.contrib.contenttypes.models
import
ContentType
from
django.core.urlresolvers
import
reverse
from
django.db
import
models
from
django.db
import
models
from
django.utils
import
timezone
from
django.utils
import
timezone
...
@@ -47,6 +48,9 @@ class Forum(models.Model):
...
@@ -47,6 +48,9 @@ class Forum(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
slug
return
self
.
slug
def
get_absolute_url
(
self
):
return
reverse
(
'
forums:forum_detail
'
,
kwargs
=
{
'
slug
'
:
self
.
slug
})
class
Post
(
models
.
Model
):
class
Post
(
models
.
Model
):
"""
"""
...
...
This diff is collapsed.
Click to expand it.
forums/views.py
+
37
−
2
View file @
a42c459d
from
django.shortcuts
import
render
__copyright__
=
"
Copyright © Stichting SciPost (SciPost Foundation)
"
__license__
=
"
AGPL v3
"
# Create your views here.
from
django.core.urlresolvers
import
reverse_lazy
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
from
django.views.generic.list
import
ListView
from
.models
import
Forum
from
.forms
import
ForumForm
from
scipost.mixins
import
PermissionsMixin
class
ForumCreateView
(
PermissionsMixin
,
CreateView
):
permission_required
=
'
forums.can_add_forum
'
model
=
Forum
form_class
=
ForumForm
template_name
=
'
forums/forum_form.html
'
success_url
=
reverse_lazy
(
'
forums:forums
'
)
def
get_initial
(
self
):
initial
=
super
().
get_initial
()
initial
.
update
({
'
moderators
'
:
self
.
request
.
user
})
return
initial
class
ForumDetailView
(
DetailView
):
model
=
Forum
template_name
=
'
forums/forum_detail.html
'
class
ForumListView
(
ListView
):
model
=
Forum
template_name
=
'
forum_list.html
'
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