Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Anthony
memopol
Commits
bd3a6ee0
Commit
bd3a6ee0
authored
Dec 13, 2015
by
Jamesie Pic
Browse files
Insane bug fix
This code was just preventing administrators to publish recommendations !
parent
5e95178d
Changes
2
Hide whitespace changes
Inline
Side-by-side
memopol/settings.py
View file @
bd3a6ee0
...
...
@@ -293,5 +293,4 @@ CONSTANCE_CONFIG = {
'USE_COUNTRY'
:
(
True
,
'Use country for representative'
),
'MAIN_GROUP_KIND'
:
(
'group'
,
'Main group kind'
),
'ORGANIZATION_NAME'
:
(
'La Quadrature du Net'
,
'Organization name'
),
'POSITION_PUBLISHED'
:
(
False
,
'Default position published status'
)
}
positions/models.py
View file @
bd3a6ee0
...
...
@@ -18,7 +18,6 @@
#
# Copyright (C) 2015 Arnaud Fabre <af@laquadrature.net>
from
constance
import
config
from
django.db
import
models
from
django.template.defaultfilters
import
truncatewords
from
taggit.managers
import
TaggableManager
...
...
@@ -28,8 +27,6 @@ from legislature.models import MemopolRepresentative
class
PositionManager
(
models
.
Manager
):
"""A simple model manager for querying published Positions"""
# https://docs.djangoproject.com/en/1.8/topics/db/managers/#using-managers-for-related-object-access
use_for_related_fields
=
True
def
published
(
self
,
**
kwargs
):
...
...
@@ -49,11 +46,6 @@ class Position(models.Model):
# Adds our custom manager
objects
=
PositionManager
()
def
save
(
self
,
*
args
,
**
kwargs
):
""" Set published to default value and save the model"""
self
.
published
=
config
.
POSITION_PUBLISHED
super
(
Position
,
self
).
save
(
*
args
,
**
kwargs
)
@
property
def
short_text
(
self
):
return
truncatewords
(
self
.
text
,
5
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment