Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nk20
Manage
Activity
Members
Labels
Plan
Issues
32
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
BDE
nk20
Commits
ea8e25a7
Commit
ea8e25a7
authored
5 years ago
by
ynerant
Browse files
Options
Downloads
Patches
Plain Diff
Create WEI
parent
69b7f31e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!78
WEI
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
apps/note/signals.py
+3
-4
3 additions, 4 deletions
apps/note/signals.py
apps/wei/urls.py
+2
-1
2 additions, 1 deletion
apps/wei/urls.py
apps/wei/views.py
+23
-3
23 additions, 3 deletions
apps/wei/views.py
templates/wei/weiclub_list.html
+1
-1
1 addition, 1 deletion
templates/wei/weiclub_list.html
with
29 additions
and
9 deletions
apps/note/signals.py
+
3
−
4
View file @
ea8e25a7
...
...
@@ -17,7 +17,7 @@ def save_user_note(instance, raw, **_kwargs):
instance
.
note
.
save
()
def
save_club_note
(
instance
,
created
,
raw
,
**
_kwargs
):
def
save_club_note
(
instance
,
raw
,
**
_kwargs
):
"""
Hook to create and save a note when a club is updated
"""
...
...
@@ -25,7 +25,6 @@ def save_club_note(instance, created, raw, **_kwargs):
# When provisionning data, do not try to autocreate
return
if
created
:
from
.models
import
NoteClub
NoteClub
.
objects
.
create
(
club
=
instance
)
from
.models
import
NoteClub
NoteClub
.
objects
.
get_or_create
(
club
=
instance
)
instance
.
note
.
save
()
This diff is collapsed.
Click to expand it.
apps/wei/urls.py
+
2
−
1
View file @
ea8e25a7
...
...
@@ -3,12 +3,13 @@
from
django.urls
import
path
from
.views
import
WEIListView
,
WEIDetailView
,
WEIUpdateView
from
.views
import
WEIListView
,
WEICreateView
,
WEIDetailView
,
WEIUpdateView
app_name
=
'
wei
'
urlpatterns
=
[
path
(
'
list/
'
,
WEIListView
.
as_view
(),
name
=
"
wei_list
"
),
path
(
'
create/
'
,
WEICreateView
.
as_view
(),
name
=
"
wei_create
"
),
path
(
'
detail/<int:pk>/
'
,
WEIDetailView
.
as_view
(),
name
=
"
wei_detail
"
),
path
(
'
update/<int:pk>/
'
,
WEIUpdateView
.
as_view
(),
name
=
"
wei_update
"
),
]
This diff is collapsed.
Click to expand it.
apps/wei/views.py
+
23
−
3
View file @
ea8e25a7
...
...
@@ -7,11 +7,11 @@ from django.contrib.auth.mixins import LoginRequiredMixin
from
django.contrib.auth.models
import
User
from
django.db.models
import
Q
from
django.urls
import
reverse_lazy
from
django.views.generic
import
DetailView
,
UpdateView
from
django.views.generic
import
DetailView
,
UpdateView
,
CreateView
from
django_tables2
import
SingleTableView
from
member.models
import
Membership
from
member.models
import
Membership
,
Club
from
member.tables
import
MembershipTable
from
note.models
import
Transaction
from
note.models
import
Transaction
,
NoteClub
from
note.tables
import
HistoryTable
from
permission.backends
import
PermissionBackend
from
permission.views
import
ProtectQuerysetMixin
...
...
@@ -29,6 +29,26 @@ class WEIListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
table_class
=
WEITable
class
WEICreateView
(
ProtectQuerysetMixin
,
LoginRequiredMixin
,
CreateView
):
"""
Create WEI
"""
model
=
WEIClub
form_class
=
WEIForm
def
form_valid
(
self
,
form
):
form
.
instance
.
requires_membership
=
True
form
.
instance
.
parent_club
=
Club
.
objects
.
get
(
name
=
"
Kfet
"
)
ret
=
super
().
form_valid
(
form
)
NoteClub
.
objects
.
create
(
club
=
form
.
instance
)
return
ret
def
get_success_url
(
self
):
self
.
object
.
refresh_from_db
()
return
reverse_lazy
(
"
wei:wei_detail
"
,
kwargs
=
{
"
pk
"
:
self
.
object
.
pk
})
class
WEIDetailView
(
ProtectQuerysetMixin
,
LoginRequiredMixin
,
DetailView
):
"""
View WEI information
...
...
This diff is collapsed.
Click to expand it.
templates/wei/weiclub_list.html
+
1
−
1
View file @
ea8e25a7
...
...
@@ -9,7 +9,7 @@
</h4>
<input
class=
"form-control mx-auto w-25"
type=
"text"
onkeyup=
"search_field_moved()"
id=
"search_field"
/>
<hr>
<a
class=
"btn btn-primary text-center my-4"
href=
"{% url '
member:club
_create' %}"
>
{% trans "Create WEI" %}
</a>
<a
class=
"btn btn-primary text-center my-4"
href=
"{% url '
wei:wei
_create' %}"
>
{% trans "Create WEI" %}
</a>
</div>
</div>
<div
class=
"row justify-content-center"
>
...
...
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