Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-wiki
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-wiki
Commits
579c67e2
Commit
579c67e2
authored
Nov 13, 2014
by
paul
Committed by
benjaoming
Nov 13, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding python_2_unicode_compatible from @fsx999, #Fix 282 and Close #342
Conflicts: wiki/plugins/attachments/models.py
parent
62d67c06
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
wiki/models/article.py
+5
-1
wiki/plugins/attachments/models.py
+6
-2
No files found.
wiki/models/article.py
View file @
579c67e2
...
@@ -187,6 +187,7 @@ class Article(models.Model):
...
@@ -187,6 +187,7 @@ class Article(models.Model):
return
reverse
(
'wiki:get'
,
kwargs
=
{
'article_id'
:
self
.
id
})
return
reverse
(
'wiki:get'
,
kwargs
=
{
'article_id'
:
self
.
id
})
@python_2_unicode_compatible
class
ArticleForObject
(
models
.
Model
):
class
ArticleForObject
(
models
.
Model
):
objects
=
managers
.
ArticleFkManager
()
objects
=
managers
.
ArticleFkManager
()
...
@@ -200,7 +201,10 @@ class ArticleForObject(models.Model):
...
@@ -200,7 +201,10 @@ class ArticleForObject(models.Model):
content_object
=
generic
.
GenericForeignKey
(
"content_type"
,
"object_id"
)
content_object
=
generic
.
GenericForeignKey
(
"content_type"
,
"object_id"
)
is_mptt
=
models
.
BooleanField
(
default
=
False
,
editable
=
False
)
is_mptt
=
models
.
BooleanField
(
default
=
False
,
editable
=
False
)
def
__str__
(
self
):
return
"{}"
.
format
(
self
.
article
)
class
Meta
:
class
Meta
:
app_label
=
settings
.
APP_LABEL
app_label
=
settings
.
APP_LABEL
verbose_name
=
_
(
'Article for object'
)
verbose_name
=
_
(
'Article for object'
)
...
...
wiki/plugins/attachments/models.py
View file @
579c67e2
...
@@ -6,6 +6,7 @@ import os.path
...
@@ -6,6 +6,7 @@ import os.path
from
django.db
import
models
from
django.db
import
models
from
django.utils.translation
import
ugettext
from
django.utils.translation
import
ugettext
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.encoding
import
python_2_unicode_compatible
from
django.conf
import
settings
as
django_settings
from
django.conf
import
settings
as
django_settings
from
.
import
settings
from
.
import
settings
...
@@ -18,10 +19,12 @@ from six.moves import map
...
@@ -18,10 +19,12 @@ from six.moves import map
from
six.moves
import
zip
from
six.moves
import
zip
from
six.moves
import
range
from
six.moves
import
range
class
IllegalFileExtension
(
Exception
):
class
IllegalFileExtension
(
Exception
):
"""File extension on upload is not allowed"""
"""File extension on upload is not allowed"""
pass
pass
@python_2_unicode_compatible
class
Attachment
(
ReusablePlugin
):
class
Attachment
(
ReusablePlugin
):
objects
=
managers
.
ArticleFkManager
()
objects
=
managers
.
ArticleFkManager
()
...
@@ -49,7 +52,7 @@ class Attachment(ReusablePlugin):
...
@@ -49,7 +52,7 @@ class Attachment(ReusablePlugin):
if
settings
.
APP_LABEL
:
if
settings
.
APP_LABEL
:
app_label
=
settings
.
APP_LABEL
app_label
=
settings
.
APP_LABEL
def
__
unicode
__
(
self
):
def
__
str
__
(
self
):
return
"
%
s:
%
s"
%
(
self
.
article
.
current_revision
.
title
,
self
.
original_filename
)
return
"
%
s:
%
s"
%
(
self
.
article
.
current_revision
.
title
,
self
.
original_filename
)
def
extension_allowed
(
filename
):
def
extension_allowed
(
filename
):
...
@@ -90,6 +93,7 @@ def upload_path(instance, filename):
...
@@ -90,6 +93,7 @@ def upload_path(instance, filename):
return
path
.
join
(
upload_path
,
filename
)
return
path
.
join
(
upload_path
,
filename
)
@python_2_unicode_compatible
class
AttachmentRevision
(
BaseRevisionMixin
,
models
.
Model
):
class
AttachmentRevision
(
BaseRevisionMixin
,
models
.
Model
):
attachment
=
models
.
ForeignKey
(
'Attachment'
)
attachment
=
models
.
ForeignKey
(
'Attachment'
)
...
@@ -153,7 +157,7 @@ class AttachmentRevision(BaseRevisionMixin, models.Model):
...
@@ -153,7 +157,7 @@ class AttachmentRevision(BaseRevisionMixin, models.Model):
self
.
attachment
.
current_revision
=
self
self
.
attachment
.
current_revision
=
self
self
.
attachment
.
save
()
self
.
attachment
.
save
()
def
__
unicode
__
(
self
):
def
__
str
__
(
self
):
return
"
%
s:
%
s (r
%
d)"
%
(
self
.
attachment
.
article
.
current_revision
.
title
,
return
"
%
s:
%
s (r
%
d)"
%
(
self
.
attachment
.
article
.
current_revision
.
title
,
self
.
attachment
.
original_filename
,
self
.
attachment
.
original_filename
,
self
.
revision_number
)
self
.
revision_number
)
...
...
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