Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
rpteam
rp
Commits
e3b6ae39
Commit
e3b6ae39
authored
Apr 23, 2017
by
luxcem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds fields to article
parent
b659d5c1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
9 deletions
+29
-9
apps/core/management/__init__.py
apps/core/management/__init__.py
+0
-0
apps/core/management/commands/__init__.py
apps/core/management/commands/__init__.py
+0
-0
apps/core/management/commands/init_groups.py
apps/core/management/commands/init_groups.py
+14
-0
apps/rp/models/article.py
apps/rp/models/article.py
+15
-9
No files found.
apps/core/management/__init__.py
0 → 100644
View file @
e3b6ae39
apps/core/management/commands/__init__.py
0 → 100644
View file @
e3b6ae39
apps/core/management/commands/init_groups.py
0 → 100644
View file @
e3b6ae39
from
django.core.management.base
import
BaseCommand
from
django.contrib.auth.models
import
Group
,
Permission
groups
=
[
"jedi"
,
"padawan"
]
permissions
=
{
"jedi"
:
[],
"padawans"
:
[]
}
class
Command
(
BaseCommand
):
help
=
"Adds initial groups for the application (jedi and padawans)"
def
handle
(
self
,
*
args
,
**
options
):
apps/rp/models/article.py
View file @
e3b6ae39
...
@@ -5,6 +5,13 @@ from .vote import UnDVotedMixin
...
@@ -5,6 +5,13 @@ from .vote import UnDVotedMixin
from
newspaper
import
Article
as
ArticleParser
from
newspaper
import
Article
as
ArticleParser
STATUS_CHOICES
=
(
(
"PENDING"
,
_
(
"Pending"
)),
(
"PUBLISHED"
,
_
(
"Published"
)),
(
"REJECTED"
,
_
(
"Rejected"
))
)
class
Article
(
UnDVotedMixin
):
class
Article
(
UnDVotedMixin
):
url
=
models
.
URLField
(
"URL"
)
url
=
models
.
URLField
(
"URL"
)
lang
=
models
.
CharField
(
_
(
"Language"
),
max_length
=
50
,
null
=
True
)
lang
=
models
.
CharField
(
_
(
"Language"
),
max_length
=
50
,
null
=
True
)
...
@@ -19,24 +26,23 @@ class Article(UnDVotedMixin):
...
@@ -19,24 +26,23 @@ class Article(UnDVotedMixin):
updated_at
=
models
.
DateTimeField
(
_
(
"Last update"
),
auto_now
=
True
)
updated_at
=
models
.
DateTimeField
(
_
(
"Last update"
),
auto_now
=
True
)
published_at
=
models
.
DateTimeField
(
_
(
"Publication date"
),
published_at
=
models
.
DateTimeField
(
_
(
"Publication date"
),
blank
=
True
,
null
=
True
)
blank
=
True
,
null
=
True
)
STATUS_CHOICES
=
(
(
"PENDING"
,
_
(
"Pending"
)),
(
"PUBLISHED"
,
_
(
"Published"
)),
(
"REJECTED"
,
_
(
"Rejected"
))
)
status
=
models
.
CharField
(
status
=
models
.
CharField
(
_
(
"Status"
),
choices
=
STATUS_CHOICES
,
_
(
"Status"
),
choices
=
STATUS_CHOICES
,
default
=
"PENDING"
,
max_length
=
20
)
default
=
"PENDING"
,
max_length
=
20
)
tags
=
TaggableManager
()
#: priority: True if article have priority
priority
=
models
.
BooleanField
(
default
=
False
)
# TODO: adds links to user
tags
=
TaggableManager
()
class
Meta
:
class
Meta
:
verbose_name
=
_
(
"Article"
)
verbose_name
=
_
(
"Article"
)
verbose_name_plural
=
_
(
"Articles"
)
verbose_name_plural
=
_
(
"Articles"
)
permissions
=
(
(
"can_change_status"
,
"Can change article status"
),
(
"can_change_priority"
,
"Can change article priority"
),
(
"can_vote"
,
"Can vote articles"
),
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
title
return
self
.
title
...
...
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