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
M
memopol
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
32
Issues
32
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Political Memory
memopol
Commits
a8eeff9f
Commit
a8eeff9f
authored
Dec 28, 2015
by
Jamesie Pic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix: Position form would only work in best case
parent
e1e714be
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
20 deletions
+27
-20
memopol/views.py
memopol/views.py
+2
-1
representatives_positions/forms.py
representatives_positions/forms.py
+3
-2
representatives_positions/templates/representatives_positions/_form.haml
..._positions/templates/representatives_positions/_form.haml
+12
-0
representatives_positions/templates/representatives_positions/position_form.haml
...ns/templates/representatives_positions/position_form.haml
+7
-0
representatives_positions/views.py
representatives_positions/views.py
+1
-1
templates/representatives/representative_detail.haml
templates/representatives/representative_detail.haml
+2
-16
No files found.
memopol/views.py
View file @
a8eeff9f
...
...
@@ -28,7 +28,8 @@ class RepresentativeDetail(representatives_views.RepresentativeDetail):
def
get_context_data
(
self
,
**
kwargs
):
c
=
super
(
RepresentativeDetail
,
self
).
get_context_data
(
**
kwargs
)
c
[
'position_form'
]
=
PositionForm
()
c
[
'position_form'
]
=
PositionForm
(
initial
=
{
'representative'
:
self
.
object
.
pk
})
self
.
add_representative_country_and_main_mandate
(
c
[
'object'
])
return
c
...
...
representatives_positions/forms.py
View file @
a8eeff9f
...
...
@@ -8,7 +8,7 @@ from .models import Position
class
PositionForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Position
fields
=
[
'tags'
,
'datetime'
,
'text'
,
'link'
]
fields
=
[
'tags'
,
'datetime'
,
'text'
,
'link'
,
'representative'
]
widgets
=
{
# Use localization and bootstrap 3
'datetime'
:
DateWidget
(
...
...
@@ -17,5 +17,6 @@ class PositionForm(forms.ModelForm):
},
usel10n
=
True
,
bootstrap_version
=
3
,
)
),
'representative'
:
forms
.
HiddenInput
}
representatives_positions/templates/representatives_positions/_form.haml
0 → 100644
View file @
a8eeff9f
-
load
bootstrap3
%form
{
:action
=>
'
{
% url
"representatives_positions:position-create"
%
}
',
:method => '
post
'
}
-
csrf_token
-
bootstrap_form
form
-
buttons
%button
{
'type'
:
'submit'
,
'class'
:
'btn btn-primary'
}
{% bootstrap_icon "star" %} Submit
-
endbuttons
representatives_positions/templates/representatives_positions/position_form.haml
0 → 100644
View file @
a8eeff9f
-
extends
'base.html'
-
block
head
{{ form.media }}
-
block
content
-
include
'representatives_positions/_form.html'
representatives_positions/views.py
View file @
a8eeff9f
...
...
@@ -10,7 +10,7 @@ from .forms import PositionForm
class
PositionCreate
(
generic
.
CreateView
):
model
=
Position
f
ields
=
PositionForm
.
Meta
.
fields
+
[
'representative'
]
f
orm_class
=
PositionForm
def
get_success_url
(
self
):
return
self
.
object
.
representative
.
get_absolute_url
()
...
...
templates/representatives/representative_detail.haml
View file @
a8eeff9f
-# List representatives
-
extends
'base.html'
-
load
humanize
-
load
representatives_tags
-
load
representatives_votes_tags
-
load
representatives_recommendations_tags
-
load
bootstrap3
-
block
head
{{ position_form.media }}
...
...
@@ -15,6 +12,7 @@
.row
.col-md-6
-
include
'representatives/_representative_block.html'
with
representative
=
representative
.col-md-6
%h2
#votes
Votes
...
...
@@ -72,16 +70,4 @@
%a
{
:href
=>
'
{{
position
.
link
}}
'
}
=
position
.
link
%form
{
:action
=>
'
{
% url
"representatives_positions:position-create"
%
}
',
:method => '
post
'
}
-
csrf_token
%input
{
:type
=>
'hidden'
,
:name
=>
'representative'
,
:value
=>
'
{{
representative
.
pk
}}
'
}
-
bootstrap_form
position_form
-
buttons
%button
{
'type'
:
'submit'
,
'class'
:
'btn btn-primary'
}
{% bootstrap_icon "star" %} Submit
-
endbuttons
-
include
'representatives_positions/_form.html'
with
form
=
position_form
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