Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
django-newsbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
WebU
shared
django-newsbox
Commits
94393dec
Commit
94393dec
authored
5 years ago
by
Dylann Cordel
Browse files
Options
Downloads
Patches
Plain Diff
fix backward compatibiliy
parent
f0d07881
Branches
develop
Branches containing commit
Tags
0.6.2
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
newsbox/__init__.py
+1
-1
1 addition, 1 deletion
newsbox/__init__.py
newsbox/admin.py
+1
-1
1 addition, 1 deletion
newsbox/admin.py
newsbox/models.py
+21
-4
21 additions, 4 deletions
newsbox/models.py
with
23 additions
and
6 deletions
newsbox/__init__.py
+
1
−
1
View file @
94393dec
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
__version__
=
'
0.6.
9
'
__version__
=
'
0.6.
10
'
This diff is collapsed.
Click to expand it.
newsbox/admin.py
+
1
−
1
View file @
94393dec
...
@@ -198,7 +198,7 @@ class NewsboxBaseAdmin(admin.ModelAdmin):
...
@@ -198,7 +198,7 @@ class NewsboxBaseAdmin(admin.ModelAdmin):
obj
.
save
()
obj
.
save
()
log_msg
=
_
(
'
publication status changed from %(old)s to %(new)s
'
)
%
{
log_msg
=
_
(
'
publication status changed from %(old)s to %(new)s
'
)
%
{
'
old
'
:
old_status
,
'
old
'
:
old_status
,
'
new
_status
'
:
obj
.
newsbox_status
,
'
new
'
:
obj
.
newsbox_status
,
}
}
if
obj
.
newsbox_status
==
obj
.
STATUS_PUBLISHED
:
if
obj
.
newsbox_status
==
obj
.
STATUS_PUBLISHED
:
msg
=
_
(
'
The %(objtype)s
"
%(objtitle)s
"
has been successfully published
'
)
msg
=
_
(
'
The %(objtype)s
"
%(objtitle)s
"
has been successfully published
'
)
...
...
This diff is collapsed.
Click to expand it.
newsbox/models.py
+
21
−
4
View file @
94393dec
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# "Future imports"
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
# "Standard libs"
import
sys
import
sys
from
datetime
import
datetime
from
warnings
import
warn
# "Django imports"
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.db
import
models
from
django.db
import
models
from
django.utils.timezone
import
now
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.encoding
import
python_2_unicode_compatible
from
django.utils
import
six
from
django.utils
import
six
from
django.utils.encoding
import
python_2_unicode_compatible
from
django.utils.functional
import
lazy
from
django.utils.functional
import
lazy
from
django.utils.safestring
import
mark_safe
from
django.utils.safestring
import
mark_safe
from
django.utils.timezone
import
now
from
django.utils.translation
import
ugettext_lazy
as
_
mark_safe_lazy
=
lazy
(
mark_safe
,
six
.
text_type
)
mark_safe_lazy
=
lazy
(
mark_safe
,
six
.
text_type
)
newsbox_models
=
[]
newsbox_models
=
[]
...
@@ -292,6 +295,20 @@ class NewsboxBase(six.with_metaclass(NewsboxModelBase, models.Model)):
...
@@ -292,6 +295,20 @@ class NewsboxBase(six.with_metaclass(NewsboxModelBase, models.Model)):
def
__str__
(
self
):
def
__str__
(
self
):
return
six
.
text_type
(
self
.
newsbox_title
)
return
six
.
text_type
(
self
.
newsbox_title
)
@property
def
newsbox_published
(
self
):
warn
((
'
newsbox_published field is deprecated in favor of newsbox_status.
'
'
Please upgrade your code.
'
),
DeprecationWarning
)
return
self
.
is_published
@newsbox_published.setter
def
newsbox_published
(
self
,
val
):
warn
((
'
newsbox_published field is deprecated in favor of newsbox_status.
'
'
Please upgrade your code.
'
),
DeprecationWarning
)
self
.
newsbox_status
=
self
.
STATUS_PUBLISHED
@property
@property
def
is_published
(
self
):
def
is_published
(
self
):
if
self
.
newsbox_status
!=
self
.
STATUS_PUBLISHED
:
if
self
.
newsbox_status
!=
self
.
STATUS_PUBLISHED
:
...
...
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