Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Public contract registry
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container 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
TO
Public contract registry
Commits
b9d465f7
Commit
b9d465f7
authored
2 years ago
by
Tomáš Valenta
Browse files
Options
Downloads
Patches
Plain Diff
save primary keys before using in save_model
parent
0ab3c098
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#12121
passed
2 years ago
Stage: build
Stage: test_deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contracts/admin.py
+11
-16
11 additions, 16 deletions
contracts/admin.py
with
11 additions
and
16 deletions
contracts/admin.py
+
11
−
16
View file @
b9d465f7
...
...
@@ -5,26 +5,18 @@ from django.contrib import admin
from
django.contrib.auth.models
import
Permission
from
django.utils.html
import
format_html
from
import_export
import
resources
from
nested_admin
import
NestedModelAdmin
,
NestedStackedInline
,
NestedTabularInline
from
nested_admin
import
(
NestedModelAdmin
,
NestedStackedInline
,
NestedTabularInline
)
from
rangefilter.filters
import
DateRangeFilter
from
shared.admin
import
FieldsetInlineOrder
,
MarkdownxGuardedModelAdmin
from
.forms
import
ContractAdminForm
,
ContractFileAdminForm
,
SigneeAdminForm
from
.models
import
(
Contract
,
Contractee
,
ContracteeSignature
,
ContracteeSignatureRepresentative
,
ContractFile
,
ContractFilingArea
,
ContractIntent
,
ContractIssue
,
ContractType
,
Signee
,
SigneeSignature
,
SigneeSignatureRepresentative
,
)
from
.models
import
(
Contract
,
Contractee
,
ContracteeSignature
,
ContracteeSignatureRepresentative
,
ContractFile
,
ContractFilingArea
,
ContractIntent
,
ContractIssue
,
ContractType
,
Signee
,
SigneeSignature
,
SigneeSignatureRepresentative
)
class
ContractResource
(
resources
.
ModelResource
):
...
...
@@ -297,6 +289,9 @@ class ContractAdmin(
return
queryset
def
save_model
(
self
,
request
,
obj
,
form
,
change
):
# Need to generate primary keys first
parent_save_response
=
super
().
save_model
(
request
,
obj
,
form
,
change
)
if
obj
.
valid_start_date
is
None
:
last_signature_date
=
None
...
...
@@ -313,7 +308,7 @@ class ContractAdmin(
obj
.
valid_start_date
=
last_signature_date
return
super
().
save_model
(
request
,
obj
,
form
,
change
)
return
parent_save_response
def
has_change_permission
(
self
,
request
,
obj
=
None
):
if
(
...
...
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